From 5d0f031baac5511289846c5db48a1c1538faad22 Mon Sep 17 00:00:00 2001
From: Matthew Wire <mjw@mjwconsult.co.uk>
Date: Thu, 2 Sep 2021 14:16:06 +0100
Subject: [PATCH] Improve detection of billing form

---
 js/crm.payment.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/js/crm.payment.js b/js/crm.payment.js
index 0e9857e..aace675 100644
--- a/js/crm.payment.js
+++ b/js/crm.payment.js
@@ -128,6 +128,14 @@
         // If we have multiple payment processors to select and we are not currently loaded
         billingFormID = $('input[name=hidden_processor]').closest('form').prop('id');
       }
+      if (typeof billingFormID === 'undefined' || (!billingFormID.length)) {
+        billingFormID = $('div#billing-payment-block').closest('form').prop('id');
+      }
+      if (typeof billingFormID === 'undefined' || (!billingFormID.length)) {
+        this.debugging(this.name, 'Could not find billing form!');
+        this.form = null;
+        return this.form;
+      }
       // We have to use document.getElementById here so we have the right elementtype for appendChild()
       this.form = document.getElementById(billingFormID);
       return this.form;
-- 
GitLab