# Legacy reward-points payment / الدفع بنقاط المكافآت

Payment type: `5`. **A concrete method ID was not established from the inspected branches. Do not assume ID 15.** This file records a legacy category, not a verified complete Flutter checkout integration. Reviewed on 2026-10-24.

## URLs

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>).

Provider URL: **none**. Listing and validation use the same application paths:

- `POST {APP_API_BASE}/payment.php?action=get_all`
- `POST {APP_API_BASE}/orders.php?action=add_order`

`APP_API_BASE` comes from Flutter Remote Config `api_url`; the actual deployed URL and enabled database rows were not verified.

## Configuration and required fields

| Field / setting | Meaning |
| --- | --- |
| `SiteConfigAllowGetOrdersPaymentRewardsPoints` | Gates legacy reward-payment method listing. |
| `platform_payment_ways.type=5` | Reward-payment category in backend checkout. |
| `payment_id` | Must be an actual enabled configured row of type 5; no fixed ID can be supplied from this audit. |
| `SumOrdersPaymentDeservedRewardsPoints` | Customer's available reward quantity used by validation. |
| `CountQuantity` | Order item quantity compared with available reward quantity in the inspected validation. |
| `payment_reward_value` | Reward-value field exposed by method listing when the relevant feature is enabled. |

Use common row labels/descriptions/status fields. No provider URL, merchant secret, customer mobile, external voucher or OTP is established for this branch. Do not assume reward quantity converts directly to currency or invoice value.

## Observed flow

1. Enable the legacy reward feature and a configured type-5 method if this functionality is actually intended.
2. Listing filters the reward category when the feature is off.
3. During order validation, type 5 sets `RunThisPaymentAccountGetRewardsPoints`.
4. Backend compares available deserved reward points with the order quantity and rejects insufficient points.
5. The inspected Flutter payment-type constants have no dedicated type-5 path. Complete reward deduction, payment confirmation, redemption-rate and cancellation behavior were not established by this audit; do not present this as a ready integration.

## Request shape

Illustrative multipart form fields only; replace the method ID with the configured database row. Shared order/address/items fields are also required.

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

## Responses

No external provider response exists. The known insufficient-points branch returns an application business failure:

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

The shared application success envelope uses `status=0`, `message`, optional `result`; a successful fully redeemed reward-payment state/schema was not verified, so none is fabricated here.

## Source and naming caution

An old English label calls category 5 “Client Wallet”, while actual internal cash wallet checkout is type 6. Use branch behavior and the wallet file rather than inferring a payment flow from that old translation.

## Source evidence

- [connect/v1/contains-orders/add_order.php:888](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/connect/v1/contains-orders/add_order.php:888>)
- [connect/v1/contains-orders/add_order.php:1799](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/connect/v1/contains-orders/add_order.php:1799>)
- [connect/v1/payment.php:465](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/connect/v1/payment.php:465>)
- [language/Arrays-English.php:209](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/language/Arrays-English.php:209>)
- [language/Arrays-Arabic.php:245](</Users/ayman/Documents/Old Mac Data/Downloads/yemensnackfood/language/Arrays-Arabic.php:245>)
