Skip to content

Commit

Permalink
Prevent uncorrected place order
Browse files Browse the repository at this point in the history
  • Loading branch information
acasazza committed Nov 28, 2024
1 parent 7579759 commit 06f8fae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ export function AdyenPayment({
.create(type, {
showRemovePaymentMethodButton: showStoredPaymentMethods,
instantPaymentTypes: ['applepay', 'googlepay'],
onDisableStoredPaymentMethod: (state) => {
console.log('onDisableStoredPaymentMethod', state)
},
onSelect: (component) => {
const id: string = component._id
if (id.search('scheme') === -1) {
Expand Down
10 changes: 10 additions & 0 deletions packages/react-components/src/reducers/PlaceOrderReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ export async function setPlaceOrder({
const sdk = getSdk(config)
const { options, paymentType } = state
try {
// Prevent extra place order
const lastOrderStatus = await sdk.orders.retrieve(order.id, {
fields: { orders: ['status'] }
})
if (lastOrderStatus.status === 'placed') {
return {
placed: true,
order
}
}
if (
paymentType === 'paypal_payments' &&
paymentSource?.type === 'paypal_payments'
Expand Down

0 comments on commit 06f8fae

Please sign in to comment.