feat: add CreditCall preauth streaming
This commit is contained in:
+38
-10
@@ -2,7 +2,7 @@
|
||||
|
||||
Deploy ChipDNAClientCLI, then hardlink, then Operafyne. No database or configuration
|
||||
migration is needed. The existing CreditCall provider selection enables the new
|
||||
sale route; CreditCall does not implement the generic payment provider interface.
|
||||
SALE and PREAUTH routes; CreditCall does not implement the generic payment provider interface.
|
||||
|
||||
## Contracts
|
||||
|
||||
@@ -10,6 +10,15 @@ sale route; CreditCall does not implement the generic payment provider interface
|
||||
`{"amount":1234,"confirmNo":"BOOKING-123","currency":"GBP"}`. Amount remains in
|
||||
minor units. CreditCall uses its existing SDK transaction reference generation.
|
||||
|
||||
`POST /api/payment/preauth` accepts string fields `amount`, `transactionType`
|
||||
and `checkoutDate`. Positive preauth sends the existing `Sale` input and checkout
|
||||
string; zero-value verification sends `{"amount":"","transactionType":"AccountVerification","checkoutDate":""}`.
|
||||
The returned `ACCOUNT VERIFICATION` type is matched case-insensitively and succeeds
|
||||
without persistence. Returned approved `SALE` schedules existing SQL persistence
|
||||
using provider-returned `TOTAL_AMOUNT`, never the request amount. PREAUTH does not
|
||||
confirm. Checkout remains departure-derived midnight UTC in the existing string
|
||||
format; SQL's existing date conversion and 48-hour release calculation are unchanged.
|
||||
|
||||
For CreditCall, responses contain newline-delimited JSON:
|
||||
|
||||
```json
|
||||
@@ -19,7 +28,7 @@ For CreditCall, responses contain newline-delimited JSON:
|
||||
|
||||
`outcome` is `approved`, `declined`, `cancelled`, `timeout`, or `error`. Approval
|
||||
is produced only by the shared CreditCall transaction/finalization core, including
|
||||
the existing confirmation behavior. `httpStatus` preserves the equivalent legacy
|
||||
SALE confirmation behavior; PREAUTH uses its existing unconfirmed-result rules. `httpStatus` preserves the equivalent legacy
|
||||
operation status even after streaming commits HTTP 200. `status` preserves the
|
||||
existing processor `StatusRec`. Failure `message` preserves the plain description
|
||||
used by the legacy flow, including its existing interpretation quirks.
|
||||
@@ -31,20 +40,32 @@ continue using their existing `{"type":"result","response":...}` contract.
|
||||
|
||||
Hardlink calls `POST /start-transaction-stream/` on ChipDNAClientCLI with
|
||||
`{"amount":"1234","transactionType":"Sale"}`. Its NDJSON consists of allowlisted
|
||||
`status` frames (`source`, `value`), a single `result` containing the required SDK
|
||||
fields, or a sanitized `error`. Receipt XML may be a JSON string field needed by
|
||||
`status` frames (`source`, `value`), a single `result` containing allowlisted SDK
|
||||
fields, or a sanitized `error`. `TRANSACTION_TYPE` and optional `TOTAL_AMOUNT`
|
||||
are included only when returned by the provider. They are never synthesized and
|
||||
are not added to the kiosk-facing result. AccountVerification normally omits
|
||||
`TOTAL_AMOUNT`. Receipt XML may be a JSON string field needed by
|
||||
hardlink's existing receipt handler; it is never a raw line in the stream.
|
||||
Confirmation continues through the existing, separate XML endpoint.
|
||||
SALE confirmation continues through the existing, separate XML endpoint.
|
||||
|
||||
## Lifetime and compatibility
|
||||
|
||||
- `/start-transaction/`, `/takepayment`, and `/takepreauth` retain their existing
|
||||
external contracts. Preauthorization and SQL persistence/release remain legacy.
|
||||
- Start and each confirmation call retain their independent 300-second timeout.
|
||||
external contracts. Both SALE and PREAUTH now stream to Operafyne; existing SQL
|
||||
persistence/release behavior remains unchanged.
|
||||
- Operafyne uses a private 120-second CreditCall client for SALE and PREAUTH.
|
||||
This is only the kiosk wait boundary; Dojo/PayBridge clients are unchanged.
|
||||
Timeout/cancellation is technical, not an authoritative decline or automatically
|
||||
retryable result. It never triggers a second start or legacy endpoint fallback.
|
||||
- Validation uses the inbound request. At financial dispatch handoff, hardlink
|
||||
detaches cancellation with `context.WithoutCancel`. Inbound cancellation and
|
||||
write failures control only delivery; result processing, SALE confirmation,
|
||||
receipts and PREAUTH persistence scheduling continue independently.
|
||||
- Start and each SALE confirmation call retain their independent 300-second timeout.
|
||||
Confirmation still uses two attempts, retrying transport/read errors with the
|
||||
existing two-second delay. The generic whole-operation timeout is not used.
|
||||
- Kiosk cancellation or failed/blocked kiosk delivery does not cancel upstream reading,
|
||||
confirmation, or receipt handling. Progress queues may drop hints when full;
|
||||
confirmation, receipt handling, or PREAUTH persistence scheduling. Progress queues may drop hints when full;
|
||||
final results have a separate slot and are delivered at most once.
|
||||
- Only the response writer writes frames. Transaction execution never waits
|
||||
for progress delivery. No additional delivery timer or whole-operation deadline
|
||||
@@ -68,7 +89,7 @@ Confirmation continues through the existing, separate XML endpoint.
|
||||
timeout outcomes, confirmation, retry, receipts, PMS posting, or business state.
|
||||
- After timeout, an ambiguous start error, an asynchronous SDK error during an
|
||||
active window, or reference reuse/overlap, progress remains suppressed for that
|
||||
`Client` lifetime. New transactions, elapsed time, callbacks and automatic
|
||||
`Client` lifetime across SALE and PREAUTH. New transactions, elapsed time, callbacks and automatic
|
||||
reconnect do not reset the guard. Payments remain enabled.
|
||||
- Only the exact synchronous `ClientNotConnectedToServer` error safely clears an
|
||||
unsuppressed window and releases its unused reference: SDK 3.17 `StartCommand`
|
||||
@@ -91,6 +112,13 @@ with MSBuild, then run `Tests/bin/Debug/ChipDNAClient.StreamingTests.exe`. The
|
||||
test executable links the production streaming code and needs no terminal.
|
||||
|
||||
In Operafyne, run `go test -count=1 ./...`; the service tests cover structured
|
||||
CreditCall sales, unchanged preauth requests, failure/retry parity, and existing
|
||||
CreditCall SALE/PREAUTH, unchanged legacy requests, the 120-second UX boundary,
|
||||
cancellation after dispatch, failure/retry parity, and existing
|
||||
Dojo/PayBridge response handling. Run `go vet ./...`, `go build ./...`, and
|
||||
`git diff --check` in both Go repositories.
|
||||
|
||||
Physical account-verification testing confirmed approved `ACCOUNT VERIFICATION`
|
||||
with no `TOTAL_AMOUNT`. A monetary `/takepayment` test confirmed returned minor
|
||||
units; positive PREAUTH through the new transport still needs physical Miura
|
||||
validation. Automated tests do not replace that check. Receipt fields such as
|
||||
`NoChargeDeclaration` retain the existing provider-entry rendering behavior.
|
||||
|
||||
Reference in New Issue
Block a user