Skip to content

Commit

Permalink
chore: close quick checkout after finishing paypal payment (#784)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianGerke authored Nov 6, 2024
1 parent addff21 commit 0ab1c97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions apps/web/components/PayPal/PayPalExpressButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const localePath = useLocalePath();
const emits = defineEmits<{
(event: 'validation-callback', callback: PayPalAddToCartCallback): Promise<void>;
(event: 'on-approved'): void;
}>();
const props = defineProps<PaypalButtonPropsType>();
Expand Down Expand Up @@ -68,6 +69,8 @@ const onValidationCallback = async () => {
const onApprove = async (data: OnApproveData) => {
const result = await approveOrder(data.orderID, data.payerID ?? '');
emits('on-approved');
if ((props.type === TypeCartPreview || props.type === TypeSingleItem) && result?.url)
navigateTo(localePath(paths.readonlyCheckout + `/?payerId=${data.payerID}&orderId=${data.orderID}`));
Expand Down
6 changes: 3 additions & 3 deletions apps/web/components/QuickCheckout/QuickCheckout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
class="w-full mb-3"
variant="secondary"
>
{{ $t('quickCheckout.checkYourCart') }}
{{ t('quickCheckout.checkYourCart') }}
</UiButton>

<UiButton
Expand All @@ -85,10 +85,10 @@
size="lg"
class="w-full mb-4 md:mb-0"
>
{{ $t('goToCheckout') }}
{{ t('goToCheckout') }}
</UiButton>
<OrDivider class="my-4" v-if="isPayPalReady" />
<PayPalExpressButton class="w-full text-center" type="CartPreview" />
<PayPalExpressButton class="w-full text-center" type="CartPreview" @on-approved="isOpen = false" />
<PayPalPayLaterBanner placement="payment" :amount="totals.total" />
</div>
</div>
Expand Down

0 comments on commit 0ab1c97

Please sign in to comment.