# Testing
source: https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/testing/index.md

## Testing {#testing}

The **Sandbox** environment utilizes the certificates generated during project creation to ensure secure connections. The following test data along with the generated certificates can be used with the [Ref App](https://developer.mastercard.com/benefit-allocation-service-mtls/documentation/reference-app/index.md) to test the API.

### Assign Segment to a card {#assign-segment-to-a-card}

```json
{
  "cardNumber": 5291070000000000,
  "segments": [
    {
      "code": "DART",
      "effectiveDate": "YYYY-MM-DD"
    }
  ]
}
```

Customer sends a request with the above parameters as input to Assign Benefits to a card then the Benefit Allocation Service API returns an array of benefit bundles that are assigned to the card

### Replace Segment on a card {#replace-segment-on-a-card}

```json
{
  "cardNumber": 5291070000000000,
  "oldSegmentCode": "DART",
  "newSegmentCode": "PRT",
  "effectiveDate": "YYYY-MM-DD"
}
```

Customer sends a request with the above parameters as input then the Benefit Allocation Service API Replaces the existing benefits associated to the card with the new set of benefits that are on the newSegmentCode. The existing benefits are expired, and new benefits are assigned. The response is an array of benefit bundles that are newly assigned to the card.

### Cancel Segment from a card {#cancel-segment-from-a-card}

```json
{
  "cardNumber": 5291070000000000,
  "segments": [
    {
      "code": "DART",
      "expiryDate": "YYYY-MM-DD"
    }
  ]
}
```

Customer sends a request with the above parameters as input then the Benefit Allocation Service API Cancels the benefits associated to the card for the input segment. The response is an array of benefit bundles that are cancelled on the card.

### Card Replacement for a cardholder {#card-replacement-for-a-cardholder}

```json
{
  "oldCardNumber": 5291070000000000,
  "newCardNumber": 5291070000000898,
  "effectiveDate": "YYYY-MM-DD"
}
```

Customer sends a request with the above parameters as input then the Benefit Allocation Service API replaces the card associated with the user. The benefits on the old Card are expired, and the same set of benefits are applied to new Card. The response is an array of bundles that are assigned to the existing card.

### Freeze or Unfreeze a card for a cardholder {#freeze-or-unfreeze-a-card-for-a-cardholder}

```json
{
  "cardNumber": 5291070000000000,
  "isFrozen": true/false
}
```

Customer sends a request with the above parameters as input then the Benefit Allocation Service API freezes the card if isFrozen (boolean) is set to true, Unfreezes the card if the isFrozen (boolean) is set to false.
