# Sandbox and Testing

## The Sandbox Environment

The CabFare Connect API is available for development and testing in a dedicated sandbox environment. This environment mimics the production broker behaviour but uses simulated data to provide defined results for STV compliance testing.

| Setting        | Value                                             |
| -------------- | ------------------------------------------------- |
| Base URL       | `https://dcp-sandbox.nbggroup.com.au/api/v0.5.0`  |
| Authentication | Requires a Sandbox `X-API-KEY` and `X-API-SECRET` |

To request your sandbox credentials contact [support@cabfare.com](mailto:support@cabfare.com).

## Testing Tools

To help you visualise the other side of your integration, CabFare provides web-based emulators:

**Taxi Meter Emulator**
Use this if you are an EFTPOS Terminal provider. Simulates trip starts, driver logins, and subsidy requests so you can test your terminal integration without a live Taxi Meter.

**Payment Terminal Emulator**
Use this if you are a Taxi Meter provider. Simulates card reads and transaction approvals so you can test your meter integration without a live EFTPOS Terminal.

## Sandbox Test Data

Use the following datasets to trigger specific logic paths in the sandbox. Using data outside of these lists will result in validation errors or `Record Not Found` responses.

### Driver Validation

Testing the `POST /meter/driver/login` endpoint:

| Driver DC Number                       | Status   | Expected Result                                     |
| -------------------------------------- | -------- | --------------------------------------------------- |
| `999998`, `999997`, `999996`, `999995` | Valid    | Successful login; authorised for MPTP trips         |
| `112233`, `112234`                     | Expired  | Login succeeds but MPTP functionality is disabled   |
| `998877`, `998878`                     | Disabled | Returns `403 Forbidden` or "Member Disabled" status |

### Vehicle Profiles

Testing the `POST /terminal/link/request` and session anchors:

| Vehicle Plate                                        | Type     | Use Case                                                  |
| ---------------------------------------------------- | -------- | --------------------------------------------------------- |
| `M1000`, `M2000`, `M3000`, `M4000`, `U1000`, `C1000` | Standard | Standard sedan for regular passenger trips                |
| `M5000`, `C5000`                                     | WATS     | Wheelchair Accessible. Required for lifting fee subsidies |
| `VHA100`, `VHA200`                                   | Invalid  | Use to test "Vehicle Not Found" error handling            |

### MPTP Member Scenarios

Testing the `POST /terminal/mptp/validate` and `POST /meter/mptp/validate` endpoints:

| Member Number                         | Type       | Expected Behaviour                                     |
| ------------------------------------- | ---------- | ------------------------------------------------------ |
| `099999901`                           | Standard   | Returns `isEligible: true`                             |
| `112345601`, `112345701`, `112345801` | Wheelchair | Validates for wheelchair-specific subsidy rates        |
| `022334401`                           | Expired    | Returns `isEligible: false` (Reason: Expired)          |
| `044556601`                           | No Funds   | Returns `isEligible: false` (Reason: Balance Depleted) |

## Implementation Tips

**Resetting state**
The sandbox tracks active trips. If you receive a `409 Conflict` response, ensure you have sent `POST /meter/job/done` for your previous `tripId` to clear the vehicle session before starting a new trip.

**Currency format**
All fare amounts must be submitted in cents as integers. A fare of $10.00 must be submitted as `1000`.

**Connectivity test**
Use the ping endpoint to verify connectivity to the sandbox before beginning your integration:

```bash
curl -i https://dcp-sandbox.nbggroup.com.au/api/v0.5.0/ping
```

Expect a `200 OK` response with body `{"response": "Pong"}`.

---
Source: https://docs.cabfare.com/api/sandbox-and-testing
