mirror of
https://github.com/bringout/oca-ocb-pos.git
synced 2026-04-23 23:22:08 +02:00
Initial commit: Pos packages
This commit is contained in:
commit
95dfb9edb0
1301 changed files with 264148 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
odoo.define('pos_adyen.PaymentScreen', function(require) {
|
||||
"use strict";
|
||||
|
||||
const PaymentScreen = require('point_of_sale.PaymentScreen');
|
||||
const Registries = require('point_of_sale.Registries');
|
||||
const { onMounted } = owl;
|
||||
|
||||
const PosAdyenPaymentScreen = PaymentScreen => class extends PaymentScreen {
|
||||
setup() {
|
||||
super.setup();
|
||||
onMounted(() => {
|
||||
const pendingPaymentLine = this.currentOrder.paymentlines.find(
|
||||
paymentLine => paymentLine.payment_method.use_payment_terminal === 'adyen' &&
|
||||
(!paymentLine.is_done() && paymentLine.get_payment_status() !== 'pending')
|
||||
);
|
||||
if (pendingPaymentLine) {
|
||||
const paymentTerminal = pendingPaymentLine.payment_method.payment_terminal;
|
||||
paymentTerminal.set_most_recent_service_id(pendingPaymentLine.terminalServiceId);
|
||||
pendingPaymentLine.set_payment_status('waiting');
|
||||
paymentTerminal.start_get_status_polling().then(isPaymentSuccessful => {
|
||||
if (isPaymentSuccessful) {
|
||||
pendingPaymentLine.set_payment_status('done');
|
||||
pendingPaymentLine.can_be_reversed = paymentTerminal.supports_reversals;
|
||||
} else {
|
||||
pendingPaymentLine.set_payment_status('retry');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Registries.Component.extend(PaymentScreen, PosAdyenPaymentScreen);
|
||||
|
||||
return PaymentScreen;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue