This repository has been archived by the owner on Jul 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 677
Use new Stripe payment gateway #1057
Merged
+395
−144
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
29d83a2
Add 3ds support to Stripe - test commit
orzechdev 4a7e50d
Clean ups
orzechdev 489fc86
Update changelog
orzechdev 2cdf777
Create common payment error messages
orzechdev 2d86253
Update changelog
orzechdev 9591843
Update payment gateways types and messages
orzechdev ffffa92
Add early returns in Stripe submit logic
orzechdev c3da7d1
Shorthand notation for description
orzechdev f46e96b
Update Adyen error translation
orzechdev a938f99
Trigger CI
orzechdev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update payment gateways types and messages
- Loading branch information
commit 959184331323feac5f6149e72a4a5e5b4f7b48c9
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./AdyenPaymentGateway"; | ||
export * from "./intl"; |
50 changes: 50 additions & 0 deletions
50
src/@next/components/organisms/AdyenPaymentGateway/intl.ts
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,50 @@ | ||
import { defineMessages, IntlShape } from "react-intl"; | ||
|
||
const messageDescription = "Adyen payment gateway error"; | ||
|
||
export const adyenErrorMessages = defineMessages({ | ||
unknownPayment: { | ||
defaultMessage: "Unknown payment submission error occured.", | ||
description: messageDescription, | ||
}, | ||
invalidPaymentSubmission: { | ||
defaultMessage: "Invalid payment submission.", | ||
description: messageDescription, | ||
}, | ||
}); | ||
|
||
export const adyenConfirmationErrorMessages = defineMessages({ | ||
error: { | ||
defaultMessage: "Error processing payment occured.", | ||
description: messageDescription, | ||
}, | ||
refused: { | ||
defaultMessage: | ||
"The payment was refused. Try the payment again using a different payment method or card.", | ||
description: messageDescription, | ||
}, | ||
cancelled: { | ||
defaultMessage: "Payment was cancelled.", | ||
description: messageDescription, | ||
}, | ||
general: { | ||
defaultMessage: "Payment confirmation went wrong.", | ||
description: messageDescription, | ||
}, | ||
}); | ||
|
||
export function translateAdyenConfirmationError( | ||
status: string, | ||
intl: IntlShape | ||
): string { | ||
switch (status) { | ||
case "Error": | ||
return intl.formatMessage(adyenConfirmationErrorMessages.error); | ||
case "Refused": | ||
return intl.formatMessage(adyenConfirmationErrorMessages.refused); | ||
case "Cancelled": | ||
return intl.formatMessage(adyenConfirmationErrorMessages.cancelled); | ||
default: | ||
return intl.formatMessage(adyenConfirmationErrorMessages.general); | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
src/@next/components/organisms/StripePaymentGateway/intl.ts
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,24 @@ | ||
import { defineMessages } from "react-intl"; | ||
|
||
const messageDescription = "Stripe payment gateway error"; | ||
|
||
export const stripeErrorMessages = defineMessages({ | ||
gatewayMisconfigured: { | ||
defaultMessage: "Stripe gateway misconfigured. Api key not provided.", | ||
description: messageDescription, | ||
}, | ||
paymentSubmissionError: { | ||
defaultMessage: | ||
"Payment submission error. Stripe gateway returned no payment method in payload.", | ||
description: messageDescription, | ||
}, | ||
geytwayDisplayError: { | ||
defaultMessage: | ||
"Stripe payment gateway couldn't be displayed. Stripe elements were not provided.", | ||
description: messageDescription, | ||
}, | ||
paymentMethodNotCreated: { | ||
defaultMessage: "Payment method has not been created.", | ||
description: messageDescription, | ||
}, | ||
}); |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.