summaryrefslogtreecommitdiff
path: root/addons/website_quote/static/src/js
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2017-05-24 12:48:38 +0200
committerThibault Delavallée <tde@odoo.com>2017-06-06 11:05:25 +0200
commitef2d828463e6232085fbc7d139fb25a43f978101 (patch)
tree8fb8bc5330811f3b82f2a67718439a9b7ff99754 /addons/website_quote/static/src/js
parent8564f1e8a192a5b473eee0855ebc918f8417bab5 (diff)
[REF] website_quote: use new sale_payment module
Online quote now uses JS code from payment module in order to make online payments. Front-end template is updated to use o_payment_acquirer_button generic class for payments and data is added to be managed by payment.js. This allows to remove some strange code parsing the url to find the order ID and token instead of using rendered values. A payment controller is removed because it was only a shortcut to another one. In transaction controller token parameter is renamed to access_token to avoid confusion with payment token and match the payment and website sale naming. Online Quote controller now uses tools method from sale_payment module like website_sale. This way it is now standardized and moved out of controllers that should not perform so much model-level computation.
Diffstat (limited to 'addons/website_quote/static/src/js')
-rw-r--r--addons/website_quote/static/src/js/website_quotation.js42
1 files changed, 0 insertions, 42 deletions
diff --git a/addons/website_quote/static/src/js/website_quotation.js b/addons/website_quote/static/src/js/website_quotation.js
index a6e1b701c5e..afe84e5a57c 100644
--- a/addons/website_quote/static/src/js/website_quotation.js
+++ b/addons/website_quote/static/src/js/website_quotation.js
@@ -4,7 +4,6 @@ odoo.define('website_quote.website_quote', function (require) {
var ajax = require('web.ajax');
var config = require('web.config');
var Widget = require('web.Widget');
-var website = require('website.website');
if(!$('.o_website_quote').length) {
return $.Deferred().reject("DOM doesn't contain '.o_website_quote'");
@@ -200,44 +199,3 @@ if(!$('.o_website_quote').length) {
},
});
});
-
-odoo.define('website_quote.payment_method', function (require) {
-'use strict';
-
- require('website.website');
- var ajax = require('web.ajax');
-
- if(!$('#payment_method').length) {
- return $.Deferred().reject("DOM doesn't contain '#payment_method'");
- }
-
- // dbo note: website_sale code for payment
- // if we standardize payment somehow, this should disappear
- // When choosing an acquirer, display its Pay Now button
- var $payment = $("#payment_method");
- $payment.on("click", "input[name='acquirer']", function (ev) {
- var payment_id = $(ev.currentTarget).val();
- $("div.oe_quote_acquirer_button[data-id]", $payment).addClass("hidden");
- $("div.oe_quote_acquirer_button[data-id='"+payment_id+"']", $payment).removeClass("hidden");
- })
- .find("input[name='acquirer']:checked").click();
-
- // When clicking on payment button: create the tx using json then continue to the acquirer
- $('.oe_quote_acquirer_button').on("click", 'button[type="submit"],button[name="submit"]', function (ev) {
- ev.preventDefault();
- ev.stopPropagation();
- var $form = $(ev.currentTarget).parents('form');
- var acquirer_id = $(ev.currentTarget).parents('.oe_quote_acquirer_button').first().data('id');
- if (! acquirer_id) {
- return false;
- }
- var href = $(location).attr("href");
- var order_id = href.match(/quote\/([0-9]+)/)[1];
- var token = href.match(/quote\/[0-9]+\/([^\/?]*)/);
- token = token ? token[1] : '';
- ajax.jsonRpc('/quote/' + order_id +'/transaction/' + acquirer_id + (token ? '/' + token : ''), 'call', {}).then(function (data) {
- $form.html(data);
- $form.submit();
- });
- });
-});