From 21d9e31be12af064e17f351b611e27369652d403 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Sun, 21 Jul 2024 19:55:48 +0800 Subject: [PATCH] updated --- assets/js/main.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/assets/js/main.js b/assets/js/main.js index 8ae5fbd..78b23d5 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -2,6 +2,7 @@ $(document).ready(() => { let startedApp; let oldAmount = 0; + let currentAmount = 0; let completed = false; const { formId, @@ -31,7 +32,7 @@ } }); - if (isEmpty) { + if (isEmpty || !currentAmount) { el.hide(); if ($('#cpEmptyMessage').length === 0) { $('
' + pleaseFillForm + '
').insertBefore(el); @@ -46,11 +47,10 @@ $('#gform_' + formId).on('keyup', checkFormEmpty); const paymentCompleted = async (ctx, formId) => { + ctx.disablePopup = true; const form = $('#gform_' + formId); const helpers = window.cpHelpers || window.cplHelpers; const txHash = ctx.transaction.hash || ctx.transaction.id; - helpers.closePopup(); - await helpers.sleep(100); helpers.successPopup('Payment completed successfully!').then(() => { $('.overlay').remove(); startedApp.store.payment.$reset(); @@ -72,7 +72,8 @@ } gform?.addFilter('gform_product_total', function (amount, formId) { - if (amount !== oldAmount && !completed) { + currentAmount = amount; + if (amount && amount !== oldAmount && !completed) { oldAmount = amount; if (window.CryptoPayApp) { CryptoPayApp.events.add('confirmationCompleted', async (ctx) => {