process_user_request
The admin's move in the status flow: pick a request up,
quote it, resolve it or reject it. To quote, move the request to ISSUED with its fees; it then
waits for the requester.
It is a GraphQL mutation returning UserRequest, and needs the ADMIN role.
Input
input: ProcessUserRequestInput!
| Field | Type | Required | Description |
|---|---|---|---|
id | String | Yes | The user request to process. |
status | ProcessUserRequestStatus | Yes | IN_CHARGE, ISSUED, RESOLVED or REJECTED. |
fees new | [UserRequestFeeInput!] | When an update request moves to ISSUED | The quote. amount becomes the sum of their prices. An empty list quotes the request as free. Ignored for any other status. |
currency | String | No | Currency of every fee. Defaults to VND. The currency inside each fee's data is ignored. |
internal_amount | Decimal | No | Internal cost. Only ADMIN users can read it back. |
amount removed | Decimal | — | Worked out from fees. Sending it now fails the request. |
UserRequestFeeInput has the same shape as add_passenger_fee's fee
data:
| Field | Type | Required | Description |
|---|---|---|---|
fee_type | FeeType | Yes | BAGGAGE, SEAT or OTHER. |
leg | FlightLeg | When the request is round-trip | DEPARTURE or RETURN. Defaults to the request's leg, and must match it on a one-leg request. |
baggage | AddBaggageInput | When BAGGAGE | The baggage. Its price is the fee's price. |
seat | SeatInput | When SEAT | The seat. Its fee is the fee's price. |
other_fee | OtherFeeInput | When OTHER | The charge. Its price is the fee's price. |
Each fee is saved with an id, which the requester and add_passenger_fee use later. A few rules:
- Prices can't be negative.
- At most one seat and one baggage per leg — a passenger can hold only one of each.
transaction_timein the fee data is ignored; it's set when the fee is applied.- Fees can't change once the request is
ISSUED. - A cancel request can be issued with or without fees.
Allowed transitions
| Current status | Allowed status | Otherwise |
|---|---|---|
PENDING | IN_CHARGE, RESOLVED, REJECTED — any admin | ISSUED returns invalid_status |
IN_CHARGE | ISSUED, RESOLVED, REJECTED — only the admin in charge | Another admin gets unauthorized; an update request moved to ISSUED without fees gets fees_required |
ISSUED | None — waiting for the requester | locked_issued_request |
AWAITING_PERSONAL_PAYMENT | None — waiting for the requester's payment | locked_awaiting_personal_payment_request |
CONFIRMED | None — waiting for approvers | locked_confirmed_request |
RESOLVED, REJECTED, CANCELED, DECLINED | None (final) | <status>_user_request for the admin who handled it, unauthorized for anyone else |
Sending the status the request already has returns invalid_params.
Mutation
mutation {
process_user_request(input: {
id: "3JMY..."
status: ISSUED
currency: "VND"
fees: [
{ fee_type: SEAT, leg: DEPARTURE, seat: { code: "12A", fee: 100000 } }
{ fee_type: OTHER, leg: DEPARTURE, other_fee: { price: 50000, note: "Change fee" } }
]
}) {
id status amount currency
fees { id fee_type leg price }
}
}
Errors
| Error | Meaning |
|---|---|
fees_required | An update request was moved to ISSUED without fees. |
missing_fee_data | A fee is missing the data matching its fee_type — baggage, seat or other_fee. |
fee_leg_required | A fee on a round-trip request has no leg. |
fee_leg_mismatch | A fee's leg isn't the request's leg. |
invalid_fee_leg | A fee's leg is ROUND_TRIP; each fee is for one leg. |
invalid_fee_price | A fee's price is negative. |
duplicate_fee | Two seats, or two baggages, on the same leg. |
invalid_status | A PENDING request was sent straight to ISSUED; pick it up first. |
locked_issued_request | Waiting for the requester to confirm or decline. |
locked_awaiting_personal_payment_request | Waiting for the requester to pay their part. |
locked_confirmed_request | Already confirmed; waiting for approvers. |
invalid_params | The request already has that status. |
<status>_user_request | The request is in a final status. |
unauthorized | Another admin is handling the request. |
not_found | Unknown id. |
It can also return Middleware Errors — UNAUTHORIZED for a
caller without the ADMIN role, which differs from the lower-case unauthorized above.