Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

I am working on new payment method for odoo 17, which will send request to external system using backend python code (this._demo_pay is calling backend),  now i have to call another status API ('proxy_demo_status_request') every 10 sec. to check if payment is successful or failed. 


How to call API ('_call_demo_status') in interval of 10 sec. & with timeout after 60 sec ? Can someone please guide me. 


While 60 sec. timeout not completed i should not process another payment request. 


Below is my existing code sample 


export class PaymentDemo extends PaymentInterface {
    setup() {
        super.setup(...arguments);
        this.paymentLineResolvers = {};
    }

    send_payment_request(cid) {
        super.send_payment_request(cid);
        return this._demo_pay(cid);
    }
    send_payment_cancel(order, cid) {
        super.send_payment_cancel(order, cid);
        return this._demo_cancel();
    }

async _demo_pay(cid) {

return this._call_demo(data).then((data) => {
                    return this._demo_handle_response(data);
                });
}

_call_demo(data, operation = false) {

return this.env.services.orm.silent
.call("pos.payment.method", "proxy_demo_request", [
[this.payment_method.id],
            data,
            operation,
        ])
        .catch(this._handle_odoo_connection_failure.bind(this));
}
}



Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 24
1989
1
paź 24
1060
1
lip 24
1496
0
sie 24
1065
0
lis 24
2473