Vinson – Mastercard Regex Patch

In your Vinson implementation, the credit card regex values are configured using the SuiteCommerce Configuration record. The default values for this record reside in the PaymentMethods.json configuration file, which is located in the Configuration module.

This section explains how to update the default Mastercard regex value in the JSON source code. You can download the code samples described in this procedure here: MastercardBinRegex---VinsonCodeSample.zip.

Note:

For instructions on configuring this property for a domain, see Site Configuration. For more information on the regex property, see Payment Methods Subtab.

Step 1: Create a JSON modification file

  1. If you have not done so already, create a directory to store your custom module.

    Following best practices, name this directory extensions and place it in your Modules directory. Depending on your implementation and customizations, this directory might already exist.

  2. Open your extensions directory and create a custom module to maintain your configuration modifications.

    Give this directory a unique name that is similar to the module being customized. For example:

    Modules/extensions/Configuration.Modification@1.0.0/

  3. In your new Configuration.Modification@1.0.0 module, create a subdirectory called Configuration.

  4. In your Configuration subdirectory, create a JSON file.

    Give this file a unique name that is similar to the file being modified. For example:

    Modules/extensions/Configuration.Modification@1.0.0/Configuration/PaymentMethodsModification.json

  5. Open this file and create a modifications array, declaring the target property to be replaced, the action to occur, and new value.

    In this case, you declare the Master Card by key and provide the new regex value. Your file should match the following code snippet:

                    {
        "type": "object",
    
        "modifications" : [
            {
                "target": "$.properties.paymentmethods.default[?(@.key == '4,5,1555641112')].regex",
                "action": "replace",
                "value":  "^(5[1-5][0-9]{14}|2(2(2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7([0-1][0-9]|20))[0-9]{12})$"
            }
        ]
    } 
    
                  
    Note:

    For more information on creating a modification, see Modify JSON Configuration Files.

  6. Save the file.

Step 2: Prepare the Developer Tools for Your Customizations

  1. Open the Configuration.Modification@1.0.0 module.

  2. Create a file in this module and name it ns.package.json.

    Modules/extensions/Configuration.Modification@1.0.0/ns.package.json

  3. Build the ns.package.json file using the following code

                    {
        "gulp": {
            "configuration": [
                "Configuration/*.json"
            ]
        }
    } 
    
                  
  4. Save the ns.package.json file.

  5. Open the distro.json file.

    This file is located in the top-level directory of your SuiteCommerce Advanced source code.

  6. Add your custom module to the modules object to ensure that the Gulp tasks include your modification when you deploy.

    Your code should look similar to the following example:

                    {
        "name": "SuiteCommerce Advanced Vinson Release",
        "version": "2.0",
        "buildToolsVersion": "1.2.1",
        "folders": {
            "modules": "Modules",
            "suitecommerceModules": "Modules/suitecommerce",
            "thirdPartyModules": "Modules/third_parties",
            "distribution": "LocalDistribution",
            "deploy": "DeployDistribution"
        },
        "modules": {
            "extensions/Configuration.Modification": "1.0.0",
            "suitecommerce/Account": "2.2.0",
                      //... 
    
                  
  7. Save the distro.json file.

Step 3: Test and Deploy Your Extension

  1. In your top-level directory for your Vinson source code, run the following command:

    gulp configuration

  2. Navigate to your LocalDistribution directory.

  3. Open the configurationManifest.json file.

    Your file should reflect the following changes:

                    [
        {
            "type": "object",
            "modifications": [
                {
                    "target": "$.properties.paymentmethods.default[?(@.key == '4,5,1555641112')].regex",
                    "action": "replace",
                    "value": "^(5[1-5][0-9]{14}|2(2(2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7([0-1][0-9]|20))[0-9]{12})$"
                }
            ]
        },
    
    //...
    
                    },
                    "default": [
                        {
                            "key": "5,5,1555641112",
                            "regex": "^4[0-9]{12}(?:[0-9]{3})?$",
                            "description": "VISA"
                        },
                        {
                            "key": "4,5,1555641112",
                            "regex": "^(5[1-5][0-9]{14}|2(2(2[1-9]|[3-9][0-9])|[3-6][0-9][0-9]|7([0-1][0-9]|20))[0-9]{12})$",
                            "description": "Master Card"
                        },
    //... 
    
                  

    After confirming the results locally, you can deploy your changes to your NetSuite account. See Deploy SCA Customizations to NetSuite for details.

    Important:

    Saved SuiteCommerce Configuration records take precedence over the configurationManifest.json file. Therefore, if you have saved any changes to the SuiteCommerce Configuration record for a domain prior to deploying JSON modifications, your deployed modifications do not appear in the UI or on the website for that domain. The values in your saved record take precedence. To make this change take effect in a previously saved record, configure the record for the applicable domain directly.

Related Topics

Mastercard 2-Series BIN Regex Patch
Denali – Mastercard Regex Patch
Mont Blanc – Mastercard Regex Patch

General Notices