metatrondelivery/extensions/payment-customization
metatroncubeswdev c1494cfa52
Some checks failed
CI / Lint, Unit & Integration Tests (push) Has been cancelled
fix: real checkout-datetime version/capability fix + payment-customization schema
checkout-datetime (re-enabled, no longer excluded):
- api_version was declared as "2025-10" but @shopify/ui-extensions-react
  has no release for that channel at all (jumps 2025.7.4 -> 2026.0.0
  directly) — downgraded to "2025-07" to match what's actually installed
  and what the code was written/typed against. Verified all three targets
  (purchase.checkout.block.render, purchase.thank-you.block.render,
  customer-account.order-status.block.render) exist in that package
  version before making the change.
- [extensions.capabilities] network_access was missing entirely (dropped
  during the multi-pin-pickup rewrite) despite Checkout.jsx's authedFetch()
  genuinely needing it — the checkout sandbox would have silently blocked
  every fetch() call at runtime even though it deployed fine.
- OrderStatus.jsx imported reactExtension/BlockStack/Heading/Text/
  useTranslate from the *checkout* surface behind a "might not be in the
  type definition" @ts-ignore, for a *customer-account* target. Verified
  @shopify/ui-extensions-react/customer-account re-exports the same
  component names for real and switched the import, removing the
  @ts-ignore entirely — it now typechecks for real instead of being
  suppressed.
- lib.js's shared useConfirmationText() hardcoded useTranslate/
  useAttributes from the checkout surface, but was called from both
  ThankYou.jsx (checkout) and OrderStatus.jsx (customer-account) — hooks
  are bound to their surface's React context, so calling checkout-bound
  hooks from a customer-account extension would break at runtime even
  though nothing caught it statically. Changed it to a plain function
  (confirmationText) taking translate/attributes as parameters; each
  caller now calls its own surface's hooks and passes the results in.

payment-customization: schema.graphql never existed (not gitignored,
just never fetched/committed when this extension was added — HANDOVER.md's
note that this was "by design" was wrong). Fetched via
`shopify app function schema` and committed, matching the pattern already
used by validation-slot/delivery-customization.

Together these three issues were silently failing every single
`shopify app deploy` for the whole app, which is why shopify.app.toml's
App Proxy URL fix never actually reached Shopify's servers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 23:44:37 -04:00
..

payment-customization

Shopify Function (cart.payment-methods.transform.run) that hides cash-on-delivery / pay-in-store payment methods when the shopper's chosen fulfillment method is SHIPPING (study §5.2 parity).

Pure decision logic lives in src/evaluate.js and is unit-tested at the repo root (tests/unit/payment-customization.test.ts) with plain Vitest — no WASM build needed for that.

Before first build / deploy

schema.graphql and generated/ are not committed (they're produced by codegen and gitignored, same as the other Function extensions). Run:

npm --prefix extensions/payment-customization run typegen

to pull the API schema and regenerate generated/api.ts, then shopify app deploy picks it up. The extension also needs the write_payment_customizations scope, which shopify.app.toml already requests, and the merchant must activate it under Settings → Payments → Payment method customizations in the admin.