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

## Sandbox Testing {#sandbox-testing}

The Sandbox server returns simulated responses, enabling you to try the Disbursement API 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.

##### POST - Create Disbursement {#post---create-disbursement}

|                  Test Scenario                  |                                                     Test Data                                                      | HTTP Status Code/Reason Code |                                         Expected Result                                         |
|-------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|------------------------------|-------------------------------------------------------------------------------------------------|
| Always disbursement approval                    | Valid request with `disbursement_reference` value HAPPYPATH_DISB_000001                                            | 201/CREATED                  | Approved                                                                                        |
| Disbursement approval                           | Valid request with unique valid `disbursement_reference` value that does not match one of the test scenarios below | 201/CREATED                  | Approved                                                                                        |
| Decline - 402 response                          | `disbursement_reference` starts with DEC05                                                                         | 402/DECLINE                  | Card declined                                                                                   |
| Unknown - 202 response                          | `disbursement_reference` starts with UNKNWN                                                                        | 202/ACCEPTED                 | Status unknown                                                                                  |
| Decline - duplicate disbursement reference      | In same day, send request with same `disbursement_reference` as a previous request but different `amount`          | 409/RESOURCE_ERROR           | Error: `disbursement_reference`, duplicate value (110501)                                       |
| Country not supported for the partner           | `disbursement_reference` starts with PCNS                                                                          | 402/RESOURCE_ERROR           | Error: Country not supported for merchant (110516)                                              |
| Sending account not eligible                    | `disbursement_reference` starts with PINES                                                                         | 400/RESOURCE_ERROR           | Error: `sender_account_uri`, account not eligible (110503)                                      |
| Receiving account not eligible                  | `disbursement_reference` starts with PINER                                                                         | 400/RESOURCE_ERROR           | Error: `recipient_account_uri`, account not eligible (110503)                                   |
| Invalid value                                   | `payment_type` = ABC                                                                                               | 400/INVALID_INPUT_VALUE      | Error: Invalid value (082000)                                                                   |
| Invalid field length                            | `disbursement_reference` = 123                                                                                     | 400/INVALID_INPUT_LENGTH     | Error: Invalid length (072000)                                                                  |
| Missing required field                          | Omit a required parameter, such as `disbursement_reference`                                                        | 400/MISSING_REQUIRED_INPUT   | Error: Value is required (092000)                                                               |
| Transaction limit error                         | `disbursement_reference` starts with TNLMT                                                                         | 400/DECLINE                  | Error: `amount`, transaction limit is less than the minimum configured for the partner (130006) |
| Partner daily limit exceeded                    | `disbursement_reference` starts with PDLMTX                                                                        | 400/DECLINE                  | Error: `amount`, partner has exceeded the daily limit configured in the system (130005)         |
| Partner not active                              | `disbursement_reference` starts with PINA                                                                          | 401/INVALID_INPUT_VALUE      | Error: `partnerId`, invalid value (082000)                                                      |
| Partner not onboarded                           | `disbursement_reference` starts with PUNK                                                                          | 401/INVALID_INPUT_VALUE      | Error: `partnerId`, invalid value (072000)                                                      |
| Client user not associated with partner         | `disbursement_reference` starts with PCLNT                                                                         | 401/AUTHORIZATION_FAILED     | Error: `OpenAPIClientId`, unauthorized access (050007)                                          |
| Partner's processing is suspended in the system | `disbursement_reference` starts with PSPND                                                                         | 403/AUTHORIZATION_FAILED     | Error: `partnerId`, transaction processing suspended (050005)                                   |
| Application system error                        | `disbursement_reference` starts with SE500                                                                         | 500/SYSTEM_ERROR             | Error: Internal exception occurred                                                              |

##### GET - Retrieve by Disbursement ID {#get---retrieve-by-disbursement-id}

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

##### GET - Retrieve by Disbursement Reference {#get---retrieve-by-disbursement-reference}

|                   Test Scenario                   |                                                      Test Data                                                      | HTTP Status Code/Reason Code |                     Reason Description                     |
|---------------------------------------------------|---------------------------------------------------------------------------------------------------------------------|------------------------------|------------------------------------------------------------|
| Retrieve details of previous disbursement request | `ref` query value matches the `disbursement_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: `disbursement_reference`, 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.

For test card numbers that you can use for testing the Disbursement API 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.
