🔊 More descriptive error message

New error reason when tokenization fails due to missing paymentComponent
This commit is contained in:
Philipp Stracker 2024-09-16 15:12:56 +02:00
parent 1548e1dba7
commit 78e0da27a1
No known key found for this signature in database

View file

@ -17,9 +17,15 @@ const useHandlePaymentSetup = (
}
if ( ! cardToken ) {
let reason = 'tokenization error';
if ( ! paymentComponent ) {
reason = 'initialization error';
}
return {
type: emitResponse.responseTypes.ERROR,
message: 'Could not process the payment (tokenization error)',
message: `Could not process the payment (${ reason })`,
};
}
@ -32,11 +38,7 @@ const useHandlePaymentSetup = (
},
},
};
}, [
card,
paymentComponent,
tokenizedCustomerData,
] );
}, [ card, paymentComponent, tokenizedCustomerData ] );
};
export default useHandlePaymentSetup;