summaryrefslogtreecommitdiff
path: root/addons/adyen_platforms/static/src
diff options
context:
space:
mode:
authorAntoine Prieels <anp@odoo.com>2020-03-25 14:09:24 +0000
committerPierre Masereel <pim@odoo.com>2020-09-29 11:44:46 +0000
commite6dc4ea2e6c321829ed2fe8c1c7b0e58db354935 (patch)
treef18015990f7d66ff0db3d1954b881982a2fa4015 /addons/adyen_platforms/static/src
parent761639b56b0c9210c77e277f01cea45725b82ef6 (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/adyen_platforms/static/src')
-rw-r--r--addons/adyen_platforms/static/src/js/adyen_account_fields.js20
-rw-r--r--addons/adyen_platforms/static/src/js/adyen_account_views.js63
-rw-r--r--addons/adyen_platforms/static/src/js/adyen_transactions.js33
-rw-r--r--addons/adyen_platforms/static/src/xml/adyen_account_templates.xml125
-rw-r--r--addons/adyen_platforms/static/src/xml/adyen_transactions_templates.xml10
5 files changed, 251 insertions, 0 deletions
diff --git a/addons/adyen_platforms/static/src/js/adyen_account_fields.js b/addons/adyen_platforms/static/src/js/adyen_account_fields.js
new file mode 100644
index 00000000000..804f27eab4b
--- /dev/null
+++ b/addons/adyen_platforms/static/src/js/adyen_account_fields.js
@@ -0,0 +1,20 @@
+odoo.define('adyen_platforms.fields', function (require) {
+"use strict";
+
+var core = require('web.core');
+var FieldSelection = require('web.relational_fields').FieldSelection;
+var field_registry = require('web.field_registry');
+
+var qweb = core.qweb;
+
+var AdyenKYCStatusTag = FieldSelection.extend({
+ _render: function () {
+ this.$el.append(qweb.render('AdyenKYCStatusTag', {
+ value: this.value,
+ }));
+ },
+});
+
+field_registry.add("adyen_kyc_status_tag", AdyenKYCStatusTag);
+
+});
diff --git a/addons/adyen_platforms/static/src/js/adyen_account_views.js b/addons/adyen_platforms/static/src/js/adyen_account_views.js
new file mode 100644
index 00000000000..8921a993590
--- /dev/null
+++ b/addons/adyen_platforms/static/src/js/adyen_account_views.js
@@ -0,0 +1,63 @@
+odoo.define('adyen_platforms.account_views', function (require) {
+"use strict";
+
+var core = require('web.core');
+var Dialog = require('web.Dialog');
+var FormController = require('web.FormController');
+var FormView = require('web.FormView');
+var viewRegistry = require('web.view_registry');
+
+var _t = core._t;
+var QWeb = core.qweb;
+
+var AdyenAccountFormController = FormController.extend({
+ _saveRecord: function (recordID, options) {
+ if(this.model.isNew(this.handle) && this.canBeSaved()) {
+ var _super = this._super.bind(this, recordID, options);
+ var buttons = [
+ {
+ text: _t("Create"),
+ classes: 'btn-primary o_adyen_confirm',
+ close: true,
+ disabled: true,
+ click: function () {
+ this.close();
+ _super();
+ },
+ },
+ {
+ text: _t("Cancel"),
+ close: true,
+ }
+ ];
+
+ var dialog = new Dialog(this, {
+ size: 'extra-large',
+ buttons: buttons,
+ title: _t("Confirm your Adyen Account Creation"),
+ $content: QWeb.render('AdyenAccountCreationConfirmation', {
+ data: this.model.get(this.handle).data,
+ }),
+ });
+
+ dialog.open().opened(function () {
+ dialog.$el.on('change', '.opt_in_checkbox', function (ev) {
+ ev.preventDefault();
+ dialog.$footer.find('.o_adyen_confirm')[0].disabled = !ev.currentTarget.checked;
+ });
+ });
+ } else if (!this.model.isNew(this.handle)) {
+ return this._super.apply(this, arguments);
+ }
+ },
+});
+
+var AdyenAccountFormView = FormView.extend({
+ config: _.extend({}, FormView.prototype.config, {
+ Controller: AdyenAccountFormController,
+ }),
+});
+
+viewRegistry.add('adyen_account_form', AdyenAccountFormView);
+
+});
diff --git a/addons/adyen_platforms/static/src/js/adyen_transactions.js b/addons/adyen_platforms/static/src/js/adyen_transactions.js
new file mode 100644
index 00000000000..3a6fe89631d
--- /dev/null
+++ b/addons/adyen_platforms/static/src/js/adyen_transactions.js
@@ -0,0 +1,33 @@
+odoo.define('adyen_platforms.transactions', function (require) {
+"use strict";
+
+var ListController = require('web.ListController');
+var ListView = require('web.ListView');
+var viewRegistry = require('web.view_registry');
+
+var TransactionsListController = ListController.extend({
+ buttons_template: 'AdyenTransactionsListView.buttons',
+ events: _.extend({}, ListController.prototype.events, {
+ 'click .o_button_sync_transactions': '_onTransactionsSync',
+ }),
+
+ _onTransactionsSync: function () {
+ var self = this;
+ this._rpc({
+ model: 'adyen.transaction',
+ method: 'sync_adyen_transactions',
+ args: [],
+ }).then(function () {
+ self.trigger_up('reload');
+ });
+ }
+});
+
+var TransactionsListView = ListView.extend({
+ config: _.extend({}, ListView.prototype.config, {
+ Controller: TransactionsListController,
+ }),
+});
+
+viewRegistry.add('adyen_transactions_tree', TransactionsListView);
+});
diff --git a/addons/adyen_platforms/static/src/xml/adyen_account_templates.xml b/addons/adyen_platforms/static/src/xml/adyen_account_templates.xml
new file mode 100644
index 00000000000..4bec48cdaa3
--- /dev/null
+++ b/addons/adyen_platforms/static/src/xml/adyen_account_templates.xml
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates>
+ <t t-name="AdyenAccountCreationConfirmation">
+ <main>
+ <div class="alert alert-info">
+ You can start processing payments as soon as your application is sent.<br/>
+ Payouts will be blocked until your application has been accepted.<br/>
+ We will notify you when the status of the review changes or if additionnal data is required.<br/>
+ </div>
+
+ <h3>Submitted data</h3>
+ <table class="table table-sm">
+ <t t-if="data.is_business">
+ <tr>
+ <td>Legal Entity</td>
+ <td>Business</td>
+ </tr>
+ <tr>
+ <td>Legal Business Name</td>
+ <td t-esc="data.legal_business_name"/>
+ </tr>
+ <tr>
+ <td>Doing Business As</td>
+ <td t-esc="data.doing_business_as"/>
+ </tr>
+ <tr>
+ <td>Registration Number</td>
+ <td t-esc="data.registration_number"/>
+ </tr>
+ </t>
+ <t t-else="">
+ <tr>
+ <td>Legal Entity</td>
+ <td>Individual</td>
+ </tr>
+ <tr>
+ <td>First Name</td>
+ <td t-esc="data.first_name"/>
+ </tr>
+ <tr>
+ <td>Last Name</td>
+ <td t-esc="data.last_name"/>
+ </tr>
+ <tr>
+ <td>Date of Birth</td>
+ <td t-esc="data.date_of_birth.format('YYYY-MM-DD')"/>
+ </tr>
+ </t>
+ <tr>
+ <td>Email</td>
+ <td t-esc="data.email"/>
+ </tr>
+ <tr>
+ <td>Phone Number</td>
+ <td t-esc="data.phone_number"/>
+ </tr>
+ <tr>
+ <td>Address</td>
+ <td>
+ <t t-esc="data.street"/> <t t-esc="data.house_number_or_name"/>,
+ <t t-esc="data.city"/> <t t-if="data.state_code" t-esc="data.state_code"/> <t t-esc="data.zip"/>,
+ <t t-esc="data.country_code"/>
+ </td>
+ </tr>
+ </table>
+
+ <h3>Disclaimers</h3>
+ <p>WARNING: Please note that the right to use the payment services is only for
+ sales in your own name. You may not resell, hire or on any other basis allow third
+ parties to use the payment services to enable such third parties to be paid for their
+ services. You may not use the payment services for different types of product and
+ services than as registered with your application. In particular you confirm that you
+ will not use the payment services for any type of product or service appearing in the
+ <a href="https://www.odoo.com/odoo_adyen/static/src/pdf/marketpay_prohibited_products_and_services.pdf">
+ Prohibited Products and Services List of our Processor</a>. If we or our
+ Processor at any time discover that the information you provided about your
+ business is incorrect or has changed without informing us or if you violate any of
+ these conditions, the services may be suspended and/or terminated with
+ immediate effect and fines may be applied by the Credit Card Schemes and/or the
+ authorities for unregistered or inappropriate use of payment services which will in
+ such case be payable by you.</p>
+
+ <h3>Contractual Relationship</h3>
+ <p>The payment processing services ordered by you by placing this order will be
+ provided to you by Adyen N.V. (hereafter “Processor”), with which you are
+ entering into a direct agreement by confirming this order. Odoo S.A.
+ (hereafter “We /Us”) will assist and support you in your use of the services to be
+ provided by the Processor and we will provide you first line assistance with and
+ enable you to connect to the systems of Processor to be able to use its services.
+ For this purpose, you hereby instruct Processor to provide us access to your data
+ and setting in Processor’s systems which are used by Processor to provide the
+ services and authorise us to manage these on your behalf.</p>
+
+ <h3>Pricing</h3>
+ <ul>
+ <li>Payment and processing fees are listed on <a href="http://www.adyen.com/pricing">adyen.com/pricing</a>.</li>
+ <li>Payouts cost 0.20€ (EU) or 0.22$ (US) each.</li>
+ <li>Chargebacks cost 7.5€ each.</li>
+ <li>Onboarding and KYC cost 5€.</li>
+ </ul>
+
+ <input type="checkbox" class="opt_in_checkbox"/>
+ I confirm I have taken notice of and accept the following terms and restrictions:
+ <ul>
+ <li>Adyen MarketPay Terms and Conditions (click <a href="https://www.odoo.com/odoo_adyen/static/src/pdf/marketpay_terms_and_conditions.pdf">here</a> to download and review)</li>
+ <li>Adyen Restricted and Prohibited Products and Services list (click <a href="https://www.odoo.com/odoo_adyen/static/src/pdf/marketpay_prohibited_products_and_services.pdf">here</a> to download and review)</li>
+ </ul>
+ </main>
+ </t>
+
+ <t t-name="AdyenKYCStatusTag">
+ <t t-if="value === 'awaiting_data'">
+ <span class="badge badge-pill badge-warning">Data to provide</span>
+ </t>
+ <t t-if="value === 'pending'">
+ <span class="badge badge-pill badge-info">Waiting for validation</span>
+ </t>
+ <t t-if="value === 'passed'">
+ <span class="badge badge-pill badge-success">Confirmed</span>
+ </t>
+ <t t-if="value === 'failed'">
+ <span class="badge badge-pill badge-danger">Failed</span>
+ </t>
+ </t>
+</templates>
diff --git a/addons/adyen_platforms/static/src/xml/adyen_transactions_templates.xml b/addons/adyen_platforms/static/src/xml/adyen_transactions_templates.xml
new file mode 100644
index 00000000000..50552e80c6f
--- /dev/null
+++ b/addons/adyen_platforms/static/src/xml/adyen_transactions_templates.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates>
+ <t t-extend="ListView.buttons" t-name="AdyenTransactionsListView.buttons">
+ <t t-jquery="button.o_list_button_discard" t-operation="after">
+ <button type="button" class="btn btn-primary o_button_sync_transactions">
+ Sync Transactions
+ </button>
+ </t>
+ </t>
+</templates>