# Testing
source: https://developer.mastercard.com/india-online-dispute-resolution/documentation/testing/index.md

This section provides comprehensive guidance for testing your India Online Dispute Resolution (IODR) API integration in the Sandbox environment. The Sandbox allows you to simulate complaint and transaction workflows, validate encryption, and verify error handling without impacting production data.
Note: Start all validation in Sandbox before moving to Production. Note: In Sandbox, transaction data is served by a [Mock Data Warehouse (DWH)](https://developer.mastercard.com/india-online-dispute-resolution/documentation/mock-data-warehouse/index.md) that returns randomized success and failure responses. `POST /transactions/details` initially returns `PENDING`, so poll `GET /transactions/status` for the final outcome. Note: **Encryption applies to all endpoints:** Every IODR request and response payload is encrypted with JWE. Encrypt each request body before sending it and decrypt each response, regardless of which endpoint you are testing. See [API Basics](https://developer.mastercard.com/india-online-dispute-resolution/documentation/api-basics/index.md#transport-encryption) for encryption setup.

### Choose a testing method {#choose-a-testing-method}

Choose a testing method that best matches how you want to validate requests:

* [Insomnia Collection](https://developer.mastercard.com/india-online-dispute-resolution/documentation/developer-tools/insomnia/index.md) --- an alternative API client with a ready-to-use workspace.
* [Reference Application](https://developer.mastercard.com/india-online-dispute-resolution/documentation/developer-tools/reff_application/index.md) --- a working implementation you can run and inspect.
* Custom API client generated as per guidance in [API Basics](https://developer.mastercard.com/india-online-dispute-resolution/documentation/api-basics/index.md). To build a Java client with a Maven project, follow the [Customer Onboarding Guide](https://developer.mastercard.com/india-online-dispute-resolution/documentation/onboarding-guide/index.md).

### Recommended testing workflow {#recommended-testing-workflow}

1. **Create complaint** : Call `POST /complaints` to create a complaint and capture `trackingNumber`.
2. **Get transaction details** : Call `POST /transactions/details` using the transaction details and `trackingNumber`.
3. **Get transaction status** : If the response status is PENDING, call `GET /transactions/status`.
4. **Update user complaint** : Call `PUT /complaints` to update the complaint.
5. **Search complaints** : Call `POST /complaints/searches` to verify complaint retrieval.

### Alternate path {#alternate-path}

* Call `POST /complaints/searches` with searchType=DEFAULT to retrieve all complaints.
* Call `GET /transactions/status` only when `/transactions/details` returns PENDING.
* Send invalid inputs across APIs to validate error scenarios.

## Positive Testing {#positive-testing}

Positive testing confirms that valid requests succeed and return the expected data.

### Positive test cases {#positive-test-cases}

Use the tabs to view representative positive test cases for each endpoint family.
* **Create complaint:** Verify POST /complaints with valid request payload
* **Expected result:** HTTP 200 with `trackingNumber` and success description.

**Request :**

```json
{
  "complaintType": "ATM",
  "transactionDate": "2023-03-21",
  "transactionTime": "10:00:00",
  "cardNumber": "545422003332",
  "transactionAmount": "9999.98"
}
```

**Response:**

```json
{
  "trackingNumber": "VJKMX289IVAM",
  "description": "Complaint created successfully."
}
```

* **Get transaction details:** Verify POST /transactions/details with valid request payload
* **Expected result:** HTTP 200 and status are `PENDING` or `COMPLETED`.

**Request:**

```json
{
  "retrievalReferenceNumber": "435465768998",
  "banknetReferenceNumber": "234354657",
  "approvalCode": "A1B5D6",
  "acquirerICA": "00000010160",
  "trackingNumber": "VJKMX289IVAM"
}
```

**Response:**

```json
{
  "status": "COMPLETED",
  "description": "Transaction status validation is completed",
  "transactionStatus": "Only Authorization found.",
  "banknetReferenceNumber": "234354657",
  "acquirerName": "OBI Bank Ltd"
}
```

**Precondition:** Call this API only when `/transactions/details` returns `status=PENDING`.

* **Get transaction status:** Verify GET /transactions/status with valid tracking number
* **Expected result:** HTTP 200 with latest transaction status.

**Request:**

    GET /transactions/status?tracking_number=WFU49NUWHEYC

**Response:**

```json
{
  "status": "COMPLETED",
  "description": "Transaction status validation is completed",
  "transactionStatus": "Only Authorization found.",
  "banknetReferenceNumber": "234354657",
  "acquirerName": "OBI Bank Ltd"
}
```

* **Update user complaint:** Verify PUT /complaints with valid request payload
* **Expected result:** HTTP 200 with `trackingNumber` and success description.

**Request:**

```json
{
  "trackingNumber": "VJKMX289IVAM",
  "comments": "Complaint status updated",
  "complaintStatus": "RESOLVED"
}
```

**Response:**

```json
{
  "trackingNumber": "VJKMX289IVAM",
  "description": "Complaint updated successfully."
}
```

Note: When `searchType=DEFAULT`, API retrieves all complaints associated with issuer or acquirer.

* **Search complaints:** Verify POST /complaints/searches with valid `searchType=DEFAULT`
* **Expected result:** HTTP 200 with complaints list and pagination fields.

**Request:**

```json
{
  "searchType": "DEFAULT"
}
```

**Response:**

```json
{
  "complaints": [
    {
      "trackingNumber": "VJKMX289IVAM",
      "complaintType": "POS",
      "cardType": "CREDIT_CARD",
      "transactionDate": "2023-04-28 00:00:00",
      "cardNumber": "545422003332",
      "transactionAmount": "9999.98",
      "banknetReferenceNumber": "234354657",
      "approvalCode": "A1B5D6",
      "acquirerICA": "00000010160",
      "disputeChannel": "API"
    }
  ],
  "pageCount": 10,
  "pageNumber": 1
}
```

## Negative Testing {#negative-testing}

Negative testing confirms that invalid requests fail cleanly and return useful error details.
Note: For the full list of error codes, reason codes, and resolution tips referenced in these test cases, see [Code and Formats](https://developer.mastercard.com/india-online-dispute-resolution/documentation/code-and-formats/index.md).

### Negative test cases {#negative-test-cases}

Use the tabs to view representative negative test cases for each endpoint family.
* **Create complaint:** Verify POST /complaints with invalid/missing required data
* **Expected result:** HTTP 400 with `reasonCode` and description.

**Negative scenarios covered:**

* Invalid card number (length not 12)
* Future transaction date
* Transaction date older than 90 days

**Request:**

```json
{
  "complaintType": "ATM",
  "transactionDate": "2023-03-21",
  "cardNumber": "123",
  "transactionAmount": "9999.98"
}
```

**Response:**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "cardnumber",
        "Description": "Invalid input field cardnumber provided in request.",
        "Recoverable": true
      }
    ]
  }
}
```

*** ** * ** ***

* **Get transaction details:** Verify POST /transactions/details with invalid/missing required data
* **Expected result:** HTTP 400/404 with validation error or record not found.

**Negative scenarios covered:**

* Invalid approval code (length not 6)
* Invalid banknet reference number (length not 9)
* Invalid acquirer ICA (length not 11)
* Invalid JWE payload (decryption failure)

**Response:**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "approvalCode",
        "Description": "Invalid input field approvalCode provided in request.",
        "Recoverable": true
      }
    ]
  }
}
```

* **Get transaction status:** Verify GET /transactions/status with invalid tracking number
* **Expected result:** HTTP 400 with a validation error, or HTTP 404 when the record is not found.

**Negative scenarios covered:**

* Invalid tracking number, length not 12 (`400`)
* Record not found (`404`, `ODR018`)

**Response (404 --- record not found):**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "ODR018",
        "Description": "Record not found.",
        "Recoverable": false
      }
    ]
  }
}
```

**Response (400 --- invalid tracking number):**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "trackingNumber",
        "Description": "Invalid tracking number provided in request.",
        "Recoverable": false
      }
    ]
  }
}
```

* **Update user complaint:** Verify PUT /complaints with invalid/missing required data
* **Expected result:** HTTP 400/404 with `reasonCode` and description.

**Negative scenarios covered:**

* Invalid tracking number
* Invalid comments (empty or too long)
* Invalid complaint status
* Record not found

**Request:**

```json
{
  "trackingNumber": "INVALID123",
  "comments": "Invalid update",
  "complaintStatus": "RESOLVED"
}
```

**Response:**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "trackingNumber",
        "Description": "Invalid input field tracking number provided in request.",
        "Recoverable": false
      }
    ]
  }
}
```

* **Search complaints:** Verify POST /complaints/searches with invalid search criteria
* **Expected result:** HTTP 400 with validation errors for invalid fields.

**Negative scenarios covered:**

* Invalid searchType
* Invalid searchValue for a given searchType
* Invalid fromDate/toDate format
* Invalid pageNumber (must be between 1 and 99)
* Invalid JWE payload (decryption failure)

**Response:**

```json
{
  "Errors": {
    "Error": [
      {
        "Source": "INDIA_ONLINE_DISPUTE_RESOLUTION",
        "ReasonCode": "searchType",
        "Description": "Invalid input field searchType provided in request.",
        "Recoverable": false
      }
    ]
  }
}
```

## Next Steps {#next-steps}

* Consult the [API Reference](https://developer.mastercard.com/india-online-dispute-resolution/documentation/api-reference/index.md) for complete endpoint specifications, request and response schemas, and environment URLs.
* Follow the [Customer Onboarding Guide](https://developer.mastercard.com/india-online-dispute-resolution/documentation/onboarding-guide/index.md) to set up a Java client for testing and to generate the `Request-Id` header required by each call.
* Review the [Mock Data Warehouse (DWH)](https://developer.mastercard.com/india-online-dispute-resolution/documentation/mock-data-warehouse/index.md) page to understand the randomized Sandbox success and failure behavior behind the transaction APIs.
* If you run into issues, visit [Support](https://developer.mastercard.com/india-online-dispute-resolution/documentation/support/index.md) for FAQs and troubleshooting guidance.
* To learn more about any error codes you receive, head over to our [Codes and Formats](https://developer.mastercard.com/india-online-dispute-resolution/documentation/code-and-formats/index.md) section to learn about the details of all the error codes.
