Skip to content

Commit

Permalink
fix: Reorder error type in handleRequestError from feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed Apr 9, 2024
1 parent 0a8c584 commit 521c606
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/payment/data/handleRequestError.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,25 @@ export default function handleRequestError(error) {
]);
}

// For a Payment Intent to be confirmable, it must be in requires_payment_method or requires_confirmation
if (error.code === 'payment_intent_unexpected_state' && error.type === 'invalid_request_error') {
logInfo('Basket Changed Error', error.code);
// Country not DPM compatible
if (error.type === 'invalid_request_error' && (
error.param === 'payment_method_data[billing_details][address][country]' || error.param === 'billing_details[address][state]' || error.param === 'billing_details[address][postal_code]'
)) {
logInfo('Dynamic Payment Method Country Error', error.param);
handleApiErrors([
{
error_code: 'basket-changed-error-message',
error_code: 'dynamic-payment-methods-country-not-compatible',
user_message: 'error',
},
]);
}

// Country not DPM compatible
if (error.type === 'invalid_request_error' && (
error.param === 'payment_method_data[billing_details][address][country]' || error.param === 'billing_details[address][state]' || error.param === 'billing_details[address][postal_code]'
)) {
logInfo('Dynamic Payment Method Country Error', error.param);
// For a Payment Intent to be confirmable, it must be in requires_payment_method or requires_confirmation
if (error.code === 'payment_intent_unexpected_state' && error.type === 'invalid_request_error') {
logInfo('Basket Changed Error', error.code);
handleApiErrors([
{
error_code: 'dynamic-payment-methods-country-not-compatible',
error_code: 'basket-changed-error-message',
user_message: 'error',
},
]);
Expand Down

0 comments on commit 521c606

Please sign in to comment.