2024-07-12 12:58:34 +02:00
|
|
|
import BaseHandler from './BaseHandler';
|
2023-11-03 10:30:31 +00:00
|
|
|
|
|
|
|
class PreviewHandler extends BaseHandler {
|
2024-07-12 12:58:34 +02:00
|
|
|
constructor( buttonConfig, ppcpConfig, externalHandler ) {
|
|
|
|
super( buttonConfig, ppcpConfig, externalHandler );
|
|
|
|
}
|
|
|
|
|
|
|
|
transactionInfo() {
|
|
|
|
// We need to return something as ApplePay button initialization expects valid data.
|
|
|
|
return {
|
|
|
|
countryCode: 'US',
|
|
|
|
currencyCode: 'USD',
|
|
|
|
totalPrice: '10.00',
|
|
|
|
totalPriceStatus: 'FINAL',
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
createOrder() {
|
|
|
|
throw new Error( 'Create order fail. This is just a preview.' );
|
|
|
|
}
|
|
|
|
|
|
|
|
approveOrder( data, actions ) {
|
|
|
|
throw new Error( 'Approve order fail. This is just a preview.' );
|
|
|
|
}
|
|
|
|
|
|
|
|
actionHandler() {
|
|
|
|
throw new Error( 'Action handler fail. This is just a preview.' );
|
|
|
|
}
|
|
|
|
|
|
|
|
errorHandler() {
|
|
|
|
throw new Error( 'Error handler fail. This is just a preview.' );
|
|
|
|
}
|
2023-11-03 10:30:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default PreviewHandler;
|