From e6c568d8b59991e006cb7babe73d191475e4cece Mon Sep 17 00:00:00 2001 From: abdurrahman-saber <152967039+abdurrahman-saber@users.noreply.github.com> Date: Mon, 17 Feb 2025 10:21:35 +0200 Subject: [PATCH] Revert "[IMP] p_donation_theme: add dynamic amount" --- .../p_donation_theme/controllers/main.py | 4 ++-- .../static/src/js/product-gift-card.js | 24 +++++-------------- 2 files changed, 8 insertions(+), 20 deletions(-) diff --git a/odex25_donation/p_donation_theme/controllers/main.py b/odex25_donation/p_donation_theme/controllers/main.py index fcec4f0d8..a2aae1423 100644 --- a/odex25_donation/p_donation_theme/controllers/main.py +++ b/odex25_donation/p_donation_theme/controllers/main.py @@ -151,8 +151,8 @@ class PaymentPortalExtraFields(PaymentPortal): success = False order = request.website.sale_get_order(force_create=True) product_id = kw.pop('product_id') - acquire_id = kw.pop('acquire_id', request.env.ref('payment_applepay.payment_acquirer_applepay').id) - mobile = kw.pop('mobile', '') + acquire_id = kw.pop('acquire_id') + mobile = kw.pop('mobile') if order: if product_id: product_id = request.env['product.product'].sudo().browse(int(product_id)) diff --git a/odex25_donation/p_donation_theme/static/src/js/product-gift-card.js b/odex25_donation/p_donation_theme/static/src/js/product-gift-card.js index 6fe9fb8cd..bf21eedf2 100644 --- a/odex25_donation/p_donation_theme/static/src/js/product-gift-card.js +++ b/odex25_donation/p_donation_theme/static/src/js/product-gift-card.js @@ -30,23 +30,22 @@ odoo.define('p_donation_theme.product-gift-card', function (require) { _convert_arabic_to_english(ev) { ev.currentTarget.value = ArabictoEnglishNumber(ev.currentTarget.value) + }, async start() { 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 product_id = this._getProductId($parent); - const amount = this._get_donation_amount(); - if (product_id && amount) { + if (product_id) { const data = await this._rpc({ route: '/quickpay/hyperpay/payment/create', params: { + 'acquire_id': 20, 'product_id': product_id, - 'amount': amount, + 'currency_id': 148, + 'mobile': '', + 'amount': 100, '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() { const params = this.rootProduct; const $product = $('#product_detail');