Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 1m10s
payment.sx — payment-request materialises {:order :amount :currency :return-url}
at the IO edge (amount from the ledger, currency/return-url host-supplied), so
lib/commerce stays vendor-agnostic; SumUp/Stripe adapters live in the orders
service and order-settle!(ref, amount) is the resume seam. pending-payments
enumerates suspended orders + envelopes (host poller seam). Gotcha handled: a
Scheme string flow-payload round-trips back wrapped as {:scm-string ...} —
unwrapped via scm->string. Total 209/209 across 13 suites.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.4 KiB
Plaintext
44 lines
1.4 KiB
Plaintext
;; lib/commerce/tests/payment.sx — provider-neutral payment-request envelope.
|
|
;; Uses (commerce-test name got expected) provided by conformance.sh.
|
|
;; Envelope construction is ledger-only (no flow env); pending-payments (which
|
|
;; needs the flow env) is exercised in the order suite.
|
|
|
|
(define q1 {:codes (list) :subtotal 1000 :discount 0 :total 1200 :tax 200})
|
|
(define q2 {:codes (list) :subtotal 5000 :discount 500 :total 4500 :tax 0})
|
|
|
|
(define b (persist/mem-backend))
|
|
(define _c1 (order-create b "P1" 1 q1))
|
|
(define _c2 (order-create b "P2" 1 q2))
|
|
|
|
(commerce-test
|
|
"envelope"
|
|
(payment-request b "P1" :GBP "https://shop/return")
|
|
{:order "P1" :amount 1200 :return-url "https://shop/return" :currency :GBP})
|
|
|
|
(commerce-test
|
|
"envelope-amount"
|
|
(payment-request-amount (payment-request b "P1" :GBP "x"))
|
|
1200)
|
|
(commerce-test
|
|
"envelope-currency"
|
|
(payment-request-currency (payment-request b "P1" :GBP "x"))
|
|
:GBP)
|
|
(commerce-test
|
|
"envelope-order"
|
|
(payment-request-order (payment-request b "P1" :GBP "x"))
|
|
"P1")
|
|
(commerce-test
|
|
"envelope-return-url"
|
|
(payment-request-return-url (payment-request b "P1" :GBP "https://r"))
|
|
"https://r")
|
|
|
|
;; amount tracks the ledger total, currency is per-call (provider/instance config)
|
|
(commerce-test
|
|
"envelope-amount-2"
|
|
(payment-request-amount (payment-request b "P2" :EUR "x"))
|
|
4500)
|
|
(commerce-test
|
|
"envelope-currency-2"
|
|
(payment-request-currency (payment-request b "P2" :EUR "x"))
|
|
:EUR)
|