Jump to content

I need urgent help - "I need reg expression to allow 9 or 10


VA VA

Recommended Posts

"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 by WHMCS Peter
Removed attachment, updated with inline code-block
Link to comment
Share on other sites

  • WHMCS Staff

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/

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated