You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

52 lines
2.0 KiB

/** @odoo-module **/
import paymentForm from '@payment/js/payment_form';
import paymentSaferPayMixin from '@safer_pay/js/payment_saferpay_mixin';
paymentForm.include({
// #=== DOM MANIPULATION ===#
/**
* Prepare the inline form of safer_pay for direct payment.
*
* @override method from @payment/js/payment_form
* @private
* @param {number} providerId - The id of the selected payment option's provider.
* @param {string} providerCode - The code of the selected payment option's provider.
* @param {number} paymentOptionId - The id of the selected payment option
* @param {string} paymentMethodCode - The code of the selected payment method, if any.
* @param {string} flow - The online payment flow of the selected payment option.
* @return {void}
*/
async _prepareInlineForm(providerId, providerCode, paymentOptionId, paymentMethodCode, flow) {
if (providerCode !== 'saferpay') {
this._super(...arguments);
return;
} else if (flow === 'token') {
return;
}
this._setPaymentFlow('direct');
},
// #=== PAYMENT FLOW ===#
/**
* Simulate a feedback from a payment provider and redirect the customer to the status page.
*
* @override method from payment.payment_form
* @private
* @param {string} providerCode - The code of the selected payment option's provider.
* @param {number} paymentOptionId - The id of the selected payment option.
* @param {string} paymentMethodCode - The code of the selected payment method, if any.
* @param {object} processingValues - The processing values of the transaction.
* @return {void}
*/
async _processDirectFlow(providerCode, paymentOptionId, paymentMethodCode, processingValues) {
if (providerCode !== 'saferpay') {
this._super(...arguments);
return;
}
paymentSaferPayMixin.processSaferPayPayment(processingValues);
},
});