# Testing
source: https://developer.mastercard.com/mastercard-send-funding/documentation/testing/index.md

## Sandbox Testing {#sandbox-testing}

The Sandbox server returns simulated responses, enabling you to try the APIs quickly, and should not be used for full integration testing. 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/).

### Test Scenarios {#test-scenarios}

Use the following test scenarios to produce specific responses. As long as the request message is properly formatted, a valid response will be returned.

##### Funding POST - Create Funding Transfer {#funding-post---create-funding-transfer}

|              Test Scenario              |                                                   Test Data                                                    | HTTP Status Code/Reason Code |                                  Expected Result                                   |
|-----------------------------------------|----------------------------------------------------------------------------------------------------------------|------------------------------|------------------------------------------------------------------------------------|
| Always transfer approval                | Valid request with `transfer_reference` value HAPPYPATH_FRV_000001                                             | 201/CREATED                  | Approved                                                                           |
| Transfer approval                       | Valid request with unique valid `transfer_reference` value that does not match one of the test scenarios below | 201/CREATED                  | Approved                                                                           |
| Decline - 402 response                  | `transfer_reference` starts with DCL05                                                                         | 402/DECLINE                  | Card declined                                                                      |
| Unknown - 202 response                  | `transfer_reference` starts with UNKNWN                                                                        | 202/ACCEPTED                 | Status unknown                                                                     |
| Decline - duplicate transfer reference  | In same day, send request with same `transfer_reference` as a previous request                                 | 409/RESOURCE_ERROR           | Error: `transfer_reference`, duplicate value (110501)                              |
| Country not eligible                    | `transfer_reference` starts with CNELG                                                                         | 400/INVALID_INPUT_VALUE      | Error: `payment_origination_country`, invalid value (082000)                       |
| Sending account not eligible            | `transfer_reference` starts with NTELG                                                                         | 400/RESOURCE_ERROR           | Error: `sender_account_uri`, account not eligible (110503)                         |
| Payment type not eligible               | `transfer_reference` starts with PMTTYP                                                                        | 400/RESOURCE_ERROR           | Error: `payment_type`, account not eligible (110503)                               |
| Card type not supported                 | `transfer_reference` starts with CDELG                                                                         | 400/RESOURCE_ERROR           | Error: `Account Error`, card type is not supported for merchant (110504)           |
| Card Acceptor ID not allowed            | `transfer_reference` starts with CANA                                                                          | 400/RESOURCE_ERROR           | Error: `participant.card_acceptor_id`, Card Acceptor ID not allowed (110520)       |
| Invalid value                           | `payment_type` = ABC                                                                                           | 400/INVALID_INPUT_VALUE      | Error: Invalid value (082000)                                                      |
| Invalid field length                    | `transfer_reference` = 123                                                                                     | 400/INVALID_INPUT_LENGTH     | Error: Invalid length (072000)                                                     |
| Invalid field format                    | `sender_account_uri` = ABC                                                                                     | 400/INVALID_INPUT_FORMAT     | Error: Value contains invalid character(s) (062000)                                |
| Missing required field                  | Omit a required parameter, such as `transfer_reference`                                                        | 400/MISSING_REQUIRED_INPUT   | Error: Value is required (092000)                                                  |
| Missing required field for Visa AFT     | `transfer_reference` starts with FUNVS and `funding_source` field is missing                                   | 400/MISSING_REQUIRED_INPUT   | Error: Value is required (092000)                                                  |
| Transaction limit error                 | `transfer_reference` starts with TNLMT                                                                         | 400/DECLINE                  | Error: `sender_account_uri`, per transaction maximum amount limit reached (130004) |
| Partner not active                      | `transfer_reference` starts with PINA                                                                          | 401/INVALID_INPUT_VALUE      | Error: `partnerId`, invalid value (082000)                                         |
| Partner not onboarded                   | `transfer_reference` starts with PUNK                                                                          | 401/INVALID_INPUT_VALUE      | Error: `partnerId`, invalid value (072000)                                         |
| Client user not associated with partner | `transfer_reference` starts with PCLNT                                                                         | 401/UNAUTHORIZED_ACCESS      | Error: `OpenAPIClientId`, unauthorized access (050007)                             |
| Application system error                | `transfer_reference` starts with SE500                                                                         | 500/SYSTEM_ERROR             | Error: Internal exception occurred                                                 |

##### Funding GET - Retrieve by Transfer ID {#funding-get---retrieve-by-transfer-id}

|                 Test Scenario                 |                                              Test Data                                              | HTTP Status Code/Reason Code |                 Expected Result                 |
|-----------------------------------------------|-----------------------------------------------------------------------------------------------------|------------------------------|-------------------------------------------------|
| Retrieve details of previous transfer request | `transferId` path value matches the `id` returned in a previous successful POST API call to Sandbox | 200/OK                       | Successful                                      |
| Unsuccessful GET call                         | `transferId` path value not used before                                                             | 404/RESOURCE_ERROR           | Error: `transfer_id`, record not found (110507) |

##### Funding GET - Retrieve by Transfer Reference {#funding-get---retrieve-by-transfer-reference}

|                 Test Scenario                 |                                                    Test Data                                                    | HTTP Status Code/Reason Code |                    Expected Result                     |
|-----------------------------------------------|-----------------------------------------------------------------------------------------------------------------|------------------------------|--------------------------------------------------------|
| Retrieve details of previous transfer request | `ref` query value matches the `transfer_reference` value used in a previous successful POST API call to Sandbox | 200/OK                       | Successful                                             |
| Unsuccessful GET call                         | `ref` query value not used before                                                                               | 404/RESOURCE_ERROR           | Error: `transfer_reference`, record not found (110507) |

##### Funding Reversal POST - Reverse Funding Transfer {#funding-reversal-post---reverse-funding-transfer}

|                                                  Test Scenario                                                   |                                                                                                                      Test Data                                                                                                                       | HTTP Status Code/Reason Code |                     Expected Result                     |
|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------|---------------------------------------------------------|
| Reverse previously approved funding transfer within 30 minutes                                                   | `transferId` and `transactionId` path values match the `id` and `transaction_history.data.transaction[].id` (respectively) returned in a previous approved Funding POST API call to Sandbox                                                          | 200/OK                       | Successful                                              |
| Unsuccessful - attempt to reverse funding transfer that has already been reversed or outside 30-minute timeframe | Use same values as previous test scenario, except if they relate to a funding transfer with the test `transfer_reference` value HAPPYPATH_FRV_000001. Continually reversing that test transfer will always result in a successful reversal response. | 403/RESOURCE_ERROR           | Error: `transaction.id`, operation not allowed (110511) |
| Unsuccessful - funding transfer not found                                                                        | `transferId` and `transactionId` path values not used before                                                                                                                                                                                         | 404/RESOURCE_UNKNOWN         | Error: `transfer_id`, record not found (110507)         |

## MTF Testing {#mtf-testing}

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

### Test Card Numbers and Associated Networks {#test-card-numbers-and-associated-networks}

For test debit 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 consumer card numbers in the test environment. Transactions in the MTF environment are not executed against other networks.

### Simulated Scenarios {#simulated-scenarios}

The MTF environment simulates transaction responses based on the `amount` value passed in the API request. Any card number may be used as long as it passes the basic card number validation.

|                       Amount                       |                                  Simulated Response                                  |
|----------------------------------------------------|--------------------------------------------------------------------------------------|
| Any other amount except the following listed below | Approved Transaction                                                                 |
| 1                                                  | Declined Transaction                                                                 |
| 2                                                  | Error returned during transaction processing                                         |
| 3                                                  | Service will be delayed 30 seconds before returning an approved transaction response |
| 4                                                  | Time out during processing                                                           |
| 5                                                  | Error returned during deposit funds processing                                       |

### Card Numbers for Different Funds Availability Options {#card-numbers-for-different-funds-availability-options}

|                        Card Number                         |    Funds availability     |
|------------------------------------------------------------|---------------------------|
| 5000333641352301                                           | Next Business Day         |
| 5000361001156749                                           | Two to Five Business Days |
| Any other card number (published on Mastercard Developers) | Immediate                 |

