Debian Codegraph @

addons/pos_mollie/static/src/overrides/pos_store.js

raw
1 import { patch } from "@web/core/utils/patch";
2 import { PosStore } from "@point_of_sale/app/services/pos_store";
3
4 patch(PosStore.prototype, {
5 async setup() {
6 await super.setup(...arguments);
7 this.data.connectWebSocket("MOLLIE_PAYMENT_STATUS", (payload) => {
8 if (payload.session_id === this.session.id) {
9 const paymentLine = this.models["pos.payment"].find(
10 (line) => line.transaction_id === payload.payment_id
11 );
12
13 if (
14 paymentLine &&
15 !paymentLine.isDone() &&
16 paymentLine.getPaymentStatus() !== "retry"
17 ) {
18 paymentLine.payment_method_id.payment_terminal.handleMollieStatusResponse(
19 paymentLine,
20 payload
21 );
22 }
23 }
24 });
25 },
26 });