[FIX] pos_adyen: Fix Adyen abort function
Currently the "abort" function in the pos_adyen module did not include all the information necessary to cancel the current payment. With this commit this information is added and the status is correctly returned to the JS in order to have the correct status on the payline https://docs.adyen.com/point-of-sale/cancel-a-transaction#cancel-from-register closes odoo/odoo#102747 X-original-commit: 897e9ed1ae5b828017b0cff02281685e757d5e14 Signed-off-by: Quentin Lejeune (qle) <qle@odoo.com> Signed-off-by: Masereel Pierre <pim@odoo.com>
This commit is contained in:
@@ -16,8 +16,6 @@ var PaymentAdyen = PaymentInterface.extend({
|
||||
},
|
||||
send_payment_cancel: function (order, cid) {
|
||||
this._super.apply(this, arguments);
|
||||
// set only if we are polling
|
||||
this.was_cancelled = !!this.polling;
|
||||
return this._adyen_cancel();
|
||||
},
|
||||
close: function () {
|
||||
@@ -142,6 +140,7 @@ var PaymentAdyen = PaymentInterface.extend({
|
||||
|
||||
_adyen_cancel: function (ignore_error) {
|
||||
var self = this;
|
||||
var config = this.pos.config;
|
||||
var previous_service_id = this.most_recent_service_id;
|
||||
var header = _.extend(this._adyen_common_message_header(), {
|
||||
'MessageCategory': 'Abort',
|
||||
@@ -154,6 +153,7 @@ var PaymentAdyen = PaymentInterface.extend({
|
||||
'AbortReason': 'MerchantAbort',
|
||||
'MessageReference': {
|
||||
'MessageCategory': 'Payment',
|
||||
'SaleID': this._adyen_get_sale_id(config),
|
||||
'ServiceID': previous_service_id,
|
||||
}
|
||||
},
|
||||
@@ -161,10 +161,9 @@ var PaymentAdyen = PaymentInterface.extend({
|
||||
};
|
||||
|
||||
return this._call_adyen(data).then(function (data) {
|
||||
|
||||
// Only valid response is a 200 OK HTTP response which is
|
||||
// represented by true.
|
||||
if (! ignore_error && data !== "ok") {
|
||||
if (! ignore_error && data !== true) {
|
||||
self._show_error(_t('Cancelling the payment failed. Please cancel it manually on the payment terminal.'));
|
||||
}
|
||||
});
|
||||
@@ -214,7 +213,7 @@ var PaymentAdyen = PaymentInterface.extend({
|
||||
var order = self.pos.get_order();
|
||||
var line = self.pending_adyen_line();
|
||||
|
||||
if (notification && notification.SaleToPOIResponse.MessageHeader.ServiceID == self.most_recent_service_id) {
|
||||
if (notification && notification.SaleToPOIResponse.MessageHeader.ServiceID == line.terminalServiceId) {
|
||||
var response = notification.SaleToPOIResponse.PaymentResponse.Response;
|
||||
var additional_response = new URLSearchParams(response.AdditionalResponse);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user