golem15.paymentgateway
The compiled payment gateway plugin for SummerCMS applications: orders and payments with exact money, their state machines and events, a build-time payment operator interface, the cart value objects, currencies and the notification route.
import _ "git.golem15.com/golem15/sm-paymentgateway-plugin"
Module git.golem15.com/golem15/sm-paymentgateway-plugin, package paymentgateway, plugin ID golem15.paymentgateway, requires golem15.user.
Overview
The plugin ports the WinterCMS Golem15.PaymentGateway plugin. A consumer plugin builds a cart.Cart and cart.Details, calls the published *orders.Service and *payments.Service inside its own transaction, and listens to the typed events (events.OrderPaid, events.PaymentAccepted, ...) the services fire. Payment operators are Go values: cash and manual transfer ship here, Stripe lives in sm-pgstripe-plugin, and any activated plugin can add its own by implementing operators.HasOperators.
Tables, columns, migration IDs, operator codes, event names, permission codes and console command names are the PHP ones, so an application's existing MySQL rows copy over and keep working. The admin screens (Orders, Payments, Quotes, Quote items, Shipping methods) are described in Admin, the two settings pages in Settings and the customer and staff mails in Mail, and the headless customer order API that replaces the Winter Orders component in Customer API.
Features
- Exact money (
money):money.Moneyis an int64 scaled by 10^4 plus an ISO code, with the Keios MoneyRight rules: an int input is cents for every currency (money.FromMinor(3984, "PLN")is 39.8400),MulandDivtake an exact rational, compute at five places with truncation and round half away from zero to two places (four withmoney.RoundingGAAP),Allocatehands out the remainder as MoneyRight does,Minorrounds half up to cents.money.Amount4scans and writes thenumeric(12,4)andnumeric(10,4)columns exactly; a fifth decimal, an exponent or a non-digit is refused, never rounded. No floating-point type is used for money, tax, ratios or exchange rates. - State machines (
fsm,orders,payments): the payment machine (six states, five transitions) and the order machine (twelve states, nineteen transitions, the Ship guard, the four final and two refundable states) are the PHP tables.PerformTransitionsaves the state in the caller's transaction, then fires the event; the PHP special cases (Ship setswas_shipped, Reject cancels manual and cash payments, the refund transitions refund the successful payment) are kept. - Bridge: with
orders_enabled, payment events move their order (PHPOrderPaymentEventSubscriber): PaymentSent purchases, PaymentAccepted pays (or refunds a payment received for a rejected order), PaymentCanceled cancels, PaymentRefunded applies the first allowed refund transition. The order row is lockedFOR UPDATEbefore the check, so a race or a replay is a no-op. - Operators (
operators): theoperators.Operatorinterface, the orderedoperators.Registrycollected at boot from every activated plugin (a duplicate code fails boot naming both plugins), andoperators.Cash,operators.ManualTransferandoperators.Disabledwith the PHP codesgolem15.paymentgateway::lang.channels.cash,...channels.manualTransferand...channels.disabled. A payment whose operator is unknown or switched off is wrapped as disabled (payments.Service.Wrap). - Cart rows (
cart): every row Go writes carries"v": 2and the long-key shape below; stored PHP rows (the JMS shape, nov) are decoded in place by the permanent legacy reader and never rewritten in bulk. Application item types and typed details parameters register by name (cart.RegisterItemType,cart.RegisterDetailsParams), never by class. - Hash ids and guest access (
support):support.Hashidsencodes the 8-characterhash_idand the 32-characterguest_codewith the configured salt and decodes with the configured salt, then the legacy salt;support.GuestTokenissues HMAC-SHA256 guest tokens bound to one order id with a 24-hour TTL. - Currencies (
currency):currency.NBP(NBP Table A of the day before, with the weekend fallback) andcurrency.Fixerfillgolem15_paymentgateway_currencies;currency.Converterstoresnative_amount_storedthrough the ratio exactly as MoneyRightCurrencyPair::convertdoes and creates a missing currency whencurrency_auto_createis on. - Notification route:
/_paymentgateway/{op},/_paymentgateway/{op}/{mode}and/_paymentgateway/{op}/{mode}/{result}for GET, POST, PUT, PATCH and DELETE, verify-before-lookup, redacted request logs. - Scheduled commands: the four daily sweeps and the ten-minute currency update through
pact.HasSchedule, pluspaymentgateway:import-winter. - Settings and mail: the payment gateway settings page with a required default currency, the mailer settings page with one switch per mail, 27 Markdown mail templates in Polish and English under the PHP codes, and four mailer groups that send after the commit.
- Customer API (
api): twelve JSON endpoints under/_paymentgateway/api/v1for a site's order, checkout and order list pages (thevue-paymentgateway-layerNuxt layer renders them), with the PHP component's access rules and state guards. - Admin: five cabana controllers with the PHP permissions, a navigation entry, server-rendered stats and previews, the order and payment state machines as record actions, and an inline quote cart editor; every amount column and field is
type: moneyover the exact stored amount.
Usage
Taking a payment
c := cart.NewCart("PLN")
item, err := cart.NewItem("Chart", 1, money.FromMinor(3984, "PLN"), 23, map[string]any{"product_type": "natal"})
if err != nil {
return err
}
c.Add(item)
d := cart.NewDetails(operators.CodeCash, "Chart order", "https://shop.example/orders/return", user.Email)
ordersSvc, _ := app.Lookup[*orders.Service]()
paymentsSvc, _ := app.Lookup[*payments.Service]()
err = lagoon.Transaction(ctx, db, func(ctx context.Context, tx *gorm.DB) error {
order, err := ordersSvc.Make(ctx, tx, c, d, user)
if err != nil {
return err
}
p, err := paymentsSvc.Create(ctx, tx, c, d, user, payments.ForOrder(order))
if err != nil {
return err
}
resp, err := paymentsSvc.Purchase(ctx, tx, p) // Send; Accept on a complete response
_ = resp // RedirectURL, ClientSecret for API operators
return err
})
Orders.Make refuses with orders.ErrNotConfigured while the settings have no default_currency (there is no SetUp wizard). A payment above the numeric(10,4) ceiling (999999.9999) fails with payments.ErrAmountTooLarge instead of a truncated row. An application that took the money through its own integration records it with payments.Service.RecordExternal, then calls Send and Accept.
React to the outcome with a typed listener:
app.Events.Listen[*events.OrderPaid]("acme.books", func(ctx context.Context, e *events.OrderPaid) error {
// e.Order is saved in Paid; write through e.Tx, send mail in lagoon.AfterCommit.
return nil
})
Shipping an operator
A plugin implements operators.Operator and publishes it through operators.HasOperators; the gateway collects it at boot, after its own operators, in activation order:
func (p *Plugin) PaymentOperators() []operators.Operator {
return []operators.Operator{&MyOperator{app: p.app}}
}
Code() is the stored payments.operator value and, base64-encoded, the notification route segment (support.Urlize, payments.NotificationURL). VerifyNotification must authenticate the request from the raw body before anything else happens; returning false (the built-in operators always do) answers 403. HandleNotification receives the payment locked FOR UPDATE in operators.PaymentContext and applies transitions through the payment service with PaymentContext.Tx; the http.Handler it returns writes the response after the commit, and a replay that changes nothing should still answer 200.
Stored cart and details rows
Rows Go writes (row format confirmed at plan 18-02 Task 1, option v2-research):
{"v":2,"currency":"PLN","items":[{"id":"…","type":"generic","description":"Chart","count":1,
"net_price":{"amount":"39.8400","currency":"PLN"},"tax":23,"data":{"product_type":"natal"},
"adjustments":[{"id":"…","type":"value","description":"…","value":{"amount":"5.0000","currency":"PLN"}},
{"id":"…","type":"percent","description":"…","percent":10}]}],
"shipping":{"name":"Courier","cost":{"amount":"15.0000","currency":"PLN"},"tax":23}}
{"v":2,"operator":"golem15.paymentgateway::lang.channels.cash","description":"…","return_url":"…","email":"…",
"shipping_address":{"recipient_first_name":"…","recipient_last_name":"…","street":"…","building_number":"…",
"flat_number":"…","zip_code":"…","city":"…","country":"…"},
"parameters":{}}
cart.Decode and cart.DecodeDetails read both versions; a row without v goes to cart.DecodeLegacyCart / cart.DecodeLegacyDetails (the JMS keys, [] read as an empty map, item order kept). An unknown legacy item type fails loudly until the application registers it:
func init() {
_ = cart.RegisterItemType("invoice-item", []string{"InvoiceItem"}, func() any { return &InvoiceData{} })
}
Once Go writes a v2 row, the PHP plugin cannot read it.
Admin
The admin half of the plugin is cabana YAML under controllers/<name>/ and models/<model>/, embedded with the Go code in one AdminFS, plus Go controllers in the controllers package. A controller never writes an order's or a payment's state, amounts or owner itself: record actions call orders.Service and payments.Service inside the action transaction, with the row locked by cabana.
Permissions and navigation
Plugin.Permissions registers the seven PHP codes (constants PermissionAccessPayments, PermissionAccessSettings, PermissionAccessOrders, PermissionAccessShippings, PermissionManageOrders, PermissionManageShippings, PermissionManagePayments) on the tab golem15.paymentgateway::lang.labels.pluginName.
Plugin.Navigation adds "Payments & orders" (nav.label, icon credit-card, order 500, permission golem15.paymentgateway.*) with the side items Orders (shopping-cart, access_orders), Payments (credit-card, access_payments), Quotes (wand-sparkles, access_orders), Quote items (list, access_orders) and Shipping methods (box, access_shippings). Payments is always listed; Orders, Quotes, Quote items and Shipping methods are listed only while their feature is on (orders_enabled; orders_enabled and use_quotes; orders_enabled and shippings_enabled), through a Visible func the admin runs on every navigation request, so a change in the settings shows on the next navigation load without a restart, and every item is listed before the database is published or migrated. A screen opened by its URL while its feature is off still shows the "Turned off" callout above its list. The top-level item opens Orders, or Payments while orders are off.
Controllers
| Controller ID | Model | Reads | Writes | Screen |
|---|---|---|---|---|
golem15.paymentgateway.orders |
Order | access_orders | manage_orders (record actions only) | List without a create button (quotes left out), state filter, orders_stats header; read-only preview with order_hint and the cart, payments, details and description partials. Form saves and deletes are refused. |
golem15.paymentgateway.payments |
Payment | access_payments | manage_payments (record actions only) | List with state and operator filters and the payments_stats header; read-only preview with payment_hint, the uuid, the operator name and the public payment_data. Form saves and deletes are refused. |
golem15.paymentgateway.quotes |
Order | access_orders | manage_orders | Orders in state Quote; create form (customer, e-mail, description); update form with the quote cart element; preview with the details, the cart and process_quote. |
golem15.paymentgateway.quoteables |
Quoteable | access_orders | manage_orders | Quote items: name, default net price (money), default VAT rate, custom fields (repeater of key and value). |
golem15.paymentgateway.shippings |
Shipping | access_shippings | manage_shippings | Shipping methods: name, logo (fileupload, image, 260×260), net cost (money), VAT rate, cash on delivery; the list adds the gross cost. |
cabana has no write-permission seam, so the quotes, quote items and shippings controllers refuse a create, save or delete without the manage permission in their form hooks (403 with the reason). An empty currency of a shipping method or a quote item is set to the default currency on save, as the PHP money widget did.
List columns show labels, never stored codes: the plugin registers the list-only field types orderstate (orderstates.*), paymentstate (paymentstates.*), operatorname (the operator code is its own phrase key; an unknown code is shown as stored) and taxrate (23%). Their element golem15-paymentgateway-label is a read-only text element defined in assets/js/quote-cart.js; their Decode refuses every value, so they are not form fields. The money columns are amount_stored / native_amount_stored (orders, quotes, payments) and cost_stored (shippings, quote items) with their currency / native_currency columns; the stored type money.Stored serializes as the exact four-decimal string. The shipping list's gross_cost is Shipping.Gross, computed after each load from Shipping.GrossCost (the PHP getGrossCost: the tax is a MoneyRight multiplication, rounded to cents) and never stored.
Record actions
| Controller | Action | Applies when | Danger | Effect |
|---|---|---|---|---|
| orders | reject |
RejectEarly or Reject allowed | yes | PerformTransition (cancels the cash and bank transfer payments first) |
| orders | execute |
Execute allowed | Paid to Underway | |
| orders | ship |
Ship allowed | sets was_shipped |
|
| orders | direct_refund |
DirectRefund allowed and state Paid | yes | refunds the successful payment |
| orders | grant_refund |
GrantRefund allowed and not shipped | yes | refunds the successful payment |
| orders | wait_for_return |
WaitForReturn allowed and shipped | ||
| orders | refund_after_return |
RefundAfterReturn allowed | yes | refunds the successful payment |
| orders | guarantee_refund |
GuaranteeRefund allowed | ||
| orders | create_cash_payment, create_bank_payment |
no successful payment, Purchase allowed, the cash or manual transfer operator registered and on | payments.Create from the stored cart and details with that operator, then payments.Send; the bridge moves the order to AwaitingPayment |
|
| payments | accept |
Accept allowed and the operator mode is manual or cash | payments.Accept; the bridge pays the order |
|
| payments | accept_override |
Accept allowed and the operator mode is api | yes | payments.Accept |
| payments | refund |
Refund allowed | yes | payments.Refund through the operator |
| quotes | process_quote |
the quote has items and Place is allowed | Quote to Placed |
Every order action needs manage_orders, every payment action manage_payments, and none applies while orders_enabled is off. Labels and confirms are golem15.paymentgateway::lang.actions.*. A domain refusal (an operator that cannot refund, a missing operator) answers 403 with the reason and rolls back.
Partials and view models
The templates are html/template files rendered by cabana into an allowlisted node tree; they use only the admin kit classes (.summer-stats, .summer-stat*, .summer-callout*, .summer-table*). Each PartialData returns a curated struct with every text already localized and every amount formatted by support.FormatAmount (PLN 39.84 in English, 39,84 PLN in Polish, two to four decimals, never a float); a view model never holds a GORM model, a return URL, a secure details parameter or an operator secret.
| Partial | Where | Shows |
|---|---|---|
orders_stats |
orders list | setup-needed or orders-off callout; All orders, Open orders, Orders this month, Sales this month (gross native sum of Finished, Paid, Shipped, RequestedRefund and AwaitingReturn orders in the default currency), with previous-month notes |
order_hint |
order preview | status, created, customer (link to golem15.user.users or the details e-mail with "(guest)"), total with the native note, shipping method, the refunded-payment warning |
order_cart |
order preview | the cart table: items with their data sub-line, shipping row, totals and item count |
order_payments |
order preview | the order's payments, newest first, linking to the payment preview, the successful one marked |
order_details |
order preview | the e-mail and the public details parameters (labels from golem15.paymentgateway.details.keys.<key> when configured), the delivery method with its logo and the address |
order_description |
order preview | the description |
payments_stats |
payments list | All payments, Payments this month, Accepted this month (gross native sum) |
payment_hint |
payment preview | status, created and last change, customer or "Anonymous", total, order code, the disabled-operator callout |
payment_uuid, payment_operator |
payment preview | the uuid in <code>, the operator's name |
payment_data |
payment preview | only stripe_checkout_session_id, payment_intent_id, charge_id, email and is_paid_in_stripe from payments.data |
quotes_notice, quoteables_notice, shippings_notice |
lists | the setup-needed or feature-off callout |
quote_summary, quote_cart |
quote preview | the e-mail and description; the cart table |
The quote cart element
<golem15-paymentgateway-quote-cart> (assets/js/quote-cart.js, styled by assets/css/quote-cart.css, both declared through the quotes controller's AdminJS and AdminCSS) is the _quote_cart widget field of the quote update form. It follows the admin widget contract: light DOM, CSS under its tag reading only --c-* variables, no icons, no fetch. cabana runs one action per widget field, so the field's action quote_cart takes the operation in the payload:
| Payload | Effect |
|---|---|
{"action": "load"} |
answers the cart (sent once when the element mounts) |
{"action": "add_quoteable", "quoteable_id": 3} |
adds the quote item as a line (its name, count 1, its default net price and VAT, its custom fields and __quoteable_id as data); a line with the same description gains a piece |
{"action": "change_item", "item_id": "…", "field": "description", "value": "…"} |
field is description (non-empty), count (an integer of at least 1), net_price (a decimal string with at most four places, never rounded, not negative) or tax (an integer 0 to 100) |
{"action": "remove_item", "item_id": "…"} |
removes the line; the message is quote.item_removed |
{"action": "change_details", "field": "email", "value": "…"} |
edits the quote's e-mail or description |
Each operation decodes the stored cart inside one transaction with the order row locked, changes it, saves it as v2 through orders.Service.Save (which recomputes the amounts) and answers data, the cart view model: the lines with their raw unit net price and the formatted amounts, the totals, the quote items to add and the localized copy, so the element has no text of its own. A refused value, a stale line or an order that is no longer a quote answers 403 with the localized reason: the admin toasts it and the element renders the last saved cart again. Once the quote is placed, the answer is read-only and the element renders the table without inputs.
The 36px cell inputs with a 6px radius, the 44px select with a 10px radius and the 42px button are deliberate sizes copied from the admin's DropdownField and the 10.1 widget button box (UI-SPEC Dimension 5).
Not ported
- The PHP
grossCost@updateread-only form field of a shipping method: the list shows the gross cost. - The scoreboard pie charts (no chart library); their counts are the stats.
- The
_order_actions_fieldpartial: the record actions replace it. - The SetUp wizard: the required default currency of the settings page replaces it (see Settings).
- The PHP quote screen's list widget of quote items: the quote cart's select adds them.
Copy
lang/en/lang.yaml and lang/pl/lang.yaml (golem15.paymentgateway::lang.*) carry every key of the PHP lang.php files with the UI-SPEC corrections ("Quote items", the payment states agreeing with "płatność" in Polish, no markup, placeholders in text.single and scoreboard.previous) and the keys the Go admin adds (nav.*, settings.* labels and comments for the settings pages, text.no_*, text.setup_needed*, text.*_off, actions.*_confirm, quote.*, payment.data.*).
Settings
Two settings pages, both in the Payments category (settings.category) behind golem15.paymentgateway.access_settings (SettingsCode, MailerSettingsCode, Plugin.Settings).
Payment gateway (payment_gateway)
The singleton golem15_paymentgateway_settings (row 1), edited by models/settings/fields.yaml on three tabs. Each column and the PHP system_settings key (item golem15::paymentgateway.settings) it replaces:
| Tab | Column | PHP key | Notes |
|---|---|---|---|
| General | default_currency |
defaultCurrency |
Dropdown of the ISO currencies (PLN — Polish zloty, Settings.GetDefaultCurrencyOptions). Required: a save without it answers 422 with settings.default_currency_required; an unknown code is refused. It replaces the PHP SetUp wizard and the isSetUp flag: while it is empty, orders.Service.Make refuses with orders.ErrNotConfigured and the orders list header says orders are paused. Changing it later does not convert stored amounts. |
| General | exchange_rate_provider |
exchangeRateProvider |
fixer or nbp. |
| General | currency_auto_create, enable_guest, backend_prefer_local, frontend_prefer_local |
currencyAutoCreate, enableGuest, backendPreferLocal, frontendPreferLocal |
Switches. |
| Orders | orders_enabled, shippings_enabled, use_quotes, use_underway |
ordersEnabled, shippingsEnabled, useQuotes, useUnderway |
The PHP trigger on ordersEnabled became the comment "Applies only when orders are turned on." |
| Orders | order_placed_to_canceled_timeout, payment_created_to_canceled_timeout, payment_sent_to_canceled_timeout, order_shipped_to_finished_timeout |
the four …Timeout keys |
Days, 1 to 30 (number fields instead of the PHP knobs); the seeded row holds the PHP initSettingsData values 7, 7, 7 and 14. |
| Orders | order_url_template |
none (new) | The customer's order page for the mails, with {hash} where the order code goes, for example https://shop.example.com/orders/{hash}. Only an absolute http or https address of at most 500 characters is accepted (models.ValidOrderURLTemplate); without it the mails carry no link. It replaces the PHP OrderComponentResolver, which found the CMS page hosting the Orders component. |
| Payment methods | cash_enabled, manual_transfer_enabled |
golem15.paymentgateway::lang.channels.cash, …channels.manualTransfer |
The operator switches (the PHP keys are the operator codes). |
| Payment methods | manual_transfer_name, manual_transfer_receiver_address, manual_transfer_bank_acc_no, manual_transfer_swift |
…channels.manualTransfer.name, .receiverAddress, .bankAccNo, .swift |
Shown to customers who pay by bank transfer. |
| Payment methods | manual_transfer_bank_details |
…channels.manualTransfer.bankDetails |
A rich-text field: every save runs it through the seaglass sanitizer and reports what was removed; the import sanitizes it the same way. Mails show it as plain lines. |
| Payment methods | log_requests |
none (new) | Logs each operator notification with secrets removed. |
Mailer (payment_gateway_mailer)
The singleton golem15_paymentgateway_mailer_settings (row 1, models.MailerSettings), edited by models/settings/mailer_fields.yaml on five tabs: General, Order mails to customers, Order mails to staff, Payment mails to customers and Payment mails to staff.
| Column | PHP key | Notes |
|---|---|---|
mailer_from_email, mailer_from_name |
mailer.credentials.email, mailer.credentials.name |
The PHP sender. Mails are sent from the application's mail.from; this address becomes the reply-to and the name and address are the posName and posEmail variables. |
admin_email |
mailgroup (left half) |
Staff mails go to this address when it is set. |
admin_group_id |
mailgroup (right half) |
Otherwise to every backend user of this backend role (the dropdown lists the roles, the successor of the Winter backend user groups). |
mailer_<group>_<snake_event> |
mailer.<group>.<event> |
One switch per mail (models.MailerSwitches), all off on a new install as in PHP. |
The plugin ships its mail as postcard templates (Plugin.MailTemplatesFS, Plugin.MailTemplates, Plugin.MailLayouts) under views/mail: one Markdown file per mail in Polish (<code>.htm) and one in English (<code>-en.htm), each with layout = "paymentgateway" (views/mail/layouts/paymentgateway.htm, golem15.paymentgateway::mail.layouts.paymentgateway). postcard checks at boot that every listed name has its file.
Template (golem15.paymentgateway::mail.…) |
Event | Switch | Recipient |
|---|---|---|---|
order.placed |
OrderPlaced |
mailer_order_placed |
customer |
order.purchased |
OrderPurchased |
mailer_order_purchased |
customer |
order.rejected |
OrderRejected |
mailer_order_rejected |
customer |
order.canceled |
OrderCanceled |
mailer_order_canceled |
customer |
order.canceledNotActive |
OrderCanceledNotActive |
mailer_order_canceled_not_active |
customer |
order.paid |
OrderPaid |
mailer_order_paid |
customer |
order.underway |
OrderUnderway |
mailer_order_underway |
customer |
order.shipped |
OrderShipped |
mailer_order_shipped |
customer |
order.finished |
OrderFinished |
mailer_order_finished |
customer |
order.requestedRefund |
OrderRequestedRefund |
mailer_order_requested_refund |
customer |
order.directRefund |
OrderDirectRefund |
mailer_order_direct_refund |
customer |
order.grantedRefund |
OrderGrantedRefund |
mailer_order_granted_refund |
customer |
order.waitingForReturn |
OrderWaitingForReturn |
mailer_order_waiting_for_return |
customer |
order.refundedAfterReturn |
OrderRefundedAfterReturn |
mailer_order_refunded_after_return |
customer |
order.deferredRefund |
OrderDeferredRefund |
mailer_order_deferred_refund |
customer |
order.guaranteeRefund |
OrderGuaranteeRefund |
mailer_order_guarantee_refund |
customer |
order.rejectedReceivedPayment |
OrderRejectedReceivedPayment |
mailer_order_rejected_received_payment |
customer |
order.employeeCreatedOrder |
EmployeeCreatedOrder |
mailer_order_employee_created_order |
customer |
admin_order.placed |
OrderPlaced, only with quotes off |
mailer_admin_order_placed |
staff |
admin_order.paid |
OrderPaid |
mailer_admin_order_paid |
staff |
admin_order.requestedRefund |
OrderRequestedRefund |
mailer_admin_order_requested_refund |
staff |
admin_order.customerCreatedOrder |
CustomerCreatedOrder, only with quotes on |
mailer_admin_order_customer_created_order |
staff |
payment.accepted, payment.canceled, payment.refunded, payment.rejected |
PaymentAccepted, PaymentCanceled, PaymentRefunded, PaymentRejected |
mailer_payment_* |
customer |
admin_payment.accepted |
PaymentAccepted |
mailer_admin_payment_accepted |
staff |
As in PHP, the order mails (customer and staff) go out only while orders_enabled is on and the payment mails (customer and staff) only while it is off. events.RegisterMailers registers the four groups (events.CustomerOrderMailer, events.EmployeeOrderMailer, events.CustomerPaymentMailer, events.EmployeePaymentMailer) as a boot step after the bridge. Every listener reads the switches through the event's transaction when the event fires, builds the message there and hands it to lagoon.AfterCommit on that transaction: a rolled-back transition sends nothing, a committed one sends once, and a send error is logged and never fails the transition.
Recipients. A customer mail goes to the user's e-mail unless it contains guest@, else to the e-mail of the order details (or of the payment data) unless it is the anonymous label golem15.paymentgateway::lang.labels.anonymous, else to nobody (events.CustomerRecipient). A staff mail goes to admin_email, else to every backend user of admin_group_id, one message each (events.StaffRecipients).
Locale. postcard selects no locale, so the mailer names the template: -en when the customer's preferred_locale is English, the Polish template otherwise; customers without a preferred locale and staff get the application locale (events.MailTemplate, events.CustomerLocale).
Variables (PHP names): order (events.OrderView: code is the order code, state the state label, total_gross and total_net formatted with support.FormatAmount, items with description, count, unit_gross, total_gross, and shipping), user (first_name, last_name, email), posName, posEmail, orderUrl (order_url_template with {hash} replaced; on staff mails the order's admin preview); the purchased mail adds manual and banking_details (name, receiverAddress, bankDetails, bankDetailsLines, swift, bankAccNo, plain text) when the order's first payment is a bank transfer; payment mails carry payment (events.PaymentView: id, uuid, state, amount, operator); staff mails carry employee and customer, and the staff payment mail paymentUrl. An application that wants different wording ships its own template files under the same codes.
Sending elsewhere. An application that publishes an events.MailSender (app.Publish[events.MailSender](...)) receives every message instead of the postcard mailer, for example to queue or copy them.
PHP bugs fixed. order.placed had a template but was never registered and had no switch; it is registered with mailer_order_placed. onOrderUnderway read the mailer.order.placed switch and sent order.underway, which had no file; order.underway now has its templates and its own switch mailer_order_underway. The customer of a guest@ user account is mailed at the details address (PHP mailed nobody).
Customer API
The headless successor of the Winter Orders component (package api, D-06), under /_paymentgateway/api/v1 and the paymentgateway-api throttle (120 requests a minute per authenticated frontend user, else per client IP; 429 is surf's {"message":"Too Many Attempts."}). Every answer is JSON through wire.WriteJSON. The contract is the one published as api-research (see the api package comment); it is one-way once a layer version or an application consumes it.
Access
An order is readable and actionable by:
- its owner: a valid frontend JWT (
Authorization: Bearer, the user plugin'sjwtguard) whose user id is the order'suser_id; - a guest code:
?guest_code=equal to the order's storedguest_code(compared in constant time); - a guest token:
?guest_token=issued bysupport.GuestTokenfor this order id, accepted only whileenable_guestis on.
api.OptionalJWT runs the jwt guard only when a Bearer header is present: an invalid, expired or revoked token is 401, no header is anonymous. Cookies are never read, so a cross-site form cannot act on an order. A guest code or token grants that one order and never becomes a user identity. An unknown order and a forbidden one both answer 404 {"error":"Order not found"}. The PHP session case ("the current order of this session") has no headless equivalent and is not ported.
Endpoints
| Method | Path | Access | Guard | Answer |
|---|---|---|---|---|
| GET | /orders |
frontend JWT (api.RequireJWT: the user plugin's jwt guard, Bearer only) |
The user's orders, newest first, 20 per page (?page=N): {data: [{hash_id, state, total, created_at}], meta: {current_page, last_page, per_page, total}} |
|
| GET | /orders/{hash} |
owner, guest code, guest token | The order | |
| GET | /payment-methods |
anyone | {data: [{code, name, logo, mode, currencies}]}: the enabled operators in registration order, name in the request locale, mode api, manual or cash, currencies the ISO codes accepted ("*" is any), logo null |
|
| GET | /shippings |
anyone | {data: [{id, name, cost, gross_cost, tax, logo, is_payable_with_cash}]}; {data: []} while shippings_enabled is off; logo is the public URL of the logotype attachment or null |
|
| POST | /orders/{hash}/payment-method |
as GET | Placed | Body {payment_method}: an enabled operator code that accepts the order currency; cash needs a delivery method payable in cash. Stored in the order details; answers the order |
| POST | /orders/{hash}/shipping |
as GET | Placed | Body {shipping_id}: shippings on, an existing row, payable in cash when cash is selected. Replaces the cart's shipping line (the net cost converted to the order currency when they differ), sets shipping_id, recomputes the totals; answers the order |
| POST | /orders/{hash}/process |
as GET | Placed | Needs a selected payment method (422 payment_method) and, while shippings are on and any exist, a delivery method (422 shipping_id). Creates the payment from the stored cart and details and sends it to the operator (D-17): {redirect_url} for a redirect (Stripe Checkout), {requires_action: true, client_secret, payment_intent_id, payment_uuid, publishable_key} for a PaymentIntent the site confirms itself, {status: "pending"} otherwise (cash and bank transfer: the order moves to AwaitingPayment). An operator error rolls everything back, so the order stays Placed, and answers 422 payment_method with the operator's message. With order_url_template set, the payment's return URL is the order page with the guest credential the request used |
| POST | /orders/{hash}/cancel |
as GET | Placed or AwaitingPayment | Placed takes Cancel; AwaitingPayment first cancels the order's open cash and bank transfer payments (the bridge cancels the order), then takes Cancel if an online operator's payment is still open; answers the order |
| POST | /orders/{hash}/refund-request |
as GET | Paid or Shipped | RequestEarlyRefund or RequestRefund; answers the order |
| POST | /orders/{hash}/items/{item}/pieces |
as GET | Placed | One more piece; answers the order |
| DELETE | /orders/{hash}/items/{item}/pieces |
as GET | Placed | One piece less, never below 1; answers the order |
| DELETE | /orders/{hash}/items/{item} |
as GET | Placed | Removes the item; the last item is refused (422 item: the customer cancels the order instead); answers the order |
Every mutation runs in one transaction on the order row locked FOR UPDATE, re-checks its guard on the locked row, re-encodes the cart as v2 and recomputes amount_stored and native_amount_stored from the stored prices. A guard that no longer applies answers 409 {"error":"Order state changed"}; an item id the cart does not hold, an unknown shipping id or method code and a malformed body answer 422 {"error":"Validation failed","errors":{field:[message]}}. The API accepts method codes, shipping ids and item ids only: never an amount, a price, a currency or a state.
Order JSON
{
"hash_id": "AbCd1234", "state": "Placed", "currency": "PLN", "native_currency": "PLN",
"total": {"amount": "49.0000", "amount_minor": 4900, "currency": "PLN"},
"total_net": {...}, "total_tax": {...}, "native_total": {...},
"items": [{"id", "description", "count", "net_price", "gross_price", "tax", "tax_value", "total_net", "total_gross"}],
"shipping": {"id", "name", "net_cost", "gross_cost", "tax"} or null,
"payment_method": "golem15.paymentgateway::lang.channels.cash" or null,
"can_edit_items": true, "can_cancel": true, "can_refund": false,
"bank_transfer": {"name", "receiver_address", "bank_acc_no", "swift", "bank_details_html"} or null,
"payments": [{"state", "operator"}],
"created_at": "2026-10-13T12:00:00+00:00"
}
Money is always {amount, amount_minor, currency}: the exact four-decimal string is the contract, amount_minor a convenience. can_edit_items is true in Placed, can_cancel in Placed and AwaitingPayment, can_refund in Paid and Shipped. bank_transfer is present only when the manual transfer operator is selected and the order is Placed or AwaitingPayment; bank_details_html is the settings column, sanitized again before it leaves. payments carries each payment's state and operator name, never its uuid or data. The projection is an allowlist: the stored cart and details, the return URL, secure details parameters, the guest code and the user id never leave the server.
Cross-origin frontends
A frontend on the same origin (a Nuxt app proxying /_paymentgateway/api/*) needs nothing more. When the frontend runs on another origin, the host's config/http.yaml cors.paths (http.cors.paths) must list _paymentgateway/api/* and cors.allowed_origins the site, so the browser may send the Authorization header and the POST and DELETE requests.
API reference
- Root package:
PluginID,NotifyBucket,APIBucket,APIPrefix,NotificationPatterns,SettingsCode,MailerSettingsCode,Plugin(Orders,Payments,Operators,PaymentOperators,Buckets,AdminFS,AdminControllers,Permissions,Navigation,FormFieldTypes,Settings,MailTemplatesFS,MailTemplates,MailLayouts), thePermission*codes,FieldTypeOrderState,FieldTypePaymentState,FieldTypeOperatorName,FieldTypeTaxRate. api: the handlersIndex,Show,PaymentMethods,Shippings,SelectPaymentMethod,SelectShipping,Process,Cancel,RefundRequest,AddPiece,RemovePiece,RemoveItem;OptionalJWT,RequireJWT,JWTGuard,GuestCodeParam,GuestTokenParam,OrdersPerPage; the JSON shapesOrderJSON,OrderSummaryJSON,ItemJSON,ShippingJSON,BankTransferJSON,PaymentJSON,MoneyJSON(NewMoneyJSON),PaymentMethodJSON,ShippingMethodJSON.controllers:AdminControllers, the controller IDs (OrdersControllerID,PaymentsControllerID,QuotesControllerID,QuoteablesControllerID,ShippingsControllerID,UsersControllerID), thePermission*codes,QuoteCartAction.money:Money,FromMinor,FromString,FromUnits,Zero,RoundingGAAP,Amount4,Stored,StoredOf,ParseAmount4,MaxNumeric12,MaxNumeric10,ErrTooPrecise,ErrOverflow,ErrCurrencyMismatch.fsm:Machine,Transition,Guard,ErrTransition.models:Order,Payment,Currency,Shipping,Quoteable,QuoteOrder,Settings,DefaultSettings,LoadSettings, theOrderState*,OrderTransition*,PaymentState*andPaymentTransition*constants,HashEncoder,SetHashids,Hashids,ErrNoHashids(the OrderAfterCreatehook writeshash_idandguest_code),OrderStateKey,PaymentStateKey,LangPrefix,FilterState,FilterOperator,FilterOptionValue; the settings forms:Settings.GetDefaultCurrencyOptions,Settings.GetExchangeRateProviderOptions,Settings.OrderURL,ValidOrderURLTemplate,MaxOrderURLTemplate,CurrencyName,SetCurrencyCatalog,SetTranslator,MailerSettings(Enabled,SetSwitch,GetAdminGroupIDOptions),DefaultMailerSettings,LoadMailerSettings,MailerSwitch,MailerSwitches,MailerSwitchByKey,MailTemplatePrefix,MailGroupOrder,MailGroupPayment,MailGroupAdminOrder,MailGroupAdminPayment,NullID,SomeID,RoleOptions,SetRoleLister.cart:Cart,Item,AdjustableItem,ValueAdjustment,PercentAdjustment,ShippingMethod,ShippingAddress,Details,NewCart,NewItem,NewDetails,Decode,DecodeDetails,DecodeLegacyCart,DecodeLegacyDetails,EncodeCart,EncodeDetails,RegisterItemType,RegisterDetailsParams,ItemTypes.operators:Operator,HasOperators,Registry,PaymentContext,Response,StatusComplete,StatusPending,StatusRequiresAction,StatusError,Cash,ManualTransfer,Disabled,CodeCash,CodeManualTransfer,CodeDisabled,ErrOperatorNotFound,ErrDuplicateCode,ErrNotificationIgnored.events: the 24 event structs (OrderPaid,PaymentAccepted, ...) and their…EventNameconstants holding the PHP class names; the mailers:RegisterMailers,MailerOwner,MailSender,CustomerOrderMailer,EmployeeOrderMailer,CustomerPaymentMailer,EmployeePaymentMailer,MailTemplate,CustomerRecipient,CustomerLocale,IsGuestEmail,AnonymousEmail,StaffRecipient,StaffRecipients,OrderView,PaymentView,OrderMailVars,UserMailVars,PlainText.orders:Service(Make,WithQuote,Find,FindByHash,Wrap,Can,PerformTransition,RequestRefund,Cancel,IsFinal,CanBeRefunded,Lock),RegisterBridge,ErrNotConfigured.payments:Service(Create,ForOrder,Purchase,Send,Accept,Reject,Cancel,Refund,Find,FindByUUID,Lock,Wrap,RecordExternal,ProcessNotification,SetConverter),Converter,NotificationURL,NotificationInput,MaxNotificationBytes,ErrAmountTooLarge,ErrUnsupportedCurrency,ErrNotFound.support:Hashids,NewHashids,Alphabet,LegacySalt,SaltConfigKey,GuestToken,NewGuestToken,DefaultTTL,Redact,RedactHeaders,RedactBody,Urlize,DeUrlize,FormatAmount,TrimAmount,FormatPercent,Locale,T,Label.currency:Converter,NewConverter,Provider,Providers,ProvidersFromConfig,NBP,Fixer,Rate,ISO,ParseRatio,ConvertWithRatio,InvertRatio.console:CancelSentPayments,CancelCreatedPayments,CancelPlacedOrders,FinishOrders,UpdateCurrencies,ImportWinterand theirRun…functions,ImportWinterFile,ReadWinterSettings,ReadWinterMailerSettings,WinterOptions,WinterReport.
Configuration
Config keys (config/config.yaml, overridable through SUMMER_GOLEM15__PAYMENTGATEWAY__<KEY>):
| Key | Default | Purpose |
|---|---|---|
golem15.paymentgateway.hashids_salt |
empty | Required; boot fails while empty. The PHP PG_HASHIDS_SALT: use the PHP value so new hash ids continue its sequence. |
golem15.paymentgateway.nbp_url |
https://api.nbp.pl/api |
NBP API root. |
golem15.paymentgateway.fixer_url |
https://exchange.viamage.com |
The Fixer-compatible endpoint the PHP plugin called. |
golem15.paymentgateway.fixer_access_key |
empty | Sent as access_key when set (fixer.io needs one). |
support.NewGuestToken is keyed with the application key (SUMMER_APP__KEY); the customer API verifies guest_token with the same key, and without one only the guest_token case is off.
The settings rows (golem15_paymentgateway_settings and golem15_paymentgateway_mailer_settings) are edited on the two settings pages; see Settings. Mail delivery uses the application's postcard configuration (mail.driver, mail.from).
Notification route
/_paymentgateway/{op}[/{mode}[/{result}]] takes any of GET, POST, PUT, PATCH and DELETE, under the paymentgateway-notify throttle (120 requests a minute per client IP) and no other middleware (no CSRF, no backend auth). {op} is the base64 of the operator code, padded or not. The handler:
- resolves only a registered and enabled operator (404
{"error":"Operator not found"}); - reads the body once, capped at 1 MiB (413), and builds the input from the query and the body; with both
modeandresultin the path,input[mode] = result; - calls
VerifyNotificationbefore any database access (403{"error":"Notification refused"}, logged); - finds the payment by the uuid the operator extracts (404
{"error":"Payment not found"}; an operator whoseExtractUUIDanswersoperators.ErrNotificationIgnoredfor an authentic notification that concerns no payment of this application gets 200{"status":"ignored"}and nothing changes, so the sender does not retry), locks itFOR UPDATEand lets the operator handle it inside one transaction; - writes the operator's response after the commit.
With log_requests on, the request and its outcome are logged through support.Redact: keys containing token, card, cvv, cvc, secret, signature, password, pin or api key (with an underscore or a dash, so an X-Api-Key header too), the Authorization, Cookie and Stripe-Signature headers, e-mail addresses and card numbers are masked.
CLI commands
| Command | Flags | Schedule | What it does | Example |
|---|---|---|---|---|
pg:cancel-sent-payments |
daily | Cancels Sent payments not updated for payment_sent_to_canceled_timeout days. Ends with Canceled N payments. |
bin/<app> pg:cancel-sent-payments |
|
pg:cancel-created-payments |
daily | Cancels Created cash, manual transfer and disabled-operator payments older than payment_created_to_canceled_timeout days (API operators' payments are kept). Ends with Canceled N payments. |
bin/<app> pg:cancel-created-payments -v |
|
pg:cancel-placed-orders |
daily | Cancels Placed orders older than order_placed_to_canceled_timeout days. Ends with Canceled N orders. |
bin/<app> pg:cancel-placed-orders |
|
pg:finish-orders |
daily | Finishes Shipped orders (shippings on) or Paid orders (FinishNoShipping) older than order_shipped_to_finished_timeout days. Ends with Finished N orders. |
bin/<app> pg:finish-orders |
|
pg:update-currencies |
--force |
every 10 minutes | Updates the ratio of every currency not updated today (all with --force) from the provider exchange_rate_provider names; NBP rows get the table number and effective date. Ends with Updated N of M currencies. |
bin/<app> pg:update-currencies --force |
paymentgateway:import-winter |
--settings <file>, --dry-run, --force |
Copies the PHP settings export onto the payment gateway and mailer settings rows in one transaction; --force replaces settings that already have a default currency. |
bin/<app> paymentgateway:import-winter --settings paymentgateway-settings.json --dry-run |
bin/<app> help <command> shows each command's long help and more examples. The commands and the plugin log through the component paymentgateway (log.components.paymentgateway in config/log.yaml).
Every command changes state through the services, so guards apply and events fire; each row is locked and re-checked in its own transaction, and a failure is logged without stopping the sweep. A timeout below one day falls back to the default.
Cutover
What an application moving from the PHP plugin does (no application cuts over in this phase):
- Rows. Copy the six
golem15_paymentgateway_*tables from MySQL to Postgres as they are. Storedcartanddetailsrows stay in the JMS shape: the legacy reader decodes them in place, and only an order the application saves again is written in v2. Nothing rewrites rows in bulk. To check the reader against an application's real rows first, export them withscripts/winter-export-orders.sql, anonymize the strings and add them as golden fixtures. - Settings. Export with
scripts/winter-export-settings.sqland runpaymentgateway:import-winter --settings paymentgateway-settings.json(--dry-runfirst). It mapsdefaultCurrency, the switches, the timeouts,exchangeRateProvider, the cash and manual transfer keys and the manual transfer fields;isSetUpis dropped (a default currency replaces the SetUp wizard) and the Stripe keys are imported bypgstripe:import-winter. The rich-text bank details are stored sanitized and the receiver address as plain text. The same run fills the mailer settings:mailer.credentials.emailand.namebecomemailer_from_emailandmailer_from_name; themailgrouppair (a JSON pair["[email protected]", "3"], an object withleft/rightorvalue, or a single value, possibly stored as a JSON string) becomesadmin_email(the part with@) andadmin_group_id(the numeric part, kept only when a backend role with that id exists, else reported, because the Winter backend group ids are not backend role ids; choose the group on the mailer page then); everymailer.<group>.<event>key ("1"/"0") sets itsmailer_<group>_<snake_event>switch, and an unknown one is reported. The two new switches (mailer_order_placed,mailer_order_underway) andorder_url_templatehave no PHP key: set them on the settings pages after the import. - Salt and key. Set
SUMMER_GOLEM15__PAYMENTGATEWAY__HASHIDS_SALTto the PHPPG_HASHIDS_SALTso new hash ids continue the PHP sequence (ids made with the legacy saltKEIOS.PAYMENTGATEWAYstill decode). Guest tokens issued by PHP verify only ifSUMMER_APP__KEYholds the PHPAPP_KEYbytes; they expire after 24 hours, so dropping them at cutover is acceptable. - Cron. Remove the five
artisan pg:*crontab lines from the PHP host; the SummerCMS scheduler runs the same command names. - Operators. Point each payment provider's notification URL at
/_paymentgateway/<base64 code>(see the operator plugin's README).
Not ported
pg:update-metadataandpg:update-orders: maintenance of the JMS metadata cache and of serialized rows. The Go reader needs neither; a renamed item type is a legacy name incart.RegisterItemType, never a bulk rewrite.- The Yahoo exchange rate provider (dead API) and the raw-card
CreditCardvalue object (cards are never handled by the application).
Dependencies
git.golem15.com/golem15/summercmsv0.4.0 (backpack, party, pact, surf, lagoon, festival, bonfire, diary, wire, compass, cabana, phrasebook, towel, bouncer, postcard, seaglass).git.golem15.com/golem15/sm-user-plugin(thegolem15.userplugin and itsUsermodel).github.com/speps/go-hashids/v2v2.0.1 (hash id parity with PHP hashids; decision note.planning/notes/2026-10-13-paymentgateway-hashids-go-hashids.mdin the framework repository).gorm.io/gorm,github.com/go-gormigrate/gormigrate/v2,github.com/jackc/pgx/v5; tests usegithub.com/testcontainers/testcontainers-go.
During development go.work replaces the framework with ../summercms.go and the user plugin with ../sm-summercmsio-app/plugins/golem15/user.
Testing
go vet ./...
go test -short ./... # the unit suites below: no Docker, no network
go test ./... # also the Postgres suites (testcontainers, needs Docker)
The framework repository's scripts/check-phase18.sh runs every suite below by name and fails on a skip, a miss or an empty run.
Unit suites (-short), per package:
| Package | Tests | What they pin |
|---|---|---|
money |
TestMoneyVectors, TestMoneyAllocate, TestMoneyRounding, TestAmount4, TestMoneyVectorsSmoke, TestAmount4ScanValue |
every MoneyRight vector, allocation remainders, half-away-from-zero rounding at two and four places, both column ceilings, no fifth decimal or exponent, an overflow panics instead of wrapping |
fsm, orders, payments |
TestFSM, TestOrderMatrix (12 states x 19 transitions, both Ship guard settings), TestPaymentMatrix (6 x 5, operator on and off) |
the PHP from-sets, guards and targets of every pair |
cart |
TestCart, TestCartTotals, TestItem, TestDetails, TestLegacyFixtures, TestCartRegistry, TestLegacyCartGoldens |
cart operations and totals, item and details rules, every legacy fixture decoded after an anonymization check and re-encoded as v2, the item-type allowlist |
operators |
TestOperatorRegistry |
registration, duplicates, the enabled filter, the built-in operators |
support |
TestHashids (24 PHP vectors, legacy-salt fallback), TestGuestToken, TestRedactor, TestFormatAmount |
ids, guest tokens bound to one order, log redaction, amount text |
currency |
TestConverter, TestCurrencyProviders |
exact ratio math and the NBP and Fixer parsers |
models |
TestFillable |
mass assignment of states, amounts, owners and hashes refused |
events |
TestEvents, TestMailers, TestBankDetailsSanitized |
the 24 event classes, recipients and mail variables, sanitized bank details |
console |
TestImportWinter, TestPGCommandsDeadline |
every imported setting and mailer key, the sweep cut-off |
api |
TestCustomerAPIAuthz |
owner, guest code and guest token access; ?login= never impersonates |
| root | TestNotificationRoute, TestNotificationSecurity, TestHashidsBoot, TestAdminPermissions, TestAdminCatalogSmoke, TestAdminFormatSmoke, TestMailCatalog |
verify-before-lookup, no boot without a salt, permissions on every controller and action |
| root | TestCommandsDocumented |
logs (never fails) each command whose help lacks a description, long help, examples or an option description (bonfire.CheckDocs) |
Postgres suites (skipped under -short): TestPaymentGatewayTracer, TestRefundBridgeSmoke, TestRefundBridge (every PaymentRefunded branch), TestOrderAndPaymentEvents (one event per transition), TestPaymentsService, TestMigrations (up, down, up and the final column set), TestPGCommands (the sweep boundaries), TestPGCommandsSmoke, TestImportWinterSmoke, TestCurrencyConverterPostgres, TestNotificationRouteSmoke, the admin smoke tests TestOrdersAdminSmoke, TestPaymentsAdminSmoke, TestShippingsAdminSmoke, TestQuoteablesAdminSmoke, TestQuotesAdminSmoke, the settings smoke tests TestPGSettingsSmoke and TestMailerSettingsSmoke, the mail tests TestMailTracer and TestMailersMatrixSmoke, and the customer API tests TestCustomerAPITracer and TestCustomerAPI. These Postgres tests live in the plugin root because the testcontainers harness lives there. The mail tests publish a recording events.MailSender that renders through the plugin's own templates.
No test reaches the network: NBP and Fixer are served by httptest.
PHP test map (D-02). Each of the 63 PHP tests of the Winter plugin (tests/unit, tests/functional, tests/security) has a Go counterpart, and that Go test names its PHP origin in a // PHP: tests/<file> <method> comment. The cart, item, details, machine, factory and payment module tests map to the cart, fsm, payments and operators suites and TestPaymentsService. The security suites map to TestFillable, TestHashids, TestRedactor, TestCartRegistry, TestBankDetailsSanitized, TestCustomerAPIAuthz, TestGuestToken, TestNotificationSecurity, TestAdminPermissions and TestOrderMatrix.
Legacy fixtures (D-11). cart/testdata/legacy/ holds the one real row, with every string replaced, and the PHP-generated synthetic rows. tests/php/gen-fixtures.php regenerates the synthetic rows from a frozen Winter installation. No host-exported shop rows were supplied (the reply at the plan 06 checkpoint was "fixtures: none"), so the synthetic shop rows stand in. Exported rows go in as shop-export-cart-<n>.json and shop-export-details-<n>.json; TestLegacyFixtures decodes them after the same anonymization check.