# Mobile Money / موبايل موني — CAC Bank

Method ID: `6`. Payment type: `4`. Source reviewed: 2026-10-24. This is an archived-code contract, not a live-provider certification. Examples are illustrative partial schemas; placeholder values are not credentials or captured transactions.

## URLs

Base selector: `ApiCacBankMobileMoneyUrl`.

Active source fallback: `https://mobilemoney.com.ye:6446/mmPay/v2/`.

Login and pay functions assign complete hard-coded URLs matching this base; the constant is not sufficient as an environment switch for those assignments.

Most legacy base constants are wrapped in `if (!defined(...))`; an earlier bootstrap definition can override the fallback. Hard-coded full-URL exceptions are called out above. Merchant JSON is not automatically a base-URL override.

| Operation | HTTP method | Full URL | Use |
| --- | --- | --- | --- |
| Merchant login | POST | `https://mobilemoney.com.ye:6446/mmPay/v2/api/v1/LogIn` | Authentication helper. |
| Pay voucher | POST | `https://mobilemoney.com.ye:6446/mmPay/v2/api/pay` | Payment operation used at confirmation. |


## Configuration fields

| Field / source setting | Meaning |
| --- | --- |
| AccountUserId | Merchant/agent/client identifier where used; stored in ElectronicPaymentAccountApiInfo. |
| AccountUserName | Merchant login/account name; not the customer phone unless the provider contract specifically uses it. |
| AccountUserPassword | Merchant password/short code; keep server-side. |
| AppId / AppBranchName | Merchant application and branch data passed by the caller. The checkout code supplies AppId=3; provision the proper branch. |
| Merchant.ID / BankID | Wire payload includes a literal merchant ID and BankID=1. The merchant identifier must be replaced through an explicit integration change if this merchant differs; it is not a documented editable AccountUserId mapping. |


Configuration location: merchant row `platform_payment_ways.ElectronicPaymentAccountApiInfo`, plus named server constants/transport files where stated. Common listing fields (`type`, titles, descriptions, icon, account_number, order_view, status, active) are documented in [00-common-contract.md](00-common-contract.md).

Authentication/transport: Login sends JSON clientID, username and password and Authorization: Basic base64(AccountUserName + ":" + AccountUserPassword). Payment requests send Authorization: {token_type} {access_token} from the stored login response.

## Customer and server inputs

| Field | Requirement | Meaning |
| --- | --- | --- |
| payment_account_id | Not collected by archived checkout | Flutter intentionally hides the phone field for method 6. |
| code | Required at confirmation | Purchase voucher, forwarded as PurchaseCode; this is not a phone number. |


## Payment flow

1. Authenticate the merchant during checkout. In the initial creation dispatcher GetSendOrderInfoRequest is explicitly FALSE, so the customer purchase is not executed at creation; status remains 2.
2. Flutter asks for the purchase voucher in its confirmation sheet.
3. Backend sends the entered voucher and merchant/order information to api/pay.
4. Require the provider success result and save PaymentReference; confirmed payment becomes status 3.

## Provider requests

### Login

```json
{
  "clientID": "<MERCHANT_CLIENT_ID>",
  "username": "<MERCHANT_USERNAME>",
  "password": "<MERCHANT_PASSWORD>"
}
```

### Voucher payment

```json
{
  "PurchaseCode": "<CUSTOMER_VOUCHER>",
  "BankID": 1,
  "RequestId": "<GENERATED_ORDER_REQUEST_ID>",
  "Merchant": {
    "ID": "<ARCHIVE_MERCHANT_ID_REQUIRES_PROVISIONING>",
    "AppId": 3,
    "BranchName": "<BRANCH_NAME>"
  },
  "OrderData": {
    "Date": "<ORDER_DATE>",
    "Ref": "<ORDER_REFERENCE>",
    "Title": "سداد مشتريات",
    "PeneficialyName": "<CUSTOMER_NAME>",
    "Amount": 1000
  }
}
```

The examples show fields used by the archived adapter. Additional transport headers, derived identifiers and conditional helper-operation fields must be read with the source evidence below. Secrets and calculated security values are supplied/generated server-side.

## Provider responses and success rules

### Login — consumed fields

```json
{
  "access_token": "<ACCESS_TOKEN>",
  "token_type": "<TOKEN_TYPE>",
  "expires_in": 3600
}
```

### Payment response — consumed fields

```json
{
  "ResultCode": 1,
  "ResultMessage": "<PROVIDER_MESSAGE>",
  "PaymentReference": "<PAYMENT_REFERENCE>"
}
```

- ResultCode must equal 1 for the payment wrapper to leave error=false. It stores PaymentReference and Message.
- The login parser is a separate response path; do not assume ResultCode=1 proves authentication or payment across both endpoints.

## Adapter result returned to the application layer

```json
{
  "error": false,
  "TimeOut": false,
  "Message": "<NORMALIZED_MESSAGE>",
  "Response": {
    "<provider-fields>": "<RAW_PROVIDER_RESPONSE>"
  }
}
```

This is a representative partial adapter result, not the public Flutter response. Keys are conditional and provider-specific. `error=true` or `TimeOut=true` prevents treating an initiation/confirmation as successful; transport errors can return before all keys exist. RequestType, saved references, token/cache metadata and provider-specific values may also be present. Raw merchant credentials/request logs must not be included in a customer-facing response.

## Application API requests and responses

The archived Flutter default for `APP_API_BASE` is **`https://platformdgtl.com/yemensnackfood/connect/v1/`**, set in Remote Config defaults. Fetched Remote Config can override it; this is a source default, not a verified live deployment. Trim the trailing slash when combining it with the paths below. Source: [lib/src/controllers/splash_controller.dart:234](</Users/ayman/Documents/Old Mac Data/flutter_projects/platform/yemen_snack_food/lib/src/controllers/splash_controller.dart:234>).

`APP_API_BASE` is supplied by Firebase Remote Config key `api_url` in the archived Flutter app. The resolved deployment value is not present in the reviewed source; use that runtime value rather than inventing a host. These paths belong to Yemen Snack Food, not Sharqiah v1 driver APIs.

Create: `POST {APP_API_BASE}/orders.php?action=add_order`, using multipart form data. The JSON below is a readable representation of those form fields; `items` is JSON-encoded text. The server calculates the amount.

```json
{
  "address_id": "<OWNED_ADDRESS_ID>",
  "delivery_time": "<DELIVERY_OPTION>",
  "items": "[{\"id\":1,\"quantity\":1}]",
  "payment_id": 6
}
```

Change method/details: `POST {APP_API_BASE}/orders.php?action=add_payment_info`, with `order_id`, `payment_id` and the relevant customer fields above. Changes are limited to early eligible orders and unconfirmed payment state; confirmation independently rejects ineligible/already-confirmed orders.

Confirm: `POST {APP_API_BASE}/orders.php?action=SendConfirmPayment` with form fields:

```json
{
  "order_id": "<ORDER_ID>",
  "code": "<CUSTOMER_VOUCHER>"
}
```

Illustrative **partial** create response (business success, not proof of settlement):

```json
{
  "status": 0,
  "message": "<APPLICATION_MESSAGE>",
  "result": {
    "order_id": 123,
    "order_payment_id": 6,
    "order_payment_type": 4,
    "order_payment_status": 2
  }
}
```

Expected confirmed order state: `order_payment_status=3`. The confirm endpoint may return a message without an order object; Flutter reloads the order.

Business failure shape, illustrative and partial:

```json
{
  "status": 1,
  "message": "<VALIDATION_OR_PROVIDER_ERROR_MESSAGE>"
}
```

See [the common contract](00-common-contract.md) for auth, status meanings, shared fields and response-layer differences.


## Persistence, cancellation and implementation limits

Payment initiation uses `platform_orders_temporary_storage` and electronic-payment temporary metadata. Later operations load saved transaction references from electronic-payment metadata. The archive also uses filesystem caches; these are implementation details, not proof of atomicity or idempotency.

- The archived request includes integration-specific merchant literals; a base URL and login alone are not a complete portable configuration.
- The adapter names operation-status/refund request types, but its payment URL is hard-coded to api/pay. Treat these as incomplete capabilities until their wire behavior is separately checked.

## Source evidence

- Login payload: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1297](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1297>)

- Payment URL: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2626](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2626>)

- Payment payload: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2735](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2735>)

- Payment response: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:3048](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:3048>)

- Login Basic header: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1507](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1507>)

- Login response: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1706](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1706>)

- Payment authorization header: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2830](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2830>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1246](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1246>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1431](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1431>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1435](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1435>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1679](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1679>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1683](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:1683>)

- URL assignment: [functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2626](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/functions/FunctionsPaymenCacBankMobileMoneyAcount.php:2626>)

- Checkout dispatch: [connect/v1/OrderManagementPaymentWaysElectronic/AddOrder-PaymentSendInset.php:19765](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/connect/v1/OrderManagementPaymentWaysElectronic/AddOrder-PaymentSendInset.php:19765>)

- Customer validation/configuration gate: [connect/v1/contains-orders/add_order.php:926](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/connect/v1/contains-orders/add_order.php:926>)

- Flutter field selection: [lib/src/view/components/form_fields/payment_form_fields.dart:65](</Users/ayman/Documents/Old Mac Data/flutter_projects/platform/yemen_snack_food/lib/src/view/components/form_fields/payment_form_fields.dart:65>)
