Skip to content

Commit

Permalink
Merge pull request #8 from WeGetFinancing/GET-2400
Browse files Browse the repository at this point in the history
GET-2400 | fix(validator): merchant token empty validator refactoring
  • Loading branch information
rdeleo committed Nov 3, 2023
2 parents f381db6 + 8ff8aef commit 924582e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion etc/adminhtml/system.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
showInDefault="1" showInWebsite="1" showInStore="1"
>
<label>PPE Merchant Token</label>
<validate>validate-wgf-merchant-token-empty validate-wgf-merchant-token-error</validate>
<validate>validate-wgf-merchant-token-not-set validate-wgf-merchant-token-empty validate-wgf-merchant-token-error</validate>
</field>
<field
id="ppe_is_apply_now"
Expand Down
1 change: 1 addition & 0 deletions view/adminhtml/layout/adminhtml_system_config_edit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
<head>
<link src="WeGetFinancing_Checkout::js/validator-merchant-token-empty.js"/>
<link src="WeGetFinancing_Checkout::js/validator-merchant-token-error.js"/>
<link src="WeGetFinancing_Checkout::js/validator-merchant-token-not-set.js"/>
</head>
</page>
16 changes: 16 additions & 0 deletions view/adminhtml/web/js/validator-merchant-token-not-set.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require(
[
'jquery',
'mage/translate',
'jquery/validate'
],
function($){
$.validator.addMethod(
'validate-wgf-merchant-token-not-set',
function (value) {
return !("" === String(value).trim());
},
$.mage.__("The PPE Merchant Token cannot be empty.")
);
}
);

0 comments on commit 924582e

Please sign in to comment.