-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SSP-2840] gopay double spend issue (#3635)
- Loading branch information
Showing
30 changed files
with
200 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
storefront/components/Pages/Order/PaymentConfirmation/PaymentInProcess.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ExtendedNextLink } from 'components/Basic/ExtendedNextLink/ExtendedNextLink'; | ||
import { ConfirmationPageContent } from 'components/Blocks/ConfirmationPage/ConfirmationPageContent'; | ||
import { useDomainConfig } from 'components/providers/DomainConfigProvider'; | ||
import { GtmPageType } from 'gtm/enums/GtmPageType'; | ||
import { useGtmStaticPageViewEvent } from 'gtm/factories/useGtmStaticPageViewEvent'; | ||
import { useGtmPageViewEvent } from 'gtm/utils/pageViewEvents/useGtmPageViewEvent'; | ||
import useTranslation from 'next-translate/useTranslation'; | ||
import { getInternationalizedStaticUrls } from 'utils/staticUrls/getInternationalizedStaticUrls'; | ||
|
||
type PaymentInProcessProps = { | ||
orderUrlHash: string; | ||
}; | ||
|
||
export const PaymentInProcess: FC<PaymentInProcessProps> = ({ orderUrlHash }) => { | ||
const { t } = useTranslation(); | ||
const { url } = useDomainConfig(); | ||
const [orderDetailUrl] = getInternationalizedStaticUrls( | ||
[{ url: '/order-detail/:urlHash', param: orderUrlHash }], | ||
url, | ||
); | ||
const gtmStaticPageViewEvent = useGtmStaticPageViewEvent(GtmPageType.payment_in_process); | ||
useGtmPageViewEvent(gtmStaticPageViewEvent); | ||
|
||
return ( | ||
<ConfirmationPageContent | ||
content={t('You can check the status on the order detail page.')} | ||
heading={t('The payment is being processed')} | ||
> | ||
<ExtendedNextLink href={orderDetailUrl} type="orderDetail"> | ||
{t('Show order detail')} | ||
</ExtendedNextLink> | ||
</ConfirmationPageContent> | ||
); | ||
}; |
39 changes: 39 additions & 0 deletions
39
storefront/components/Pages/Order/PaymentConfirmation/PaymentStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { PaymentFail } from './PaymentFail'; | ||
import { PaymentInProcess } from './PaymentInProcess'; | ||
import { PaymentSuccess } from './PaymentSuccess'; | ||
import { TypeUpdatePaymentStatusMutation } from 'graphql/requests/orders/mutations/UpdatePaymentStatusMutation.generated'; | ||
import { TypeOrderPaymentFailedContentQuery } from 'graphql/requests/orders/queries/OrderPaymentFailedContentQuery.generated'; | ||
import { TypeOrderPaymentSuccessfulContentQuery } from 'graphql/requests/orders/queries/OrderPaymentSuccessfulContentQuery.generated'; | ||
|
||
export const PaymentStatus: FC<{ | ||
paymentStatusData: TypeUpdatePaymentStatusMutation | undefined; | ||
failedContentData: TypeOrderPaymentFailedContentQuery | undefined; | ||
successContentData: TypeOrderPaymentSuccessfulContentQuery | undefined; | ||
orderUuid: string; | ||
}> = ({ paymentStatusData, failedContentData, successContentData, orderUuid }) => { | ||
if (paymentStatusData?.UpdatePaymentStatus.isPaid) { | ||
return successContentData ? ( | ||
<PaymentSuccess | ||
orderPaymentSuccessfulContent={successContentData.orderPaymentSuccessfulContent} | ||
orderUuid={orderUuid} | ||
/> | ||
) : null; | ||
} | ||
|
||
if (paymentStatusData?.UpdatePaymentStatus.hasPaymentInProcess) { | ||
return <PaymentInProcess orderUrlHash={paymentStatusData.UpdatePaymentStatus.urlHash} />; | ||
} | ||
|
||
if (paymentStatusData && failedContentData) { | ||
return ( | ||
<PaymentFail | ||
lastUsedOrderPaymentType={paymentStatusData.UpdatePaymentStatus.payment.type} | ||
orderPaymentFailedContent={failedContentData.orderPaymentFailedContent} | ||
orderUuid={orderUuid} | ||
paymentTransactionCount={paymentStatusData.UpdatePaymentStatus.paymentTransactionsCount} | ||
/> | ||
); | ||
} | ||
|
||
return null; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.