Files
summercms/.planning/phases/18-payment-gateway/18-DISCUSSION-LOG.md

130 lines
5.5 KiB
Markdown

# Phase 18: Payment Gateway - Discussion Log
> **Audit trail only.** Do not use as input to planning, research, or execution agents.
> Decisions are captured in CONTEXT.md — this log preserves the alternatives considered.
**Date:** 2026-10-09
**Phase:** 18-payment-gateway
**Areas discussed:** Subscriptions & acceptance, Feature scope of the port, Money representation, Stripe integration shape
---
## Subscriptions & acceptance
| Option | Description | Selected |
|--------|-------------|----------|
| Separate 18.1 | P18 ports paymentgateway and pgstripe without subscriptions; 18.1 ports subscriptions | ✓ |
| All in Phase 18 | Port all three plugins in one phase | |
| In 18, as the last wave | Same phase, subscription plans last | |
| Option | Description | Selected |
|--------|-------------|----------|
| Test host in the plugin | Test-only host with a fake consumer, testcontainers Postgres, Stripe httptest fake | ✓ |
| Skeleton sm-horoskopia-app | Start the Horoskopia Go app now | |
| Existing app (summercms.io) | Mount in sm-summercmsio-app | |
| Option | Description | Selected |
|--------|-------------|----------|
| Both paths | Operator PaymentIntent path plus the consumer-driven Checkout path | ✓ |
| Operator path only | | |
| Consumer path only | | |
| Option | Description | Selected |
|--------|-------------|----------|
| Horoskopia's checkout | pg 4b9ecf9, pgstripe 8b47457 v1.0.1 | ✓ |
| Latest origin/master at plan time | | |
| Starter 'upgrade' branch | 96b6aa6 (older) | |
**Notes:** We found that Horoskopia creates Stripe Checkout Sessions itself and handles its own webhook, beside the PaymentIntent-based operator.
---
## Feature scope of the port
| Option | Description | Selected |
|--------|-------------|----------|
| Port all 1:1 | Quotes, Shippings, Currencies with NBP included | ✓ |
| Schema 1:1, features later | | |
| Horoskopia subset only | | |
| Option | Description | Selected |
|--------|-------------|----------|
| Headless customer order API | /_paymentgateway/api/v1 mirroring the Orders component handlers | |
| Defer, Go API only | | |
| API plus a Nuxt layer | API plus vue-paymentgateway-layer | ✓ |
| Option | Description | Selected |
|--------|-------------|----------|
| Generic cabana `money` field | Framework first; TaxWidget becomes a dropdown/number | ✓ |
| Both as cabana field types | | |
| Plugin-local SPA widgets | | |
| Option | Description | Selected |
|--------|-------------|----------|
| Postcard Markdown, same keys | EN+PL; MailerSettings as a settings page; SetUp wizard as a settings default | ✓ |
| Keep HTML bodies verbatim | | |
| You decide | | |
**Notes:** The user asked whether cabana lets plugins register their own field types, as WinterCMS does. It doesn't: the type set is closed, and `type: widget` is valueless. This was captured as the major todo `cabana-plugin-registered-field-types.md`, since plugins to be ported soon ship their own fields.
---
## Money representation
| Option | Description | Selected |
|--------|-------------|----------|
| int64 minor units + currency | Mirrors moneyphp, no new dependency | ✓ |
| shopspring/decimal | New dependency | |
| You decide | | |
| Option | Description | Selected |
|--------|-------------|----------|
| Byte-compatible JMS shape | Rollback to PHP stays possible | |
| Read PHP shape, write a Go shape | Tolerant legacy reader, new Go shape | ✓ (with guardrails) |
| Migrate on import | | |
**User's choice:** "There was a reason we picked JMS serializer. I'd go with 2, if it's safe and correct for the future of this payment plugin." After the JMS rationale was explained (app-swappable Cart/Details subclasses, metadata dirs), the user confirmed option 2 with four guardrails: a versioned v2 shape, a permanent legacy reader with golden fixtures, a typed extension registry replacing setCartClass and metadata, and one-way rollback documented. A rewrite migration and the byte-compatible fallback were offered and not chosen.
| Option | Description | Selected |
|--------|-------------|----------|
| Exact scanner/valuer | decimal(12,4) major units ↔ int64 minor, no float | ✓ |
| You decide | | |
---
## Stripe integration shape
| Option | Description | Selected |
|--------|-------------|----------|
| stripe-go official SDK | Named as the decided dependency | ✓ |
| Hand-rolled net/http client | | |
| Option | Description | Selected |
|--------|-------------|----------|
| No, port the operator 1:1 | Checkout mode deferred | |
| Yes, add a Checkout mode | New behavior beyond PHP | ✓ |
| Option | Description | Selected |
|--------|-------------|----------|
| Encrypted settings + config fallback | lagoon.Encrypted, test/live, write-only, Laravel decrypt on import | ✓ |
| Config/env only | | |
| Option | Description | Selected |
|--------|-------------|----------|
| Process response, Checkout first | redirect_url or client_secret+publishable_key | ✓ |
| Checkout only in the layer | | |
| Separate keys endpoint | | |
**Notes:** The user asked how Horoskopia handled keys without Winter components. It never needed the publishable key: the backend returns `checkout_url` and the Nuxt app redirects (`vue-horoskopia-app/app/stores/book.ts`).
---
## Claude's Discretion
- Identifier names, the customer API's JSON field names and authorization details, where the Money type lives, the conga scheduling of the `pg:*` commands, typed event shapes, plan count and split, and whether to run the security review (yes).
## Deferred Ideas
- Phase 18.1: Payment Gateway Subscriptions.
- Plugin-registered value-bearing cabana field types (todo created).