# Testing
source: https://developer.mastercard.com/account-validation/documentation/testing/index.md

## Sandbox Testing {#sandbox-testing}

The Sandbox server returns simulated responses, enabling you to try this API quickly, and should not be used for full integration testing.

Use the following test scenarios to produce specific responses. Unless instructed otherwise, ensure your POST call includes the required fields with valid values.

For valid test card numbers that you can use in your requests, see [Sandbox Test Cards](https://developer.mastercard.com/mastercard-send/documentation/implementation/sandbox-test-cards/). Do not use real consumer card numbers in the Sandbox environment.

### Successful responses {#successful-responses}

For these tests, use:

* Mastercard scenarios: `account.number` = starts with 5 or 2, such as 5102589999999913
* Visa scenarios: `account.number` = starts with 4, such as 4007589999999904

`expiry` can be '2050-10', and `cvc` can be '123'.

The expected `cvcValidationResults.status` and `nameValidationResults.status` values are shown below. All responses are HTTP status code 200.

|                          Test Scenario                          | `referenceId` Starts With | Provide `account.cvc`? | Expected CVC/CVV Status | Expected Name Status |
|-----------------------------------------------------------------|---------------------------|------------------------|-------------------------|----------------------|
| **Mastercard**                                                  |                           |                        |                         |                      |
| Name only partial matched                                       | AVPM                      | No                     | ---                     | PARTIAL_MATCHED      |
| CVC and name matched                                            | AVM                       | Yes                    | MATCHED                 | MATCHED              |
| CVC matched, name partial matched                               | AVPM                      | Yes                    | MATCHED                 | PARTIAL_MATCHED      |
| CVC matched, name not matched                                   | AVNM                      | Yes                    | MATCHED                 | NOT_MATCHED          |
| CVC matched, name not verified                                  | AVNV                      | Yes                    | MATCHED                 | NOT_VERIFIED         |
| CVC and name not matched                                        | AVNOM                     | Yes                    | NOT_MATCHED             | NOT_MATCHED          |
| CVC not verified, name partial matched                          | AVCNV                     | Yes                    | NOT_VERIFIED            | PARTIAL_MATCHED      |
| Issuer declines validation request (`networkResponseCode` = 05) | DEC05                     | No                     | ---                     | NOT_VERIFIED         |
| **Visa**                                                        |                           |                        |                         |                      |
| Name only matched                                               | AVNM                      | No                     | ---                     | MATCHED              |
| CVV and name matched                                            | AVNM                      | Yes                    | MATCHED                 | MATCHED              |
| CVV matched, name partial matched (first and middle name)       | AVPFM                     | Yes                    | MATCHED                 | PARTIAL_MATCHED      |
| CVV matched, name partial matched (middle and last name)        | AVCVM                     | Yes                    | MATCHED                 | PARTIAL_MATCHED      |
| CVV not matched, name partial matched (last name)               | AVCNM                     | Yes                    | NOT_MATCHED             | PARTIAL_MATCHED      |
| CVV and name not matched                                        | AVNOM                     | Yes                    | NOT_MATCHED             | NOT_MATCHED          |
| CVV and name not verified (code S)                              | AVCSV                     | Yes                    | NOT_VERIFIED            | NOT_VERIFIED         |
| CVV and name not verified (code U)                              | AVINV                     | Yes                    | NOT_VERIFIED            | NOT_VERIFIED         |

<br />

### Error responses {#error-responses}

|                                                       Test Scenario                                                       |                                 Test Data                                 | HTTP Status Code/Reason Code |                                           Expected Result                                            |
|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|------------------------------|------------------------------------------------------------------------------------------------------|
| Missing required field                                                                                                    | Omit a required parameter, such as `referenceId`                          | 400/MISSING_REQUIRED_INPUT   | Error: Value is required                                                                             |
| Invalid field length                                                                                                      | `account.number` = 1234                                                   | 400/INVALID_INPUT_LENGTH     | Error: Invalid length                                                                                |
| Invalid field value                                                                                                       | `currency` = ABC                                                          | 400/INVALID_INPUT_VALUE      | Error: Invalid value                                                                                 |
| Request with both `originatingInstitutionPartnerId` and `acquiringCredentials`                                            | Provide both `originatingInstitutionPartnerId` and `acquiringCredentials` | 400/INVALID_INPUT_VALUE      | Error: Either acquiringCredentials or originatingInstitutionPartnerID should be present and not both |
| No Originating Institution (OI) Partner ID and no acquiring credentials provided but partner associated with multiple OIs | `referenceId` starts with AVMULOI                                         | 400/INVALID_INPUT_VALUE      | Error: Multiple Originating Institution Partner Ids found                                            |
| Too many acquiring credentials                                                                                            | Provide both `singleMessage` and `dualMessage` objects                    | 400/INVALID_INPUT_VALUE      | Error: Only Single or Dual Message is allowed                                                        |
| Partner not onboarded for a particular network (Mastercard or Visa)                                                       | `referenceId` starts with NTONB                                           | 400/RESOURCE_ERROR           | Error: Account is not eligible for the transaction                                                   |
| Account not eligible                                                                                                      | `referenceId` starts with ANELG                                           | 400/RESOURCE_ERROR           | Error: Account not eligible                                                                          |
| No Transfer Acceptor ID (TAID) provided but there are multiple TAs for partner                                            | `referenceId` starts with NTAID                                           | 400/RESOURCE_ERROR           | Error: Multiple transfer acceptors found                                                             |
| Invalid Originating Institution Partner ID and no acquiring credentials provided                                          | `originatingInstitutionPartnerId` starts with AVOIN                       | 400/RESOURCE_ERROR           | Error: Partner not eligible for the transaction                                                      |
| Country not eligible                                                                                                      | `referenceId` starts with CNELG                                           | 400/RESOURCE_ERROR           | Error: Partner not eligible for the transaction                                                      |
| Point of Service Interaction doesn't match the onboarded configuration                                                    | `referenceId` starts with POINM                                           | 400/RESOURCE_ERROR           | Error: Partner not eligible for the transaction                                                      |
| Partner not active                                                                                                        | `referenceId` starts with AVNA                                            | 400/RESOURCE_ERROR           | Error: Partner not eligible for the transaction                                                      |
| Partner not onboarded                                                                                                     | `referenceId` starts with AVNB                                            | 401/UNAUTHORIZED_ACCESS      | Error: Unauthorized Access                                                                           |
| Client user not associated with partner                                                                                   | `referenceId` starts with ACLNT                                           | 401/UNAUTHORIZED_ACCESS      | Error: Unauthorized Access                                                                           |
| Application system error                                                                                                  | `referenceId` starts with SE500                                           | 500/SYSTEM_ERROR             | Error: Internal exception occurred                                                                   |

## MTF Testing {#mtf-testing}

The Mastercard Customer Implementation Services (CIS) team, assigned during implementation, can provide test cases and assist with testing.

For test card numbers that you can use for testing in the MTF environment, see [MTF Test Cards](https://developer.mastercard.com/mastercard-send/documentation/implementation/test-cards/). Do not use real consumer card numbers in the MTF environment.
