iATSPayments / com.iatspayments.civicrm

CiviCRM Extension supporting iATS Payments services
Other
14 stars 38 forks source link

Image of Checking Not Appearing / currency = '' #244

Open cmmadmin opened 6 years ago

cmmadmin commented 6 years ago

The image of the check (USD_check_500x.jpg) is not appearing when EFT/ACH is selected on a contribution page. I see this is defined in BillingBlockDirectDebitExtra_USD.tpl which is never being loaded.

Using the debugger I discovered, this condition is false in iats.php because the _paymentProcessor array is empty. if (!empty($form->_paymentProcessor['id'])) {

In function iats_getCurrency($form), this function call $currency = $form->getCurrency(); results in currency=''"

I see this message in the log: "May 30 10:01:28 [warning] addCurrency: Currency is disabled but still in use!"

CiviCRM 5.0.0, iATS 1.6.1

cmmadmin commented 6 years ago

I see you comment on commit f61437d in CiviCRM core. We currently have 4 payment processors setup (2 for iATS and 2 for Vanco), but only the 2 iATS ones are selected on this contribution page. Two of each for ACH and CC. We use Vanco for Events and iATS for Contributions.

cmmadmin commented 6 years ago

I disabled all but one of the payment processors, as so I have on the iATS ACH payment processor enabled. And now the image of the check appears correctly. So it does appear to be an issue with more than one payment processor.

cmmadmin commented 6 years ago

I hardcoded "&currency=USD" on line 114 of paymentBlock.tpl then the check appears. But this hack is hardly a solution :-)

var dataUrl = "{crmURL p='civicrm/payment/form' h=0 q="&formName=$form.formName&currency=USD&$urlPathVar``$isBackOfficePathVar``$profilePathVar``$contributionPageID``$preProfileIDprocessor_id="}" + type;

KarinG commented 6 years ago

I have noticed a fairly recent regression in getcurrency as well - what it does is it stops all other javascript bits from loading (and that includes the chq images);

adixon commented 6 years ago

The log message appears to be unrelated and has just been patched, here: https://github.com/civicrm/civicrm-core/commit/91a332284b56766f7f0f89eb2daf408dc9cda502

I do see a similar behaviour, though not identical. Specifically, if I set my default processor to not be the iATS CC processor, and then have a page with only the iATS CC processor option set, then the billing fields do not appear. There's no javascript displayed. I'm not sure if this is new or not, or whether it similar to my comment you noted on https://github.com/civicrm/civicrm-core/commit/f61437d3e85c5458b06403a5118ab9f04ac7a1dc

adixon commented 6 years ago

I believe the symptom only occurs if:

  1. There is more than one payment processor enabled on the page.
  2. Neither one is the site-default.

It's not a common scenario, but also not unreasonable.

My guess is that it could be fixed in core code by selecting the first listed payment processor as the default when neither one is the site-default.

adixon commented 6 years ago

And as you noted, the issue occurs due to the lack of currency information available. Specifically, it happens when the ach/eft billing form is loaded asynchronously. I believe this is a civicrm core error, now submitted here: https://lab.civicrm.org/dev/core/issues/240