diff options
| author | Antoine Prieels <anp@odoo.com> | 2020-03-25 14:09:24 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2020-09-29 11:44:46 +0000 |
| commit | e6dc4ea2e6c321829ed2fe8c1c7b0e58db354935 (patch) | |
| tree | f18015990f7d66ff0db3d1954b881982a2fa4015 /addons/pos_adyen/static | |
| parent | 761639b56b0c9210c77e277f01cea45725b82ef6 (diff) | |
[ADD] adyen_platforms,pos_adyen: Add support for Adyen for Platforms
The goal is to add a nice payment solution to our users.
- Why Adyen?
- Worldwide
- Manages local payment solutions
- Easy onboarding
- For both PoS and eCommerce
- Why Adyen for Platforms?
- The onboarding will be done directly from the customer's DB.
- It's quite complicated for SMEs to get a partnership with Adyen as
they have high requirements for transaction volume. By registering
Odoo as a Platform with Adyen Marketpay, we allow our users to
register as sub-merchants under a common account, removing this
constraint.
As all users are grouped under a common account, all requests need to
provide the same API key. As this key cannot be shared, all requests to
the Adyen API will need to be proxied. A new proxy will be created on
`paymentproxy.odoo.com`.
To initiate a payment, 3 values are required:
- `account_holder_code`: This code is provided by Adyen and is used to
identify the sub-merchant under the common account.
- `adyen_uuid`: This ID is used internally to identify the user.
- `proxy_token`: This token is generated by the proxy during the
account creation and is used to sign all requests.
The DB of the customer is the only host who has all the information
required to modify the sub-merchant info or initiate a payment. If
this information leak, the `proxy_token` can be reset on the proxy to
revoke all access to the API.
Before accessing the form to create an account, users will be
redirected to www.odoo.com where they will be asked to log in. This
ensures that we have contact information for this sub-merchant.
TaskID: 2129218
Diffstat (limited to 'addons/pos_adyen/static')
| -rw-r--r-- | addons/pos_adyen/static/src/js/models.js | 1 | ||||
| -rw-r--r-- | addons/pos_adyen/static/src/js/payment_adyen.js | 11 |
2 files changed, 6 insertions, 6 deletions
diff --git a/addons/pos_adyen/static/src/js/models.js b/addons/pos_adyen/static/src/js/models.js index f2734e00a94..c022ea7ba2b 100644 --- a/addons/pos_adyen/static/src/js/models.js +++ b/addons/pos_adyen/static/src/js/models.js @@ -3,5 +3,6 @@ var models = require('point_of_sale.models'); var PaymentAdyen = require('pos_adyen.payment'); models.register_payment_method('adyen', PaymentAdyen); +models.register_payment_method('odoo_adyen', PaymentAdyen); models.load_fields('pos.payment.method', 'adyen_terminal_identifier'); }); diff --git a/addons/pos_adyen/static/src/js/payment_adyen.js b/addons/pos_adyen/static/src/js/payment_adyen.js index 82c6a9f91ea..7e0350f8328 100644 --- a/addons/pos_adyen/static/src/js/payment_adyen.js +++ b/addons/pos_adyen/static/src/js/payment_adyen.js @@ -43,12 +43,11 @@ var PaymentAdyen = PaymentInterface.extend({ return Promise.reject(data); // prevent subsequent onFullFilled's from being called }, - _call_adyen: function (data, test_endpoint, live_endpoint) { - var self = this; + _call_adyen: function (data, operation) { return rpc.query({ model: 'pos.payment.method', method: 'proxy_adyen_request', - args: [[this.payment_method.id], data, test_endpoint, live_endpoint], + args: [[this.payment_method.id], data, operation], }, { // When a payment terminal is disconnected it takes Adyen // a while to return an error (~6s). So wait 10 seconds @@ -121,6 +120,7 @@ var PaymentAdyen = PaymentInterface.extend({ }, _adyen_cancel: function (ignore_error) { + var self = this; var previous_service_id = this.most_recent_service_id; var header = _.extend(this._adyen_common_message_header(), { 'MessageCategory': 'Abort', @@ -133,7 +133,6 @@ var PaymentAdyen = PaymentInterface.extend({ 'AbortReason': 'MerchantAbort', 'MessageReference': { 'MessageCategory': 'Payment', - 'SaleID': header.SaleID, 'ServiceID': previous_service_id, } }, @@ -144,7 +143,7 @@ var PaymentAdyen = PaymentInterface.extend({ // Only valid response is a 200 OK HTTP response which is // represented by true. - if (! ignore_error && data !== true) { + if (! ignore_error && data !== "ok") { self._show_error(_('Cancelling the payment failed. Please cancel it manually on the payment terminal.')); } }); @@ -238,7 +237,7 @@ var PaymentAdyen = PaymentInterface.extend({ if (message.startsWith('108 ')) { resolve(false); } else { - line.set_payment_status('force_done'); + line.set_payment_status('retry'); reject(); } } |
