@lunora/payment 1.0.0-alpha.12 → 1.0.0-alpha.14
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/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +11 -11
- package/dist/packem_shared/{LunoraPaymentError-B3hEzXSs.mjs → LunoraPaymentError-BeQlhkZj.mjs} +4 -7
- package/dist/packem_shared/{addMoney-bCcs1nyw.mjs → addMoney-jSh_7TfF.mjs} +1 -1
- package/dist/packem_shared/{applyWebhookAction-DpAqf3Lw.mjs → applyWebhookAction-CLAx4svt.mjs} +1 -1
- package/dist/packem_shared/{constantTimeEqual-CfY0jYcL.mjs → constantTimeEqual-BN5Hm31G.mjs} +1 -1
- package/dist/packem_shared/{createAdapterRegistry-BuDHFCBc.mjs → createAdapterRegistry-Ds7bx_TK.mjs} +1 -1
- package/dist/packem_shared/{createDatabasePaymentStore-bYB_HUE6.mjs → createDatabasePaymentStore-C0NUCj1H.mjs} +1 -1
- package/dist/packem_shared/{createPayment-BccfPGyw.mjs → createPayment-DP_LO7jc.mjs} +2 -2
- package/dist/packem_shared/{createPolarAdapter-CgErk9zo.mjs → createPolarAdapter-BovYiWCX.mjs} +3 -3
- package/dist/packem_shared/{createStripeAdapter-oDvMhpeX.mjs → createStripeAdapter-4a7fej3t.mjs} +2 -2
- package/dist/packem_shared/{lunoraDatabaseToPaymentDatabase-RlKX3Kcd.mjs → lunoraDatabaseToPaymentDatabase-CQQlnRCJ.mjs} +2 -2
- package/dist/packem_shared/{reconcile-CI1ukJF9.mjs → reconcile-Dtn_ErbJ.mjs} +1 -1
- package/package.json +4 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
1
2
|
import { TableDefinition } from '@lunora/server';
|
|
2
3
|
/**
|
|
3
4
|
* Core domain types for `@lunora/payment`.
|
|
@@ -516,10 +517,9 @@ interface PaymentsFromContextOptions {
|
|
|
516
517
|
declare const lunoraDatabaseToPaymentDatabase: (database: LunoraDatabaseLike) => PaymentDatabase;
|
|
517
518
|
declare const paymentsFromContext: (context: PaymentContextLike, options: PaymentsFromContextOptions) => LunoraPayment;
|
|
518
519
|
type PaymentErrorCode = "CONFIG_INVALID" | "CURRENCY_MISMATCH" | "FORBIDDEN" | "INVALID_TRANSITION" | "NOT_FOUND" | "PROVIDER_ERROR" | "WEBHOOK_SIGNATURE_INVALID" | "WEBHOOK_TIMESTAMP_INVALID";
|
|
519
|
-
/** Typed error for all `@lunora/payment` failures. `status` maps onto an HTTP response. */
|
|
520
|
-
declare class LunoraPaymentError extends
|
|
520
|
+
/** Typed error for all `@lunora/payment` failures. A `LunoraError` subclass; `status` maps onto an HTTP response. */
|
|
521
|
+
declare class LunoraPaymentError extends LunoraError {
|
|
521
522
|
readonly code: PaymentErrorCode;
|
|
522
|
-
readonly status: number;
|
|
523
523
|
constructor(code: PaymentErrorCode, message: string);
|
|
524
524
|
}
|
|
525
525
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
1
2
|
import { TableDefinition } from '@lunora/server';
|
|
2
3
|
/**
|
|
3
4
|
* Core domain types for `@lunora/payment`.
|
|
@@ -516,10 +517,9 @@ interface PaymentsFromContextOptions {
|
|
|
516
517
|
declare const lunoraDatabaseToPaymentDatabase: (database: LunoraDatabaseLike) => PaymentDatabase;
|
|
517
518
|
declare const paymentsFromContext: (context: PaymentContextLike, options: PaymentsFromContextOptions) => LunoraPayment;
|
|
518
519
|
type PaymentErrorCode = "CONFIG_INVALID" | "CURRENCY_MISMATCH" | "FORBIDDEN" | "INVALID_TRANSITION" | "NOT_FOUND" | "PROVIDER_ERROR" | "WEBHOOK_SIGNATURE_INVALID" | "WEBHOOK_TIMESTAMP_INVALID";
|
|
519
|
-
/** Typed error for all `@lunora/payment` failures. `status` maps onto an HTTP response. */
|
|
520
|
-
declare class LunoraPaymentError extends
|
|
520
|
+
/** Typed error for all `@lunora/payment` failures. A `LunoraError` subclass; `status` maps onto an HTTP response. */
|
|
521
|
+
declare class LunoraPaymentError extends LunoraError {
|
|
521
522
|
readonly code: PaymentErrorCode;
|
|
522
|
-
readonly status: number;
|
|
523
523
|
constructor(code: PaymentErrorCode, message: string);
|
|
524
524
|
}
|
|
525
525
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export { createAdapterRegistry } from './packem_shared/createAdapterRegistry-
|
|
2
|
-
export { lunoraDatabaseToPaymentDatabase, paymentsFromContext } from './packem_shared/lunoraDatabaseToPaymentDatabase-
|
|
3
|
-
export { createPayment } from './packem_shared/createPayment-
|
|
4
|
-
export { createDatabasePaymentStore } from './packem_shared/createDatabasePaymentStore-
|
|
1
|
+
export { createAdapterRegistry } from './packem_shared/createAdapterRegistry-Ds7bx_TK.mjs';
|
|
2
|
+
export { lunoraDatabaseToPaymentDatabase, paymentsFromContext } from './packem_shared/lunoraDatabaseToPaymentDatabase-CQQlnRCJ.mjs';
|
|
3
|
+
export { createPayment } from './packem_shared/createPayment-DP_LO7jc.mjs';
|
|
4
|
+
export { createDatabasePaymentStore } from './packem_shared/createDatabasePaymentStore-C0NUCj1H.mjs';
|
|
5
5
|
export { entitlementsForReference, featureNames, hasActivePrice, resolveEntitlements, usagePeriodStart } from './packem_shared/entitlementsForReference-CzZGXPoZ.mjs';
|
|
6
|
-
export { LunoraPaymentError } from './packem_shared/LunoraPaymentError-
|
|
6
|
+
export { LunoraPaymentError } from './packem_shared/LunoraPaymentError-BeQlhkZj.mjs';
|
|
7
7
|
export { default as idempotencyKey } from './packem_shared/idempotencyKey-BFzDCA7g.mjs';
|
|
8
|
-
export { addMoney, allocateMoney, compareMoney, formatMoney, fromMoneyJSON, isZeroDecimalCurrency, isZeroMoney, money, subtractMoney, toMoneyJSON, zeroMoney } from './packem_shared/addMoney-
|
|
9
|
-
export { createPolarAdapter } from './packem_shared/createPolarAdapter-
|
|
10
|
-
export { createStripeAdapter } from './packem_shared/createStripeAdapter-
|
|
11
|
-
export { reconcile } from './packem_shared/reconcile-
|
|
8
|
+
export { addMoney, allocateMoney, compareMoney, formatMoney, fromMoneyJSON, isZeroDecimalCurrency, isZeroMoney, money, subtractMoney, toMoneyJSON, zeroMoney } from './packem_shared/addMoney-jSh_7TfF.mjs';
|
|
9
|
+
export { createPolarAdapter } from './packem_shared/createPolarAdapter-BovYiWCX.mjs';
|
|
10
|
+
export { createStripeAdapter } from './packem_shared/createStripeAdapter-4a7fej3t.mjs';
|
|
11
|
+
export { reconcile } from './packem_shared/reconcile-Dtn_ErbJ.mjs';
|
|
12
12
|
export { default as paymentTables } from './packem_shared/paymentTables-DccHwWr_.mjs';
|
|
13
13
|
export { PAYMENT_TERMINAL_STATES, SUBSCRIPTION_TERMINAL_STATES, canTransitionPayment, canTransitionSubscription, nextPaymentState, nextSubscriptionState } from './packem_shared/PAYMENT_TERMINAL_STATES-DrxV0clv.mjs';
|
|
14
14
|
export { MemoryPaymentStore } from './packem_shared/MemoryPaymentStore-DvgdWa3C.mjs';
|
|
15
|
-
export { default as applyWebhookAction } from './packem_shared/applyWebhookAction-
|
|
16
|
-
export { constantTimeEqual, hmacSha256Hex, parseStripeSignatureHeader, verifyStandardWebhook, verifyStripeSignature } from './packem_shared/constantTimeEqual-
|
|
15
|
+
export { default as applyWebhookAction } from './packem_shared/applyWebhookAction-CLAx4svt.mjs';
|
|
16
|
+
export { constantTimeEqual, hmacSha256Hex, parseStripeSignatureHeader, verifyStandardWebhook, verifyStripeSignature } from './packem_shared/constantTimeEqual-BN5Hm31G.mjs';
|
package/dist/packem_shared/{LunoraPaymentError-B3hEzXSs.mjs → LunoraPaymentError-BeQlhkZj.mjs}
RENAMED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { LunoraError } from '@lunora/errors';
|
|
2
|
+
|
|
1
3
|
const STATUS_BY_CODE = {
|
|
2
4
|
CONFIG_INVALID: 500,
|
|
3
5
|
CURRENCY_MISMATCH: 400,
|
|
@@ -8,14 +10,9 @@ const STATUS_BY_CODE = {
|
|
|
8
10
|
WEBHOOK_SIGNATURE_INVALID: 400,
|
|
9
11
|
WEBHOOK_TIMESTAMP_INVALID: 400
|
|
10
12
|
};
|
|
11
|
-
class LunoraPaymentError extends
|
|
12
|
-
code;
|
|
13
|
-
status;
|
|
13
|
+
class LunoraPaymentError extends LunoraError {
|
|
14
14
|
constructor(code, message) {
|
|
15
|
-
super(message);
|
|
16
|
-
this.name = "LunoraPaymentError";
|
|
17
|
-
this.code = code;
|
|
18
|
-
this.status = STATUS_BY_CODE[code];
|
|
15
|
+
super(code, message, { name: "LunoraPaymentError", status: STATUS_BY_CODE[code] });
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toSnapshot } from 'dinero.js';
|
|
2
2
|
import { add, allocate, compare, subtract, dinero } from 'dinero.js/bigint';
|
|
3
|
-
import { LunoraPaymentError } from './LunoraPaymentError-
|
|
3
|
+
import { LunoraPaymentError } from './LunoraPaymentError-BeQlhkZj.mjs';
|
|
4
4
|
|
|
5
5
|
const ZERO_DECIMAL = /* @__PURE__ */ new Set(["BIF", "CLP", "DJF", "GNF", "JPY", "KMF", "KRW", "MGA", "PYG", "RWF", "UGX", "VND", "VUV", "XAF", "XOF", "XPF"]);
|
|
6
6
|
const THREE_DECIMAL = /* @__PURE__ */ new Set(["BHD", "IQD", "JOD", "KWD", "LYD", "OMR", "TND"]);
|
package/dist/packem_shared/{applyWebhookAction-DpAqf3Lw.mjs → applyWebhookAction-CLAx4svt.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareMoney, zeroMoney, addMoney } from './addMoney-
|
|
1
|
+
import { compareMoney, zeroMoney, addMoney } from './addMoney-jSh_7TfF.mjs';
|
|
2
2
|
import { n as notifyObserver } from './observability-CvhJ205g.mjs';
|
|
3
3
|
import { nextPaymentState, nextSubscriptionState } from './PAYMENT_TERMINAL_STATES-DrxV0clv.mjs';
|
|
4
4
|
|
package/dist/packem_shared/{constantTimeEqual-CfY0jYcL.mjs → constantTimeEqual-BN5Hm31G.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LunoraPaymentError } from './LunoraPaymentError-
|
|
1
|
+
import { LunoraPaymentError } from './LunoraPaymentError-BeQlhkZj.mjs';
|
|
2
2
|
|
|
3
3
|
const encoder = new TextEncoder();
|
|
4
4
|
const toHex = (buffer) => [...new Uint8Array(buffer)].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { money } from './addMoney-
|
|
1
|
+
import { money } from './addMoney-jSh_7TfF.mjs';
|
|
2
2
|
|
|
3
3
|
const readString = (row, key) => typeof row[key] === "string" ? row[key] : "";
|
|
4
4
|
const readOptionalString = (row, key) => typeof row[key] === "string" ? row[key] : void 0;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { usagePeriodStart, resolveEntitlements, featureNames, hasActivePrice } from './entitlementsForReference-CzZGXPoZ.mjs';
|
|
2
|
-
import { LunoraPaymentError } from './LunoraPaymentError-
|
|
2
|
+
import { LunoraPaymentError } from './LunoraPaymentError-BeQlhkZj.mjs';
|
|
3
3
|
import idempotencyKey from './idempotencyKey-BFzDCA7g.mjs';
|
|
4
4
|
import { n as notifyObserver } from './observability-CvhJ205g.mjs';
|
|
5
|
-
import applyWebhookAction from './applyWebhookAction-
|
|
5
|
+
import applyWebhookAction from './applyWebhookAction-CLAx4svt.mjs';
|
|
6
6
|
|
|
7
7
|
const jsonResponse = (body, status) => Response.json(body, { headers: { "content-type": "application/json" }, status });
|
|
8
8
|
const stripReferenceId = (metadata) => metadata && "referenceId" in metadata ? Object.fromEntries(Object.entries(metadata).filter(([key]) => key !== "referenceId")) : metadata;
|
package/dist/packem_shared/{createPolarAdapter-CgErk9zo.mjs → createPolarAdapter-BovYiWCX.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LunoraPaymentError } from './LunoraPaymentError-
|
|
1
|
+
import { LunoraPaymentError } from './LunoraPaymentError-BeQlhkZj.mjs';
|
|
2
2
|
import { a as asRecord, r as readString, b as readBoolean, c as readNumber } from './json-Db337f36.mjs';
|
|
3
|
-
import { money, zeroMoney } from './addMoney-
|
|
4
|
-
import { verifyStandardWebhook } from './constantTimeEqual-
|
|
3
|
+
import { money, zeroMoney } from './addMoney-jSh_7TfF.mjs';
|
|
4
|
+
import { verifyStandardWebhook } from './constantTimeEqual-BN5Hm31G.mjs';
|
|
5
5
|
|
|
6
6
|
const PAYMENT_STATE_BY_POLAR_ORDER_STATUS = {
|
|
7
7
|
paid: "captured",
|
package/dist/packem_shared/{createStripeAdapter-oDvMhpeX.mjs → createStripeAdapter-4a7fej3t.mjs}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import idempotencyKey from './idempotencyKey-BFzDCA7g.mjs';
|
|
2
2
|
import { a as asRecord, r as readString, c as readNumber, b as readBoolean } from './json-Db337f36.mjs';
|
|
3
|
-
import { compareMoney, money, zeroMoney } from './addMoney-
|
|
4
|
-
import { verifyStripeSignature } from './constantTimeEqual-
|
|
3
|
+
import { compareMoney, money, zeroMoney } from './addMoney-jSh_7TfF.mjs';
|
|
4
|
+
import { verifyStripeSignature } from './constantTimeEqual-BN5Hm31G.mjs';
|
|
5
5
|
|
|
6
6
|
const PAYMENT_STATE_BY_STRIPE_STATUS = {
|
|
7
7
|
canceled: "canceled",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createPayment } from './createPayment-
|
|
2
|
-
import { createDatabasePaymentStore } from './createDatabasePaymentStore-
|
|
1
|
+
import { createPayment } from './createPayment-DP_LO7jc.mjs';
|
|
2
|
+
import { createDatabasePaymentStore } from './createDatabasePaymentStore-C0NUCj1H.mjs';
|
|
3
3
|
|
|
4
4
|
const lunoraDatabaseToPaymentDatabase = (database) => {
|
|
5
5
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { compareMoney } from './addMoney-
|
|
1
|
+
import { compareMoney } from './addMoney-jSh_7TfF.mjs';
|
|
2
2
|
import { n as notifyObserver } from './observability-CvhJ205g.mjs';
|
|
3
3
|
|
|
4
4
|
const sameCurrencyAmount = (a, b) => a.currency === b.currency && compareMoney(a, b) === 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/payment",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.14",
|
|
4
4
|
"description": "Provider-agnostic payments for Lunora: Stripe-first adapter, webhook sync, and subscription/payment state machine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"billing",
|
|
@@ -47,8 +47,9 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@lunora/
|
|
51
|
-
"@lunora/
|
|
50
|
+
"@lunora/errors": "1.0.0-alpha.1",
|
|
51
|
+
"@lunora/server": "1.0.0-alpha.14",
|
|
52
|
+
"@lunora/values": "1.0.0-alpha.4",
|
|
52
53
|
"dinero.js": "2.0.2"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|