From e35d701dd7d3b3dd4b8b5652d5c6b5539313cb9c Mon Sep 17 00:00:00 2001 From: abdurrahman-saber <152967039+abdurrahman-saber@users.noreply.github.com> Date: Mon, 17 Feb 2025 10:22:18 +0200 Subject: [PATCH] Revert "[IMP] p_donation_theme: add apple pay btn in product detail screen" --- .gitignore | 6 ---- .../p_donation_theme/controllers/main.py | 34 +------------------ .../static/src/js/product-gift-card.js | 31 ----------------- 3 files changed, 1 insertion(+), 70 deletions(-) diff --git a/.gitignore b/.gitignore index 583082b9d..f522c0579 100644 --- a/.gitignore +++ b/.gitignore @@ -125,9 +125,3 @@ dmypy.json # github action .github/workflows/*yaml - -# config -.config/ - -# vscode -.vscode/ \ No newline at end of file diff --git a/odex25_donation/p_donation_theme/controllers/main.py b/odex25_donation/p_donation_theme/controllers/main.py index a2aae1423..42d4f43bf 100644 --- a/odex25_donation/p_donation_theme/controllers/main.py +++ b/odex25_donation/p_donation_theme/controllers/main.py @@ -194,10 +194,7 @@ class PaymentPortalExtraFields(PaymentPortal): 'tx_id': tx.id } if payment_acquire_id and payment_acquire_id.code == 'applepay' and tx: - if kw.get('is_donation_detail_page'): - redirect_url = '/quick/applepay/payment/json?tx=%s' % (tx.id) - else: - redirect_url = '/quick/applepay/payment?tx=%s' % (tx.id) + redirect_url = '/quick/applepay/payment?tx=%s' % (tx.id) final_vals.update({ 'redirect_url': redirect_url }) @@ -230,32 +227,3 @@ class PaymentPortalExtraFields(PaymentPortal): {'check_out_id': kw.get('check_out_id'), 'return_url': kw.get('applepay_return')}) else: return request.redirect('/') - - @http.route('/quick/applepay/payment/json', type='json', auth='public', website=True) - def apple_pay_payment_method_json(self, **kwargs): - tx = kwargs.get('tx') - payment_sudo = request.env['payment.transaction'].sudo() - tx = payment_sudo.search([('id', '=', int(tx))], limit=1) - if tx: - kw = tx._get_processing_values() - kw = tx._get_specific_rendering_values(kw) - - acquirer = request.env['payment.provider'].sudo().search([('code', '=', 'applepay')], limit=1) - - kw['currency'] = 'SAR' - _logger.info("Post Values From Apple Payment = %s" % (kw)) - - if acquirer.state == 'test': - content = request.env['ir.ui.view'].sudo()._render_template( - 'payment_applepay.payment_applepay_card', - {'check_out_id': kw.get('check_out_id'), 'return_url': kw.get('applepay_return')} - ) - return {'content': content} - else: - content = request.env['ir.ui.view'].sudo()._render_template( - 'payment_applepay.payment_applepay_card_live', - {'check_out_id': kw.get('check_out_id'), 'return_url': kw.get('applepay_return')} - ) - return {'content': content} - else: - return request.redirect('/') 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 bf21eedf2..1c725f6b9 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 @@ -33,37 +33,6 @@ odoo.define('p_donation_theme.product-gift-card', function (require) { }, - async start() { - await this._super(...arguments); - const $parent = this.$el.find('.js_product'); - const product_id = this._getProductId($parent); - if (product_id) { - const data = await this._rpc({ - route: '/quickpay/hyperpay/payment/create', - params: { - 'acquire_id': 20, - 'product_id': product_id, - 'currency_id': 148, - 'mobile': '', - 'amount': 100, - 'is_donation_detail_page': true - } - }); - if (data.redirect_url) { - const apple_pay_form = await this._rpc({ - route: data.redirect_url, - params: { - 'tx': data.tx_id - } - }); - if (apple_pay_form.content) { - const $applePayEl = $(apple_pay_form.content); - $applePayEl.prependTo($('.temp-donate-now').parent()); - } - } - } - }, - _submitForm() { const params = this.rootProduct; const $product = $('#product_detail');