Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
941 Vizualizări

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));
}
}



Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
aug. 24
2069
1
oct. 24
1105
1
iul. 24
1542
0
aug. 24
1086
0
nov. 24
2511