Skip to content
Snippets Groups Projects
Commit 749e2233 authored by Pierre Masereel's avatar Pierre Masereel
Browse files

[FIX] pos_adyen: polling response of adyen on correct line


closes odoo/odoo#90740

Signed-off-by: default avatarQuentin Lejeune (qle) <qle@odoo.com>
parent c1c1aa71
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,11 @@ var PaymentAdyen = PaymentInterface.extend({
this.most_recent_service_id = id;
},
pending_adyen_line() {
return this.pos.get_order().paymentlines.find(
paymentLine => paymentLine.payment_method.use_payment_terminal === 'adyen' && (!paymentLine.is_done()));
},
// private methods
_reset_state: function () {
this.was_cancelled = false;
......@@ -38,7 +43,7 @@ var PaymentAdyen = PaymentInterface.extend({
_handle_odoo_connection_failure: function (data) {
// handle timeout
var line = this.pos.get_order().selected_paymentline;
var line = this.pending_adyen_line();
if (line) {
line.set_payment_status('retry');
}
......@@ -209,7 +214,7 @@ var PaymentAdyen = PaymentInterface.extend({
var notification = status.latest_response;
var last_diagnosis_service_id = status.last_received_diagnosis_id;
var order = self.pos.get_order();
var line = order.selected_paymentline;
var line = self.pending_adyen_line();
if (self.last_diagnosis_service_id != last_diagnosis_service_id) {
......@@ -277,7 +282,7 @@ var PaymentAdyen = PaymentInterface.extend({
},
_adyen_handle_response: function (response) {
var line = this.pos.get_order().selected_paymentline;
var line = this.pending_adyen_line();
if (response.error && response.error.status_code == 401) {
this._show_error(_t('Authentication failed. Please check your Adyen credentials.'));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment