Debian Codegraph @

addons/pos_adyen/static/src/app/screens/payment_screen/payment_screen.js

raw
1 import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
2 import { patch } from "@web/core/utils/patch";
3 import { onMounted } from "@odoo/owl";
4
5 patch(PaymentScreen.prototype, {
6 setup() {
7 super.setup(...arguments);
8 onMounted(() => {
9 const pendingPaymentLine = this.currentOrder.payment_ids.find(
10 (paymentLine) =>
11 paymentLine.payment_method_id.use_payment_terminal === "adyen" &&
12 !paymentLine.isDone() &&
13 paymentLine.getPaymentStatus() !== "pending"
14 );
15 if (!pendingPaymentLine) {
16 return;
17 }
18 pendingPaymentLine.payment_method_id.payment_terminal.setMostRecentServiceId(
19 pendingPaymentLine.terminalServiceId
20 );
21 });
22 },
23 });