VA VA Posted March 24, 2020 Share Posted March 24, 2020 (edited) "I need reg expression to allow 9 or 10 digits with no whitespace. For this I created a reg expression and used in attached file. But it is not working. Can you let me know what is wrong or missed in my code? My creditcard is still not working. See the attached file." Thanks <?php function addCustomCardType($vars) { $vars['supportedCardTypes'] .= ',isracard'; return <<<HTML <script> jQuery(document).ready(function() { var customCardType = { type: 'isracard', patterns: [54, 77], //What are the first digits. eg: [51, 52, 53, 54, 55, 22, 23, 24, 25, 26, 27], format: /^[0-9]{0,}$/, // Default Format: /(\d{1,4})/g length: [9, 10], //12 is the minimum supported card length in WHMCS. Can be multiple. Eg: length: [16, 17, 18, 19], cvcLength: [3], //The cvv length. Can be an array of accepted lengths luhn: false } if (jQuery.payment.cards) { jQuery.payment.cards.push(customCardType); } }); </script> HTML; } add_hook('AdminAreaFooterOutput', 1, 'addCustomCardType'); add_hook('ClientAreaFooterOutput', 1, 'addCustomCardType'); Edited March 24, 2020 by WHMCS Peter Removed attachment, updated with inline code-block 0 Quote Link to comment Share on other sites More sharing options...
bear Posted March 24, 2020 Share Posted March 24, 2020 I don't know about others on this community, but I'm not opening a zip file to see this. Any reason you can't post the code? 0 Quote Link to comment Share on other sites More sharing options...
WHMCS Peter Posted March 24, 2020 Share Posted March 24, 2020 Hi, I have removed your attachment from your original post, deleted your most recent reply and added the code in a codeblock in your original post. Please do provide code-snippets, rather than attachments as many people will not trust the authenticity of them. At this time, WHMCS does not support the adding of custom card types due to internal validation server-side. Your code will simply update the client-side validation. There is no way to work around this at this time. I'd recommend opening a Feature Request as I can see how the ability to add support for custom card types would be useful: https://requests.whmcs.com/ 0 Quote Link to comment Share on other sites More sharing options...
VA VA Posted March 25, 2020 Author Share Posted March 25, 2020 I got the reply from WHMCS support that "Attached is an action hook which should allow you to add a custom card type to the jQuery validation on the client area and admin area payment forms. This can then be used in conjunction with a Remote Input type payment gateway module where you should be able to accept and return your custom card data in your module to handle this use-case. These two items should allow you to process payments for unsupported card types and lengths." This is same hook. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.