@nymbalhq/adapter-stripe 0.0.0-stage → 1.0.0
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.ts +22 -0
- package/dist/index.js +224 -0
- package/dist/index.js.map +1 -0
- package/package.json +44 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Logger, PaymentsAdapter, AdapterContext } from '@nymbalhq/types';
|
|
2
|
+
|
|
3
|
+
interface StripePaymentsConfig {
|
|
4
|
+
secretKey: string;
|
|
5
|
+
webhookSecret: string;
|
|
6
|
+
apiVersion?: string;
|
|
7
|
+
/** Override the Stripe API host (for stripe-mock style test servers). Omit in production. */
|
|
8
|
+
host?: string;
|
|
9
|
+
/** Override the Stripe API port. Only used together with `host`. */
|
|
10
|
+
port?: number;
|
|
11
|
+
/** Override the Stripe API protocol. Defaults to https when omitted. */
|
|
12
|
+
protocol?: 'http' | 'https';
|
|
13
|
+
}
|
|
14
|
+
declare function createStripePaymentsAdapter(deps: {
|
|
15
|
+
logger: Logger;
|
|
16
|
+
config: StripePaymentsConfig;
|
|
17
|
+
}): PaymentsAdapter;
|
|
18
|
+
|
|
19
|
+
/** The kernel's entry: `payments: { provider: 'stripe', config: StripePaymentsConfig }`. */
|
|
20
|
+
declare function createAdapter(ctx: AdapterContext): PaymentsAdapter;
|
|
21
|
+
|
|
22
|
+
export { type StripePaymentsConfig, createAdapter, createStripePaymentsAdapter };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { ConfigError } from "@nymbalhq/types";
|
|
3
|
+
|
|
4
|
+
// src/stripe-adapter.ts
|
|
5
|
+
import Stripe from "stripe";
|
|
6
|
+
import {
|
|
7
|
+
EVT_PAYMENT_CAPTURED,
|
|
8
|
+
EVT_PAYMENT_FAILED,
|
|
9
|
+
EVT_PAYMENT_REFUNDED,
|
|
10
|
+
PaymentError
|
|
11
|
+
} from "@nymbalhq/types";
|
|
12
|
+
function toIsoCurrency(currency) {
|
|
13
|
+
return currency.toUpperCase();
|
|
14
|
+
}
|
|
15
|
+
function mapStatus(status) {
|
|
16
|
+
switch (status) {
|
|
17
|
+
case "requires_payment_method":
|
|
18
|
+
case "requires_confirmation":
|
|
19
|
+
case "requires_action":
|
|
20
|
+
case "processing":
|
|
21
|
+
case "requires_capture":
|
|
22
|
+
case "succeeded":
|
|
23
|
+
case "canceled":
|
|
24
|
+
return status === "canceled" ? "cancelled" : status;
|
|
25
|
+
default:
|
|
26
|
+
return "failed";
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function refundStatus(status) {
|
|
30
|
+
if (status === "succeeded") return "succeeded";
|
|
31
|
+
if (status === "failed" || status === "canceled") return "failed";
|
|
32
|
+
return "pending";
|
|
33
|
+
}
|
|
34
|
+
function isDefiniteRefusal(err) {
|
|
35
|
+
const type = err?.type;
|
|
36
|
+
return type === "StripeCardError" || type === "StripeInvalidRequestError";
|
|
37
|
+
}
|
|
38
|
+
function toIntent(intent) {
|
|
39
|
+
return {
|
|
40
|
+
id: intent.id,
|
|
41
|
+
clientSecret: intent.client_secret ?? "",
|
|
42
|
+
amountMinor: intent.amount,
|
|
43
|
+
currency: toIsoCurrency(intent.currency),
|
|
44
|
+
status: mapStatus(intent.status)
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function createStripePaymentsAdapter(deps) {
|
|
48
|
+
const { logger } = deps;
|
|
49
|
+
const cfg = deps.config;
|
|
50
|
+
if (!cfg.secretKey) throw new PaymentError("not_configured", "Stripe secretKey missing");
|
|
51
|
+
if (!cfg.webhookSecret) throw new PaymentError("not_configured", "Stripe webhookSecret missing");
|
|
52
|
+
const stripeClient = new Stripe(cfg.secretKey, {
|
|
53
|
+
...cfg.apiVersion !== void 0 && {
|
|
54
|
+
apiVersion: cfg.apiVersion
|
|
55
|
+
},
|
|
56
|
+
...cfg.host !== void 0 && { host: cfg.host },
|
|
57
|
+
...cfg.port !== void 0 && { port: cfg.port },
|
|
58
|
+
...cfg.protocol !== void 0 && { protocol: cfg.protocol }
|
|
59
|
+
});
|
|
60
|
+
return {
|
|
61
|
+
kind: "payments",
|
|
62
|
+
providerName: "stripe",
|
|
63
|
+
capabilities: () => ["intent", "capture", "refund", "webhook"],
|
|
64
|
+
producesEvents: [EVT_PAYMENT_CAPTURED, EVT_PAYMENT_FAILED, EVT_PAYMENT_REFUNDED],
|
|
65
|
+
consumesEvents: [],
|
|
66
|
+
async initialize() {
|
|
67
|
+
},
|
|
68
|
+
async healthCheck() {
|
|
69
|
+
try {
|
|
70
|
+
await stripeClient.balance.retrieve();
|
|
71
|
+
return { status: "healthy" };
|
|
72
|
+
} catch (err) {
|
|
73
|
+
return {
|
|
74
|
+
status: "down",
|
|
75
|
+
detail: err instanceof Error ? err.message : String(err)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
async createPaymentIntent(params) {
|
|
80
|
+
try {
|
|
81
|
+
const intent = await stripeClient.paymentIntents.create({
|
|
82
|
+
amount: params.amountMinor,
|
|
83
|
+
currency: params.currency.toLowerCase(),
|
|
84
|
+
automatic_payment_methods: { enabled: true },
|
|
85
|
+
...params.receiptEmail !== void 0 && { receipt_email: params.receiptEmail },
|
|
86
|
+
metadata: {
|
|
87
|
+
...params.metadata ?? {},
|
|
88
|
+
...params.orderRef !== void 0 ? { orderRef: params.orderRef } : {},
|
|
89
|
+
...params.customerId !== void 0 ? { customerId: params.customerId } : {}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
return toIntent(intent);
|
|
93
|
+
} catch (err) {
|
|
94
|
+
throw new PaymentError("intent_failed", "Stripe createPaymentIntent failed", { cause: err });
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
async capturePayment(intentId, amountMinor) {
|
|
98
|
+
try {
|
|
99
|
+
const captured = await stripeClient.paymentIntents.capture(intentId, {
|
|
100
|
+
...amountMinor !== void 0 && { amount_to_capture: amountMinor }
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
paymentId: captured.id,
|
|
104
|
+
capturedAmountMinor: captured.amount_received ?? captured.amount,
|
|
105
|
+
currency: toIsoCurrency(captured.currency),
|
|
106
|
+
status: mapStatus(captured.status)
|
|
107
|
+
};
|
|
108
|
+
} catch (err) {
|
|
109
|
+
throw new PaymentError("capture_failed", "Stripe capturePayment failed", { cause: err });
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
async refund(paymentId, amountMinor, reason, opts) {
|
|
113
|
+
const params = {
|
|
114
|
+
payment_intent: paymentId,
|
|
115
|
+
...amountMinor !== void 0 && { amount: amountMinor },
|
|
116
|
+
...reason !== void 0 && { reason }
|
|
117
|
+
};
|
|
118
|
+
try {
|
|
119
|
+
const refund = opts?.idempotencyKey === void 0 ? await stripeClient.refunds.create(params) : await stripeClient.refunds.create(params, { idempotencyKey: opts.idempotencyKey });
|
|
120
|
+
return {
|
|
121
|
+
refundId: refund.id,
|
|
122
|
+
paymentId,
|
|
123
|
+
amountMinor: refund.amount,
|
|
124
|
+
currency: toIsoCurrency(refund.currency),
|
|
125
|
+
reason: refund.reason ?? null,
|
|
126
|
+
status: refundStatus(refund.status)
|
|
127
|
+
};
|
|
128
|
+
} catch (err) {
|
|
129
|
+
if (isDefiniteRefusal(err)) {
|
|
130
|
+
throw new PaymentError("refund_rejected", "Stripe refused the refund", { cause: err });
|
|
131
|
+
}
|
|
132
|
+
throw new PaymentError("refund_unknown", "Stripe refund outcome unknown", { cause: err });
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
async getPaymentStatus(intentId) {
|
|
136
|
+
const intent = await stripeClient.paymentIntents.retrieve(intentId);
|
|
137
|
+
return mapStatus(intent.status);
|
|
138
|
+
},
|
|
139
|
+
async getPaymentIntent(intentId) {
|
|
140
|
+
try {
|
|
141
|
+
return toIntent(await stripeClient.paymentIntents.retrieve(intentId));
|
|
142
|
+
} catch (err) {
|
|
143
|
+
throw new PaymentError("intent_failed", "Stripe getPaymentIntent failed", { cause: err });
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
async cancelPaymentIntent(intentId) {
|
|
147
|
+
try {
|
|
148
|
+
await stripeClient.paymentIntents.cancel(intentId);
|
|
149
|
+
} catch (err) {
|
|
150
|
+
const status = await stripeClient.paymentIntents.retrieve(intentId).then((intent) => intent.status).catch(() => void 0);
|
|
151
|
+
if (status === "canceled") return;
|
|
152
|
+
throw new PaymentError("cancel_refused", `Stripe would not cancel ${intentId}`, {
|
|
153
|
+
cause: err
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
async parseWebhook(rawBody, signature) {
|
|
158
|
+
let event;
|
|
159
|
+
try {
|
|
160
|
+
event = stripeClient.webhooks.constructEvent(rawBody, signature, cfg.webhookSecret);
|
|
161
|
+
} catch (err) {
|
|
162
|
+
throw new PaymentError("webhook_invalid", "Stripe webhook signature invalid", {
|
|
163
|
+
cause: err
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
const baseResult = { verified: true, eventId: event.id };
|
|
167
|
+
switch (event.type) {
|
|
168
|
+
case "payment_intent.succeeded": {
|
|
169
|
+
const intent = event.data.object;
|
|
170
|
+
return {
|
|
171
|
+
...baseResult,
|
|
172
|
+
kind: "payment.captured",
|
|
173
|
+
paymentIntentId: intent.id,
|
|
174
|
+
amountMinor: intent.amount_received ?? intent.amount,
|
|
175
|
+
currency: toIsoCurrency(intent.currency),
|
|
176
|
+
raw: { ...intent }
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
case "payment_intent.payment_failed": {
|
|
180
|
+
const intent = event.data.object;
|
|
181
|
+
return {
|
|
182
|
+
...baseResult,
|
|
183
|
+
kind: "payment.failed",
|
|
184
|
+
paymentIntentId: intent.id,
|
|
185
|
+
reason: intent.last_payment_error?.message ?? "payment failed"
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
case "charge.refunded": {
|
|
189
|
+
const charge = event.data.object;
|
|
190
|
+
const pi = typeof charge.payment_intent === "string" ? charge.payment_intent : charge.payment_intent?.id;
|
|
191
|
+
return {
|
|
192
|
+
...baseResult,
|
|
193
|
+
kind: "payment.refunded",
|
|
194
|
+
...pi !== void 0 && { paymentIntentId: pi },
|
|
195
|
+
amountMinor: charge.amount_refunded,
|
|
196
|
+
currency: toIsoCurrency(charge.currency)
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
default:
|
|
200
|
+
logger.debug({ type: event.type }, "stripe webhook ignored");
|
|
201
|
+
return { ...baseResult, kind: "ignored" };
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/index.ts
|
|
208
|
+
function createAdapter(ctx) {
|
|
209
|
+
if (ctx.slot !== "payments") {
|
|
210
|
+
throw new ConfigError(`@nymbalhq/adapter-stripe serves payments, not ${ctx.slot}`, {
|
|
211
|
+
code: "adapter.wrong_slot",
|
|
212
|
+
context: { slot: ctx.slot }
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return createStripePaymentsAdapter({
|
|
216
|
+
logger: ctx.logger,
|
|
217
|
+
config: ctx.config
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
export {
|
|
221
|
+
createAdapter,
|
|
222
|
+
createStripePaymentsAdapter
|
|
223
|
+
};
|
|
224
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/stripe-adapter.ts"],"sourcesContent":["import { ConfigError, type AdapterContext, type PaymentsAdapter } from '@nymbalhq/types'\nimport { createStripePaymentsAdapter, type StripePaymentsConfig } from './stripe-adapter.js'\n\nexport { createStripePaymentsAdapter, type StripePaymentsConfig }\n\n/** The kernel's entry: `payments: { provider: 'stripe', config: StripePaymentsConfig }`. */\nexport function createAdapter(ctx: AdapterContext): PaymentsAdapter {\n if (ctx.slot !== 'payments') {\n throw new ConfigError(`@nymbalhq/adapter-stripe serves payments, not ${ctx.slot}`, {\n code: 'adapter.wrong_slot',\n context: { slot: ctx.slot },\n })\n }\n return createStripePaymentsAdapter({\n logger: ctx.logger,\n config: ctx.config as unknown as StripePaymentsConfig,\n })\n}\n","import Stripe from 'stripe'\nimport {\n EVT_PAYMENT_CAPTURED,\n EVT_PAYMENT_FAILED,\n EVT_PAYMENT_REFUNDED,\n PaymentError,\n type Logger,\n type PaymentCapture,\n type PaymentIntent,\n type PaymentIntentParams,\n type PaymentStatus,\n type PaymentsAdapter,\n type Refund,\n type WebhookResult,\n} from '@nymbalhq/types'\n\nexport interface StripePaymentsConfig {\n secretKey: string\n webhookSecret: string\n apiVersion?: string\n /** Override the Stripe API host (for stripe-mock style test servers). Omit in production. */\n host?: string\n /** Override the Stripe API port. Only used together with `host`. */\n port?: number\n /** Override the Stripe API protocol. Defaults to https when omitted. */\n protocol?: 'http' | 'https'\n}\n\n/**\n * Stripe returns lowercase ISO currency codes (e.g. \"gbp\"); Nymbal's canonical\n * currency format is uppercase ISO 4217 (e.g. \"GBP\") everywhere else in the\n * domain, so adapter results are normalised on the way out.\n */\nfunction toIsoCurrency(currency: string): string {\n return currency.toUpperCase()\n}\n\nfunction mapStatus(status: Stripe.PaymentIntent.Status): PaymentStatus {\n switch (status) {\n case 'requires_payment_method':\n case 'requires_confirmation':\n case 'requires_action':\n case 'processing':\n case 'requires_capture':\n case 'succeeded':\n case 'canceled':\n return status === 'canceled' ? 'cancelled' : (status as PaymentStatus)\n default:\n return 'failed'\n }\n}\n\nfunction refundStatus(status: string | null): Refund['status'] {\n if (status === 'succeeded') return 'succeeded'\n if (status === 'failed' || status === 'canceled') return 'failed'\n return 'pending'\n}\n\n/**\n * Stripe refused the refund outright (a card error, an invalid request): no money moved. Anything else (an API error,\n * a timeout, a dropped connection) leaves the outcome unknown.\n */\nfunction isDefiniteRefusal(err: unknown): boolean {\n const type = (err as { type?: unknown } | null)?.type\n return type === 'StripeCardError' || type === 'StripeInvalidRequestError'\n}\n\nfunction toIntent(intent: Stripe.PaymentIntent): PaymentIntent {\n return {\n id: intent.id,\n clientSecret: intent.client_secret ?? '',\n amountMinor: intent.amount,\n currency: toIsoCurrency(intent.currency),\n status: mapStatus(intent.status),\n }\n}\n\nexport function createStripePaymentsAdapter(deps: {\n logger: Logger\n config: StripePaymentsConfig\n}): PaymentsAdapter {\n const { logger } = deps\n const cfg = deps.config\n if (!cfg.secretKey) throw new PaymentError('not_configured', 'Stripe secretKey missing')\n if (!cfg.webhookSecret) throw new PaymentError('not_configured', 'Stripe webhookSecret missing')\n const stripeClient = new Stripe(cfg.secretKey, {\n ...(cfg.apiVersion !== undefined && {\n apiVersion: cfg.apiVersion as Stripe.LatestApiVersion,\n }),\n ...(cfg.host !== undefined && { host: cfg.host }),\n ...(cfg.port !== undefined && { port: cfg.port }),\n ...(cfg.protocol !== undefined && { protocol: cfg.protocol }),\n })\n return {\n kind: 'payments',\n providerName: 'stripe',\n capabilities: () => ['intent', 'capture', 'refund', 'webhook'],\n producesEvents: [EVT_PAYMENT_CAPTURED, EVT_PAYMENT_FAILED, EVT_PAYMENT_REFUNDED],\n consumesEvents: [],\n async initialize() {\n // no-op: Stripe client already constructed\n },\n async healthCheck() {\n try {\n await stripeClient.balance.retrieve()\n return { status: 'healthy' }\n } catch (err) {\n return {\n status: 'down',\n detail: err instanceof Error ? err.message : String(err),\n }\n }\n },\n async createPaymentIntent(params: PaymentIntentParams): Promise<PaymentIntent> {\n try {\n const intent = await stripeClient.paymentIntents.create({\n amount: params.amountMinor,\n currency: params.currency.toLowerCase(),\n automatic_payment_methods: { enabled: true },\n ...(params.receiptEmail !== undefined && { receipt_email: params.receiptEmail }),\n metadata: {\n ...(params.metadata ?? {}),\n ...(params.orderRef !== undefined ? { orderRef: params.orderRef } : {}),\n ...(params.customerId !== undefined ? { customerId: params.customerId } : {}),\n },\n })\n return toIntent(intent)\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe createPaymentIntent failed', { cause: err })\n }\n },\n async capturePayment(intentId, amountMinor): Promise<PaymentCapture> {\n try {\n const captured = await stripeClient.paymentIntents.capture(intentId, {\n ...(amountMinor !== undefined && { amount_to_capture: amountMinor }),\n })\n return {\n paymentId: captured.id,\n capturedAmountMinor: captured.amount_received ?? captured.amount,\n currency: toIsoCurrency(captured.currency),\n status: mapStatus(captured.status),\n }\n } catch (err) {\n throw new PaymentError('capture_failed', 'Stripe capturePayment failed', { cause: err })\n }\n },\n async refund(paymentId, amountMinor, reason, opts): Promise<Refund> {\n const params: Stripe.RefundCreateParams = {\n payment_intent: paymentId,\n ...(amountMinor !== undefined && { amount: amountMinor }),\n ...(reason !== undefined && { reason: reason as Stripe.RefundCreateParams.Reason }),\n }\n try {\n const refund =\n opts?.idempotencyKey === undefined\n ? await stripeClient.refunds.create(params)\n : await stripeClient.refunds.create(params, { idempotencyKey: opts.idempotencyKey })\n return {\n refundId: refund.id,\n paymentId,\n amountMinor: refund.amount,\n currency: toIsoCurrency(refund.currency),\n reason: refund.reason ?? null,\n status: refundStatus(refund.status),\n }\n } catch (err) {\n if (isDefiniteRefusal(err)) {\n throw new PaymentError('refund_rejected', 'Stripe refused the refund', { cause: err })\n }\n throw new PaymentError('refund_unknown', 'Stripe refund outcome unknown', { cause: err })\n }\n },\n async getPaymentStatus(intentId): Promise<PaymentStatus> {\n const intent = await stripeClient.paymentIntents.retrieve(intentId)\n return mapStatus(intent.status)\n },\n async getPaymentIntent(intentId): Promise<PaymentIntent> {\n try {\n return toIntent(await stripeClient.paymentIntents.retrieve(intentId))\n } catch (err) {\n throw new PaymentError('intent_failed', 'Stripe getPaymentIntent failed', { cause: err })\n }\n },\n async cancelPaymentIntent(intentId): Promise<void> {\n try {\n await stripeClient.paymentIntents.cancel(intentId)\n } catch (err) {\n // A cancel that lost a race with an earlier one of ours is done; anything else (processing, captured) stays.\n const status = await stripeClient.paymentIntents\n .retrieve(intentId)\n .then((intent) => intent.status)\n .catch(() => undefined)\n if (status === 'canceled') return\n throw new PaymentError('cancel_refused', `Stripe would not cancel ${intentId}`, {\n cause: err,\n })\n }\n },\n async parseWebhook(rawBody, signature): Promise<WebhookResult> {\n let event: Stripe.Event\n try {\n event = stripeClient.webhooks.constructEvent(rawBody, signature, cfg.webhookSecret)\n } catch (err) {\n throw new PaymentError('webhook_invalid', 'Stripe webhook signature invalid', {\n cause: err,\n })\n }\n const baseResult = { verified: true, eventId: event.id } as const\n switch (event.type) {\n case 'payment_intent.succeeded': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.captured',\n paymentIntentId: intent.id,\n amountMinor: intent.amount_received ?? intent.amount,\n currency: toIsoCurrency(intent.currency),\n raw: { ...intent } as unknown as Record<string, unknown>,\n }\n }\n case 'payment_intent.payment_failed': {\n const intent = event.data.object as Stripe.PaymentIntent\n return {\n ...baseResult,\n kind: 'payment.failed',\n paymentIntentId: intent.id,\n reason: intent.last_payment_error?.message ?? 'payment failed',\n }\n }\n case 'charge.refunded': {\n const charge = event.data.object as Stripe.Charge\n const pi =\n typeof charge.payment_intent === 'string'\n ? charge.payment_intent\n : charge.payment_intent?.id\n return {\n ...baseResult,\n kind: 'payment.refunded',\n ...(pi !== undefined && { paymentIntentId: pi }),\n amountMinor: charge.amount_refunded,\n currency: toIsoCurrency(charge.currency),\n }\n }\n default:\n logger.debug({ type: event.type }, 'stripe webhook ignored')\n return { ...baseResult, kind: 'ignored' }\n }\n },\n }\n}\n"],"mappings":";AAAA,SAAS,mBAA8D;;;ACAvE,OAAO,YAAY;AACnB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OASK;AAmBP,SAAS,cAAc,UAA0B;AAC/C,SAAO,SAAS,YAAY;AAC9B;AAEA,SAAS,UAAU,QAAoD;AACrE,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,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,YACL,GAAG;AAAA,YACH,MAAM;AAAA,YACN,GAAI,OAAO,UAAa,EAAE,iBAAiB,GAAG;AAAA,YAC9C,aAAa,OAAO;AAAA,YACpB,UAAU,cAAc,OAAO,QAAQ;AAAA,UACzC;AAAA,QACF;AAAA,QACA;AACE,iBAAO,MAAM,EAAE,MAAM,MAAM,KAAK,GAAG,wBAAwB;AAC3D,iBAAO,EAAE,GAAG,YAAY,MAAM,UAAU;AAAA,MAC5C;AAAA,IACF;AAAA,EACF;AACF;;;ADnPO,SAAS,cAAc,KAAsC;AAClE,MAAI,IAAI,SAAS,YAAY;AAC3B,UAAM,IAAI,YAAY,iDAAiD,IAAI,IAAI,IAAI;AAAA,MACjF,MAAM;AAAA,MACN,SAAS,EAAE,MAAM,IAAI,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AACA,SAAO,4BAA4B;AAAA,IACjC,QAAQ,IAAI;AAAA,IACZ,QAAQ,IAAI;AAAA,EACd,CAAC;AACH;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymbalhq/adapter-stripe",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Stripe payments for Nymbal: the `stripe` payments provider",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/nymbalhq/nymbal.git",
|
|
9
|
+
"directory": "packages/adapter-stripe"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"import": "./dist/index.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"dist"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@nymbalhq/types": "1.0.0"
|
|
31
|
+
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"stripe": "^17.4.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"fast-check": "^4.10.2",
|
|
37
|
+
"stripe": "^17.4.0",
|
|
38
|
+
"tsup": "^8.3.5",
|
|
39
|
+
"typescript": "^5.6.3",
|
|
40
|
+
"vitest": "^3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"dev": "tsup --watch",
|
|
45
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
46
|
+
}
|
|
6
47
|
}
|
package/README.md
DELETED