Skip to content

Commit

Permalink
CIVIEWAY-183 When adding a new Credit Card Contribution, a Red block …
Browse files Browse the repository at this point in the history
…appears before the "Please be sure to click RETURN TO MERCHANT after adding a credit card."
  • Loading branch information
agileware-justin committed Mar 18, 2021
1 parent 4f5b589 commit f4e1f28
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions au_com_agileware_ewayrecurring.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ function getPaymentFormFieldsMetadata() {
'class' => 'eway_credit_card_field',
],
'description' =>
'<div><span class="description">' . E::ts(
'<span class="description">' . E::ts(
'Credit card details are entered directly into eWAY and not stored in CiviCRM. %1',
[1 => '<a href="https://www.eway.com.au/about-eway/technology-security/pci-dss/" target="_blank">' . E::ts('Learn more on eWAY\'s PCI DSS page') . '</a>']
) . '</span></div><script>CRM.$(function ($) {CRM.eway.paymentTokenInitialize();});</script>',
) . '</span><script>CRM.$(function ($) {CRM.eway.paymentTokenInitialize();});</script>',
],
'add_credit_card' => [
'htmlType' => 'button',
Expand All @@ -131,7 +131,7 @@ function getPaymentFormFieldsMetadata() {
'class' => 'eway_credit_card_field',
],
'description' => ts(
'<div><span id="add_credit_card_notification" class="crm-error"></span></div><span class="description">' . E::ts('Please be sure to click <b>RETURN TO MERCHANT</b> after adding a credit card.') . '</span>'
'<span class="description">' . E::ts('Please be sure to click <b>RETURN TO MERCHANT</b> after adding a credit card.') . '</span><div><span id="add_credit_card_notification"></span></div></div>'
)
]
];
Expand Down
4 changes: 2 additions & 2 deletions info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<email>[email protected]</email>
</maintainer>
<develStage>stable</develStage>
<releaseDate>2020-12-14</releaseDate>
<version>2.3.5</version>
<releaseDate>2021-03-18</releaseDate>
<version>2.3.6</version>
<compatibility>
<ver>5.0</ver>
</compatibility>
Expand Down
5 changes: 4 additions & 1 deletion js/eway.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,11 @@ CRM.eway.updateOptions = function (result) {
CRM.eway.toggleCreditCardFields = function () {
CRM.$('select.eway_credit_card_field').prop('disabled', function (i, v) {
if (CRM.eway.contact_id === 0) {
CRM.$('#add_credit_card_notification').addClass('crm-error');
CRM.$('#add_credit_card_notification').text('No contact selected');
return true;
}
CRM.$('#add_credit_card_notification').removeClass('crm-error');
CRM.$('#add_credit_card_notification').text('');
return false;
});
Expand All @@ -84,13 +86,14 @@ CRM.eway.toggleCreditCardFields = function () {
for (const required of requiredFields) {
if (field.name.includes(required)) {
if (field.value.length === 0) {
CRM.$('#add_credit_card_notification').addClass('crm-error');
CRM.$('#add_credit_card_notification').text('The Billing Details section must be completed before a Credit Card can be added');
return true;
}
}
}
}

CRM.$('#add_credit_card_notification').removeClass('crm-error');
CRM.$('#add_credit_card_notification').text('');
return false;
});
Expand Down

0 comments on commit f4e1f28

Please sign in to comment.