# qpay-peak-flutter

## Environment Switching (Test vs Live)

Environment selection is command-driven with `--dart-define=APP_ENV=...`.

- `APP_ENV=test` loads `assets/.env.test`
- `APP_ENV=live` loads `assets/.env.live`
- If `APP_ENV` is not provided, default is `test`

For web, Mastercard Checkout is loaded dynamically from `GATEWAY_SCRIPT_URL` in the active env file, so `web/index.html` no longer needs manual test/live script edits.

### Env files

Set environment-specific values in:

- `assets/.env.test`
- `assets/.env.live`

Supported keys:

- `BASE_URL`
- `CLIENTID`
- `SIMULATE_PAYMENT_SUCCESS`
- `GATEWAY_SCRIPT_URL`

### Run in Test

```bash
flutter run --dart-define=APP_ENV=test
```

### Run in Live

```bash
flutter run --dart-define=APP_ENV=live
```

### Build in Live

```bash
flutter build web --dart-define=APP_ENV=live
flutter build apk --dart-define=APP_ENV=live
```

### Quick pre-release checks

- Confirm `assets/.env.live` points to the live API (`BASE_URL`).
- Confirm `assets/.env.live` has `SIMULATE_PAYMENT_SUCCESS=false`.
- Confirm `assets/.env.live` uses live gateway script URL in `GATEWAY_SCRIPT_URL`.
