@aglyn/plugins-commerce 1.15.0 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +13 -13
- package/src/lib/components/cart.js +8 -3
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/console/payments-settings-card.component.js +1 -1
- package/src/lib/components/console/payments-settings-card.component.js.map +1 -1
- package/src/lib/components/console/subscription-detail-dialog.component.js +2 -2
- package/src/lib/components/console/subscription-detail-dialog.component.js.map +1 -1
- package/src/lib/components/console/subscriptions-card.component.js +4 -2
- package/src/lib/components/console/subscriptions-card.component.js.map +1 -1
- package/src/lib/components/product-detail.js +7 -3
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/quote-page-body.js +7 -3
- package/src/lib/components/quote-page-body.js.map +1 -1
- package/src/lib/components/related-products.js +6 -3
- package/src/lib/components/related-products.js.map +1 -1
- package/src/lib/components/storefront-payment-element.d.ts +7 -1
- package/src/lib/components/storefront-payment-element.js +11 -7
- package/src/lib/components/storefront-payment-element.js.map +1 -1
- package/src/lib/model/commerce-payment-methods.d.ts +26 -39
- package/src/lib/model/commerce-payment-methods.js +11 -118
- package/src/lib/model/commerce-payment-methods.js.map +1 -1
- package/src/lib/server/billing-webhook.d.ts +23 -0
- package/src/lib/server/billing-webhook.js +162 -30
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/cancel-order.js +4 -3
- package/src/lib/server/cancel-order.js.map +1 -1
- package/src/lib/server/cart-checkout.js +61 -14
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/catalog.js +58 -22
- package/src/lib/server/catalog.js.map +1 -1
- package/src/lib/server/checkout-session-expiry.d.ts +1 -1
- package/src/lib/server/checkout-session-expiry.js +19 -5
- package/src/lib/server/checkout-session-expiry.js.map +1 -1
- package/src/lib/server/checkout-status.js +4 -3
- package/src/lib/server/checkout-status.js.map +1 -1
- package/src/lib/server/checkout.js +42 -12
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/connect.js +42 -11
- package/src/lib/server/connect.js.map +1 -1
- package/src/lib/server/draft-order.js +37 -12
- package/src/lib/server/draft-order.js.map +1 -1
- package/src/lib/server/manual-tax-rate.d.ts +11 -3
- package/src/lib/server/manual-tax-rate.js +10 -6
- package/src/lib/server/manual-tax-rate.js.map +1 -1
- package/src/lib/server/native-checkout.d.ts +10 -3
- package/src/lib/server/native-checkout.js +8 -3
- package/src/lib/server/native-checkout.js.map +1 -1
- package/src/lib/server/payment-method-domains.d.ts +50 -9
- package/src/lib/server/payment-method-domains.js +150 -51
- package/src/lib/server/payment-method-domains.js.map +1 -1
- package/src/lib/server/payment-methods.js +3 -2
- package/src/lib/server/payment-methods.js.map +1 -1
- package/src/lib/server/pos-order.js +5 -1
- package/src/lib/server/pos-order.js.map +1 -1
- package/src/lib/server/pos-stripe.d.ts +7 -7
- package/src/lib/server/pos-stripe.js +15 -13
- package/src/lib/server/pos-stripe.js.map +1 -1
- package/src/lib/server/pos-terminal.js +11 -3
- package/src/lib/server/pos-terminal.js.map +1 -1
- package/src/lib/server/quote-pay.d.ts +23 -1
- package/src/lib/server/quote-pay.js +112 -32
- package/src/lib/server/quote-pay.js.map +1 -1
- package/src/lib/server/quote.d.ts +2 -1
- package/src/lib/server/quote.js +12 -11
- package/src/lib/server/quote.js.map +1 -1
- package/src/lib/server/refund.js +13 -6
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/related.js +10 -3
- package/src/lib/server/related.js.map +1 -1
- package/src/lib/server/reserve.js +19 -6
- package/src/lib/server/reserve.js.map +1 -1
- package/src/lib/server/revenue-source.d.ts +6 -0
- package/src/lib/server/revenue-source.js +25 -9
- package/src/lib/server/revenue-source.js.map +1 -1
- package/src/lib/server/seller-stripe-account.d.ts +45 -0
- package/src/lib/server/seller-stripe-account.js +99 -0
- package/src/lib/server/seller-stripe-account.js.map +1 -0
- package/src/lib/server/storefront-tax-record.js +6 -1
- package/src/lib/server/storefront-tax-record.js.map +1 -1
- package/src/lib/server/storefront-tax.d.ts +33 -2
- package/src/lib/server/storefront-tax.js +39 -3
- package/src/lib/server/storefront-tax.js.map +1 -1
- package/src/lib/server/stripe-refund.d.ts +15 -0
- package/src/lib/server/stripe-refund.js +54 -26
- package/src/lib/server/stripe-refund.js.map +1 -1
- package/src/lib/server/subscription-portal.js +8 -3
- package/src/lib/server/subscription-portal.js.map +1 -1
|
@@ -14,7 +14,7 @@ import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/ import {
|
|
17
|
+
*/ import { saleApplicationFeeCents, saleProcessingCostCents } from "@aglyn/aglyn/app-utils/plan-entitlements";
|
|
18
18
|
import { NATIVE_CHECKOUT_STRIPE_VERSION } from "./native-checkout.js";
|
|
19
19
|
/**
|
|
20
20
|
* The register's Stripe calls (AGL-3607), over raw `fetch` like every other
|
|
@@ -91,24 +91,26 @@ import { NATIVE_CHECKOUT_STRIPE_VERSION } from "./native-checkout.js";
|
|
|
91
91
|
return posStripeTestMode() || String((_process_env_STRIPE_TERMINAL_LIVE_ENABLED = process.env.STRIPE_TERMINAL_LIVE_ENABLED) != null ? _process_env_STRIPE_TERMINAL_LIVE_ENABLED : '').toLowerCase() === 'true';
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `card_present`, so no buy-now-pay-later method can be chosen and 2.9% + 30¢
|
|
100
|
-
* is at least what Stripe debits (an in-person tap costs less). The base is
|
|
94
|
+
* The card processing a register CARD payment passes through beside the
|
|
95
|
+
* platform's take (the AGL-2152 rule, on the register's tenders): 2.9% + 30¢,
|
|
96
|
+
* the same online rate a site sale passes through, on a reader's card and a
|
|
97
|
+
* typed card alike (AGL-4198). Every register card payment pins `card` or
|
|
98
|
+
* `card_present`, so no buy-now-pay-later method can be chosen. The base is
|
|
101
99
|
* the whole CHARGE, tip included, because Stripe's own fee is on the whole
|
|
102
100
|
* charge; the platform's take is not.
|
|
103
101
|
*/ export function posCardProcessingCostCents(chargeCents) {
|
|
104
|
-
|
|
105
|
-
return Math.ceil(chargeCents * CARD_PROCESSING_PERCENT / 100) + PROCESSING_FIXED_CENTS;
|
|
102
|
+
return saleProcessingCostCents(chargeCents);
|
|
106
103
|
}
|
|
107
104
|
/** The `application_fee_amount` for a register card payment. */ export function posCardApplicationFeeCents(input) {
|
|
105
|
+
var _input_inPerson;
|
|
108
106
|
// The processing half is owed even on a plan whose take is 0%: Stripe debits
|
|
109
|
-
// it from the platform on every destination charge (AGL-2071).
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
// it from the platform on every destination charge (AGL-2071). The fee never
|
|
108
|
+
// falls below what Stripe charges the platform for the payment (AGL-4198):
|
|
109
|
+
// Terminal's rate for a reader's card, the online rate for a typed card, and
|
|
110
|
+
// the payout either way, all out of the take first.
|
|
111
|
+
return saleApplicationFeeCents(input.takeShareCents, input.chargeCents, {
|
|
112
|
+
inPerson: (_input_inPerson = input.inPerson) != null ? _input_inPerson : true
|
|
113
|
+
});
|
|
112
114
|
}
|
|
113
115
|
/** A refusal Stripe sent, in words a cashier can read out. */ export function posStripeErrorMessage(body, fallback) {
|
|
114
116
|
var _ref, _ref1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/pos-stripe.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/commerce/src/lib/server/pos-stripe.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n saleApplicationFeeCents,\n saleProcessingCostCents,\n} from '@aglyn/aglyn/app-utils/plan-entitlements'\nimport { NATIVE_CHECKOUT_STRIPE_VERSION } from './native-checkout'\n\n/**\n * The register's Stripe calls (AGL-3607), over raw `fetch` like every other\n * money route in this plugin.\n *\n * ## Pinned to one API version\n *\n * The platform account's default version predates the fields this flow reads\n * — `amount_details.tip` on a PaymentIntent, a reader's `action` — so every\n * request here carries the same `Stripe-Version` the storefront Payment\n * Element pins. Webhook deliveries keep the endpoint's version, which is why\n * the webhook branch never trusts the event's object and re-reads the\n * PaymentIntent through {@link posStripe} instead.\n *\n * ## Every create is keyed\n *\n * A caller passes the idempotency key; Stripe replays the first answer for a\n * repeated key, so a lost response cannot become a second charge.\n */\nexport const POS_STRIPE_VERSION = NATIVE_CHECKOUT_STRIPE_VERSION\n\n/** The currency every register sale is in: the store charges in US dollars. */\nexport const POS_CURRENCY = 'usd'\n\nexport interface PosStripeResult<T = any> {\n ok: boolean\n status: number\n body: T & { error?: { message?: string; code?: string; type?: string } }\n}\n\n/** Form-encodes nested params the way Stripe reads them. */\nexport function posStripeForm(\n params: Record<string, string | number | boolean | undefined | null | readonly string[]>,\n): URLSearchParams {\n const form = new URLSearchParams()\n for (const [key, value] of Object.entries(params)) {\n if (value === undefined || value === null) continue\n if (Array.isArray(value)) {\n for (const item of value) form.append(`${key}[]`, String(item))\n } else {\n form.set(key, String(value))\n }\n }\n return form\n}\n\n/** One Stripe API request from the register's server routes. */\nexport async function posStripe<T = any>(\n method: 'GET' | 'POST' | 'DELETE',\n path: string,\n options: {\n params?: Record<string, string | number | boolean | undefined | null | readonly string[]>\n idempotencyKey?: string\n } = {},\n): Promise<PosStripeResult<T>> {\n const form = posStripeForm(options.params ?? {})\n const query = method === 'GET' && [...form.keys()].length ? `?${form.toString()}` : ''\n const response = await fetch(`https://api.stripe.com/v1/${path}${query}`, {\n method,\n headers: {\n Authorization: `Bearer ${process.env.STRIPE_SECRET_KEY}`,\n 'Stripe-Version': POS_STRIPE_VERSION,\n ...(method === 'POST'\n ? { 'Content-Type': 'application/x-www-form-urlencoded' }\n : {}),\n ...(options.idempotencyKey && method === 'POST'\n ? { 'Idempotency-Key': options.idempotencyKey.slice(0, 255) }\n : {}),\n },\n ...(method === 'POST' ? { body: form.toString() } : {}),\n })\n const body = (await response.json().catch(() => ({}))) as PosStripeResult<T>['body']\n return { ok: response.ok, status: response.status, body }\n}\n\n/** Whether the platform key is a test key: simulated readers only work there. */\nexport function posStripeTestMode(): boolean {\n return String(process.env.STRIPE_SECRET_KEY ?? '').startsWith('sk_test_')\n}\n\n/**\n * Whether Stripe Terminal card readers are offered at all.\n *\n * Always in test mode, where Stripe's simulated reader needs nothing turned\n * on. In live mode only once `STRIPE_TERMINAL_LIVE_ENABLED` is `true`, which\n * is set after Terminal is activated for live payments on the platform's\n * Stripe account. Until then the register and the settings hide every reader\n * control rather than offering hardware that would be refused.\n */\nexport function posTerminalAvailable(): boolean {\n if (!process.env.STRIPE_SECRET_KEY) return false\n return (\n posStripeTestMode() ||\n String(process.env.STRIPE_TERMINAL_LIVE_ENABLED ?? '').toLowerCase() === 'true'\n )\n}\n\n/**\n * The card processing a register CARD payment passes through beside the\n * platform's take (the AGL-2152 rule, on the register's tenders): 2.9% + 30¢,\n * the same online rate a site sale passes through, on a reader's card and a\n * typed card alike (AGL-4198). Every register card payment pins `card` or\n * `card_present`, so no buy-now-pay-later method can be chosen. The base is\n * the whole CHARGE, tip included, because Stripe's own fee is on the whole\n * charge; the platform's take is not.\n */\nexport function posCardProcessingCostCents(chargeCents: number): number {\n return saleProcessingCostCents(chargeCents)\n}\n\n/** The `application_fee_amount` for a register card payment. */\nexport function posCardApplicationFeeCents(input: {\n takeShareCents: number\n chargeCents: number\n /** False for a typed card or a card link, which Stripe prices as online cards. */\n inPerson?: boolean\n}): number {\n // The processing half is owed even on a plan whose take is 0%: Stripe debits\n // it from the platform on every destination charge (AGL-2071). The fee never\n // falls below what Stripe charges the platform for the payment (AGL-4198):\n // Terminal's rate for a reader's card, the online rate for a typed card, and\n // the payout either way, all out of the take first.\n return saleApplicationFeeCents(input.takeShareCents, input.chargeCents, {\n inPerson: input.inPerson ?? true,\n })\n}\n\n/** A refusal Stripe sent, in words a cashier can read out. */\nexport function posStripeErrorMessage(\n body: { error?: { message?: string; code?: string } } | undefined,\n fallback: string,\n): string {\n const code = String(body?.error?.code ?? '')\n if (code === 'terminal_reader_offline') {\n return 'The card reader is offline. Check it is on and connected to the internet.'\n }\n if (code === 'terminal_reader_busy') {\n return 'The card reader is busy with another payment. Cancel it on the reader or wait a moment.'\n }\n if (code === 'terminal_reader_timeout') {\n return 'The card reader did not answer in time. Try again.'\n }\n return String(body?.error?.message ?? '') || fallback\n}\n"],"names":["saleApplicationFeeCents","saleProcessingCostCents","NATIVE_CHECKOUT_STRIPE_VERSION","POS_STRIPE_VERSION","POS_CURRENCY","posStripeForm","params","form","URLSearchParams","key","value","Object","entries","undefined","Array","isArray","item","append","String","set","posStripe","method","path","options","query","keys","length","toString","response","fetch","headers","Authorization","process","env","STRIPE_SECRET_KEY","idempotencyKey","slice","body","json","catch","ok","status","posStripeTestMode","startsWith","posTerminalAvailable","STRIPE_TERMINAL_LIVE_ENABLED","toLowerCase","posCardProcessingCostCents","chargeCents","posCardApplicationFeeCents","input","takeShareCents","inPerson","posStripeErrorMessage","fallback","code","error","message"],"mappings":"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"}
|
|
@@ -438,9 +438,12 @@ async function assignPosReaderConfiguration(hostId, locationId, configurationId)
|
|
|
438
438
|
function paymentIntentParams(start, payment, destination, extra) {
|
|
439
439
|
var _payment_takeFeeCents;
|
|
440
440
|
const chargeCents = start.amountCents + start.tipCents;
|
|
441
|
+
const methodTypes = extra['payment_method_types'];
|
|
441
442
|
const fee = posCardApplicationFeeCents({
|
|
442
443
|
takeShareCents: Number((_payment_takeFeeCents = payment.takeFeeCents) != null ? _payment_takeFeeCents : 0),
|
|
443
|
-
chargeCents
|
|
444
|
+
chargeCents,
|
|
445
|
+
// A reader's card is in person; a typed card is an online card (AGL-4198).
|
|
446
|
+
inPerson: Array.isArray(methodTypes) && methodTypes.includes('card_present')
|
|
444
447
|
});
|
|
445
448
|
return _extends({
|
|
446
449
|
amount: chargeCents,
|
|
@@ -803,7 +806,9 @@ async function sendToReader(input) {
|
|
|
803
806
|
if (payment.checkoutSessionId || payment.status !== 'pending') return reserved;
|
|
804
807
|
const fee = posCardApplicationFeeCents({
|
|
805
808
|
takeShareCents: Number((_payment_takeFeeCents = payment.takeFeeCents) != null ? _payment_takeFeeCents : 0),
|
|
806
|
-
chargeCents: start.amountCents + start.tipCents
|
|
809
|
+
chargeCents: start.amountCents + start.tipCents,
|
|
810
|
+
// A card link is paid online, on the customer's own phone (AGL-4198).
|
|
811
|
+
inPerson: false
|
|
807
812
|
});
|
|
808
813
|
const session = await posStripe('POST', 'checkout/sessions', {
|
|
809
814
|
idempotencyKey: `pos-link:${payment.id}`,
|
|
@@ -878,9 +883,12 @@ async function sendToReader(input) {
|
|
|
878
883
|
* card processing cost on the whole amount, tip included.
|
|
879
884
|
*/ export function posCaptureFeeCents(payment, intent) {
|
|
880
885
|
var _payment_takeFeeCents, _ref;
|
|
886
|
+
const methodTypes = intent == null ? void 0 : intent.payment_method_types;
|
|
881
887
|
return posCardApplicationFeeCents({
|
|
882
888
|
takeShareCents: Number((_payment_takeFeeCents = payment.takeFeeCents) != null ? _payment_takeFeeCents : 0),
|
|
883
|
-
chargeCents: Math.max(0, Math.round(Number((_ref = intent == null ? void 0 : intent.amount) != null ? _ref : 0)))
|
|
889
|
+
chargeCents: Math.max(0, Math.round(Number((_ref = intent == null ? void 0 : intent.amount) != null ? _ref : 0))),
|
|
890
|
+
// The intent says how it was paid: a reader's card is in person (AGL-4198).
|
|
891
|
+
inPerson: !Array.isArray(methodTypes) || methodTypes.includes('card_present')
|
|
884
892
|
});
|
|
885
893
|
}
|
|
886
894
|
/**
|