Revert "[IMP] p_donation_theme: add dynamic amount"
This commit is contained in:
parent
fdb83804c7
commit
e6c568d8b5
|
|
@ -151,8 +151,8 @@ class PaymentPortalExtraFields(PaymentPortal):
|
||||||
success = False
|
success = False
|
||||||
order = request.website.sale_get_order(force_create=True)
|
order = request.website.sale_get_order(force_create=True)
|
||||||
product_id = kw.pop('product_id')
|
product_id = kw.pop('product_id')
|
||||||
acquire_id = kw.pop('acquire_id', request.env.ref('payment_applepay.payment_acquirer_applepay').id)
|
acquire_id = kw.pop('acquire_id')
|
||||||
mobile = kw.pop('mobile', '')
|
mobile = kw.pop('mobile')
|
||||||
if order:
|
if order:
|
||||||
if product_id:
|
if product_id:
|
||||||
product_id = request.env['product.product'].sudo().browse(int(product_id))
|
product_id = request.env['product.product'].sudo().browse(int(product_id))
|
||||||
|
|
|
||||||
|
|
@ -30,23 +30,22 @@ odoo.define('p_donation_theme.product-gift-card', function (require) {
|
||||||
|
|
||||||
_convert_arabic_to_english(ev) {
|
_convert_arabic_to_english(ev) {
|
||||||
ev.currentTarget.value = ArabictoEnglishNumber(ev.currentTarget.value)
|
ev.currentTarget.value = ArabictoEnglishNumber(ev.currentTarget.value)
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async start() {
|
async start() {
|
||||||
await this._super(...arguments);
|
await this._super(...arguments);
|
||||||
const amounts = this.$('.donation-product-detail-layout .single-amount');
|
|
||||||
if (amounts.length > 0) {
|
|
||||||
amounts.get(0).click();
|
|
||||||
}
|
|
||||||
const $parent = this.$el.find('.js_product');
|
const $parent = this.$el.find('.js_product');
|
||||||
const product_id = this._getProductId($parent);
|
const product_id = this._getProductId($parent);
|
||||||
const amount = this._get_donation_amount();
|
if (product_id) {
|
||||||
if (product_id && amount) {
|
|
||||||
const data = await this._rpc({
|
const data = await this._rpc({
|
||||||
route: '/quickpay/hyperpay/payment/create',
|
route: '/quickpay/hyperpay/payment/create',
|
||||||
params: {
|
params: {
|
||||||
|
'acquire_id': 20,
|
||||||
'product_id': product_id,
|
'product_id': product_id,
|
||||||
'amount': amount,
|
'currency_id': 148,
|
||||||
|
'mobile': '',
|
||||||
|
'amount': 100,
|
||||||
'is_donation_detail_page': true
|
'is_donation_detail_page': true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -65,17 +64,6 @@ odoo.define('p_donation_theme.product-gift-card', function (require) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_get_donation_amount(){
|
|
||||||
let amount = ArabictoEnglishNumber(this.$el.find('input.donation-input-amt').val());
|
|
||||||
if (!amount) {
|
|
||||||
const $amountEl = this.$('#fixedqtyinput-1');
|
|
||||||
let qty = parseFloat($amountEl.val(), 10);
|
|
||||||
let price = parseFloat($amountEl.data('price'), 10);
|
|
||||||
amount = qty * price;
|
|
||||||
}
|
|
||||||
return amount;
|
|
||||||
},
|
|
||||||
|
|
||||||
_submitForm() {
|
_submitForm() {
|
||||||
const params = this.rootProduct;
|
const params = this.rootProduct;
|
||||||
const $product = $('#product_detail');
|
const $product = $('#product_detail');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue