Skip to main content

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!

FieldTypeRequiredDescription
idStringYesThe user request to process.
statusProcessUserRequestStatusYesIN_CHARGE, ISSUED, RESOLVED or REJECTED.
fees new[UserRequestFeeInput!]When an update request moves to ISSUEDThe quote. amount becomes the sum of their prices. An empty list quotes the request as free. Ignored for any other status.
currencyStringNoCurrency of every fee. Defaults to VND. The currency inside each fee's data is ignored.
internal_amountDecimalNoInternal cost. Only ADMIN users can read it back.
amount removedDecimal—Worked out from fees. Sending it now fails the request.

UserRequestFeeInput has the same shape as add_passenger_fee's fee data:

FieldTypeRequiredDescription
fee_typeFeeTypeYesBAGGAGE, SEAT or OTHER.
legFlightLegWhen the request is round-tripDEPARTURE or RETURN. Defaults to the request's leg, and must match it on a one-leg request.
baggageAddBaggageInputWhen BAGGAGEThe baggage. Its price is the fee's price.
seatSeatInputWhen SEATThe seat. Its fee is the fee's price.
other_feeOtherFeeInputWhen OTHERThe 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_time in 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 statusAllowed statusOtherwise
PENDINGIN_CHARGE, RESOLVED, REJECTED — any adminISSUED returns invalid_status
IN_CHARGEISSUED, RESOLVED, REJECTED — only the admin in chargeAnother admin gets unauthorized; an update request moved to ISSUED without fees gets fees_required
ISSUEDNone — waiting for the requesterlocked_issued_request
AWAITING_PERSONAL_PAYMENTNone — waiting for the requester's paymentlocked_awaiting_personal_payment_request
CONFIRMEDNone — waiting for approverslocked_confirmed_request
RESOLVED, REJECTED, CANCELED, DECLINEDNone (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​

ErrorMeaning
fees_requiredAn update request was moved to ISSUED without fees.
missing_fee_dataA fee is missing the data matching its fee_type — baggage, seat or other_fee.
fee_leg_requiredA fee on a round-trip request has no leg.
fee_leg_mismatchA fee's leg isn't the request's leg.
invalid_fee_legA fee's leg is ROUND_TRIP; each fee is for one leg.
invalid_fee_priceA fee's price is negative.
duplicate_feeTwo seats, or two baggages, on the same leg.
invalid_statusA PENDING request was sent straight to ISSUED; pick it up first.
locked_issued_requestWaiting for the requester to confirm or decline.
locked_awaiting_personal_payment_requestWaiting for the requester to pay their part.
locked_confirmed_requestAlready confirmed; waiting for approvers.
invalid_paramsThe request already has that status.
<status>_user_requestThe request is in a final status.
unauthorizedAnother admin is handling the request.
not_foundUnknown id.

It can also return Middleware Errors — UNAUTHORIZED for a caller without the ADMIN role, which differs from the lower-case unauthorized above.