Repository navigation
Pay the landing fee through the app API - #929
Merged
Merged
Conversation
Which payment methods the wizard offers (the enabled ones, the card terminal only for local sign-ins, invoice only with recipients) and whether it asks for payment at all (a fee, not a home-base aircraft unless homebasePayment) were written inline in ArrivalFinishContainer and Finish. They are now getSelectablePaymentMethods and isPaymentDue in src/util/paymentMethods.ts, so the movement API can be held to the same rules by a parity test. No change in behaviour.
GET/POST /app/movements/arrivals/:key/payment (also under /api, scope movements:write for central login tokens): how the caller may pay the landing fee of an arrival, and paying it, for API clients such as the Open Digital MCP hub. - domain/paymentOptions.js offers exactly what the arrival wizard offers (parity spec against src/util/paymentMethods.ts for every project and kind of user): payment when a fee is due and the aircraft is not home-based unless homebasePayment; the configured methods whose authCondition holds, the card terminal only for local sign-ins, invoice once per recipient listing the caller's e-mail - the server config and policy carry paymentMethods and homebasePayment (with client __CONF__ parity) - application/payArrival.js records the method through saveMovement (ownership, lock); for checkout it then pushes the /card-payments entry the app writes (amount: the arrival's fee in cents) as the caller and waits for the payment service's checkout URL; updateArrivalPaymentStatus marks the arrival paid as for the app - emulator test against the lsze rules: card payment and method accepted for a login caller, denied on another pilot's arrival
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Arrivals recorded through Claude (Open Digital MCP hub) end unpaid today. This PR lets API clients pay the landing fee
of an arrival with exactly the choices the app's arrival wizard offers, which depend on the aerodrome and the user.
The payment service is not touched: like the app, the API pushes the
/card-paymentsentry the service listens on.Commits
Move the arrival wizard's payment choice into the util. Two pieces of the wizard were written inline:
recipients (
ArrivalFinishContainer);Finish).They are now
getSelectablePaymentMethodsandisPaymentDueinsrc/util/paymentMethods.ts, so the API can beheld to them by a parity test. No change in behaviour.
Pay the landing fee through the app API.
GET/POST /app/movements/arrivals/:key/payment, also under/api; central login tokens needmovements:write.domain/paymentOptions.jsoffers what the wizard offers. Payment is asked for when a fee is due and the aircraftis not a club or home-base aircraft, unless
homebasePayment. The methods are the configuredpaymentMethodswhose
authConditionholds (a login caller is never a kiosk),cardonly for local sign-ins, andinvoiceonceper recipient whose
emailslist the caller. They come in the order of the client'sPAYMENT_METHODS.paymentMethodsandhomebasePayment, checked for parity withthe client
__CONF__.application/payArrival.js:GETanswers{due, amount, currency, options, state}, withstateone ofopen,pending,paid,arranged. Where the server prices arrivals, it waits up to 3 s for the fee.POST {method, invoiceRecipientName?}refuses a method that is not offered, an arrival already paid orarranged, and another pilot's arrival. It records the method through
saveMovement(ownership, lock,validation), before any card payment exists.
checkoutit then pushes the/card-paymentsentry exactly as the app writes it, as the caller. The amountis the arrival's
feeTotalGrossin cents, and the reference number comes from the server's existing port(
reports/airstat/referenceNumber.js).{method, checkoutUrl}.updateArrivalPaymentStatusmarks the arrival paid as for the app.
projects/Configuration.md.Unchanged
updateArrivalPaymentStatus.Test plan
src/util/paymentOptions.parity.spec.js: for every project (9), with a pilot, the kiosk and the guest,0 to 2 invoice recipients, home-base or not, and fee 0 or 30, the API's options equal the wizard's.
paymentOptions.spec.js:payArrival.spec.js:rtdbMovementRepository.spec.js,movementRoutes.spec.js,policy.spec.js,generateServerConfig.spec.js,api/index.spec.js.npm test: 360 suites / 7961 testsnpm run typechecknpm run test:functions: 114 suites / 4696 testsnpm run test:rules(database emulator) with the newmovementApiPayment.rules.jsagainst the built lsze rules:service returns the checkout URL;
and by invoice.
Generated by Claude Code