Ir al contenido
Menú
Se marcó esta pregunta

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



Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
ago 24
1987
1
oct 24
1049
1
jul 24
1496
0
ago 24
1065
0
nov 24
2468