@ambushsoftworks/nestjs-payments-graphql 0.2.0 → 0.3.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/CHANGELOG.md +33 -0
- package/README.md +171 -2
- package/dist/exceptions/index.d.ts +12 -0
- package/dist/exceptions/index.js +27 -1
- package/dist/exceptions/index.js.map +1 -1
- package/dist/gateways/gateway-registry.service.d.ts +5 -0
- package/dist/gateways/gateway-registry.service.js +9 -0
- package/dist/gateways/gateway-registry.service.js.map +1 -1
- package/dist/gateways/payment-gateway.interface.d.ts +23 -0
- package/dist/gateways/stripe/stripe.gateway.d.ts +16 -2
- package/dist/gateways/stripe/stripe.gateway.js +235 -1
- package/dist/gateways/stripe/stripe.gateway.js.map +1 -1
- package/dist/gateways/stripe/types.d.ts +13 -0
- package/dist/gateways/stripe/types.js +12 -1
- package/dist/gateways/stripe/types.js.map +1 -1
- package/dist/index.d.ts +8 -4
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces/payment-repository.interface.d.ts +1 -0
- package/dist/models/inline-payment-intent.model.d.ts +10 -0
- package/dist/models/inline-payment-intent.model.js +49 -0
- package/dist/models/inline-payment-intent.model.js.map +1 -0
- package/dist/models/payment-intent-status.enum.d.ts +7 -0
- package/dist/models/payment-intent-status.enum.js +12 -0
- package/dist/models/payment-intent-status.enum.js.map +1 -0
- package/dist/models/stripe-public-config.model.d.ts +3 -0
- package/dist/models/stripe-public-config.model.js +24 -0
- package/dist/models/stripe-public-config.model.js.map +1 -0
- package/dist/payments.module.d.ts +1 -0
- package/dist/payments.module.js +1 -1
- package/dist/payments.module.js.map +1 -1
- package/dist/register-payment-enums.js +2 -0
- package/dist/register-payment-enums.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.0] - 2026-05-28
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **`PaymentGateway.createPaymentIntent(params)`** — new (optional) interface method. Returns `{ providerPaymentId, clientSecret, status, reused, providerStatus? }` for an inline payment flow (Stripe Elements / `flutter_stripe` / equivalents). The Stripe implementation reuses an existing PaymentIntent when the consumer's payment repository has a still-confirmable PENDING row for the same invoice (via the new optional `IPaymentRepository.findReusablePendingByInvoiceId`). Idempotent on the Stripe side via a stable `idempotencyKey` per `(invoiceId, attemptId)`; pass a request-scoped UUID as `attemptId` for the most robust idempotency, or omit and the gateway falls back to invoice-only. Non-Stripe gateways without an implementation throw `PaymentIntentOperationNotSupportedException`. Use `GatewayRegistryService.getInlineCapable('stripe')` to obtain a type-narrowed gateway where the methods are non-optional.
|
|
14
|
+
- **`PaymentGateway.cancelPaymentIntent(providerPaymentId)`** — new (optional) interface method. Cancels a still-cancellable PaymentIntent and returns `{ success, alreadyTerminal }`. Distinct from `cancelPayment` (which is the refund-adjacent variant used by `voidInvoice` cleanup). Throws `PaymentIntentNotCancellableException` when the intent is mid-3DS — callers should retry after the challenge resolves or expires.
|
|
15
|
+
- **`InlinePaymentIntentModel`, `StripePublicConfigModel`** — new GraphQL `@ObjectType` classes (`InlinePaymentIntent`, `StripePublicConfig`). The package does not ship mutations or resolvers (per the "no resolvers" rule); consumers wire a thin wrapper resolver — see the new "Inline PaymentIntent (Stripe Elements)" subsection of the README for the sample.
|
|
16
|
+
- **`PaymentIntentStatusEnum`** — vendor-neutral GraphQL enum (`REQUIRES_PAYMENT_METHOD | REQUIRES_CONFIRMATION | REQUIRES_ACTION | PROCESSING | SUCCEEDED`). Registered as a side effect of `register-payment-enums.ts` under the GraphQL name `PaymentIntentStatus`. The result type's nullable `providerStatus: string` field carries the raw Stripe status verbatim for debug/provider-specific UX.
|
|
17
|
+
- **`StripeGateway.publishableKey: string | null` getter** — read-only access to the configured publishable key. Consumers read this from a Query resolver to populate `StripePublicConfigModel`. Returns `null` when not configured, so the consumer's resolver can return `null` to mean "inline not available; fall back to Checkout-redirect".
|
|
18
|
+
- **`PaymentsModuleOptions.stripe.publishableKey?: string`** — new optional config field. Not validated at boot; first call to `createPaymentIntent` (or any future surface that consumes the publishable key) throws `PublishableKeyNotConfiguredException` if missing. Consumers using only Checkout-redirect never need to set this.
|
|
19
|
+
- **`IPaymentRepository.findReusablePendingByInvoiceId?(invoiceId, provider)`** — new OPTIONAL repository method. Adapters implementing it enable the durable reuse-if-exists path in `createPaymentIntent`; adapters skipping it still get Stripe-level idempotency protection. Optional → non-breaking against v0.2.x adapters.
|
|
20
|
+
- **`StripePaymentIntentGatewayOptions`** + **`STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS`** — typed shape and reserved-keys list for the `gatewayOptions` passthrough on `createPaymentIntent`. Distinct from `StripeGatewayOptions` (which targets `createPaymentSession`). Reserved keys: `metadata.invoiceId`, `amount`, `currency`, `automatic_payment_methods`, `confirm`, `payment_method`, `return_url`, `customer`, `off_session`. Reserving `customer` and `off_session` now keeps the future save-card-for-future-use surface clean.
|
|
21
|
+
- **New exceptions:** `PublishableKeyNotConfiguredException` (`PUBLISHABLE_KEY_NOT_CONFIGURED`), `PaymentIntentNotReusableException` (`PAYMENT_INTENT_NOT_REUSABLE`), `PaymentIntentNotCancellableException` (`PAYMENT_INTENT_NOT_CANCELLABLE`), `PaymentIntentOperationNotSupportedException` (`PAYMENT_INTENT_OPERATION_NOT_SUPPORTED`). All extend `PaymentException` with stable `.code` strings — see README "Exceptions".
|
|
22
|
+
- **`GatewayRegistryService.getInlineCapable(providerType)`** + **`InlineCapableGateway` type** — narrows the gateway so `createPaymentIntent` and `cancelPaymentIntent` are non-optional. Throws `PaymentIntentOperationNotSupportedException` when the gateway lacks either method.
|
|
23
|
+
|
|
24
|
+
### Notes
|
|
25
|
+
- **Requires v0.2.1+** for the `payment_intent.succeeded` webhook handler. Inline-PI flows succeed at Stripe but cannot close the local invoice without it — the v0.3.0 README adds the event to the documented Stripe Dashboard subscription list explicitly.
|
|
26
|
+
- **No changes to `prisma/payment-models.prisma`**; no database migrations. Consumers using inline-PI at scale SHOULD add an index on `(invoiceId, provider, status)` on their `Payment` table for the reuse-path query — flagged in the README as a consumer concern.
|
|
27
|
+
- **No breaking changes to existing surfaces.** All v0.3.0 additions are strictly additive: new exports, new optional methods, new optional config field, new optional repo method. Existing custom `PaymentGateway` implementations from v0.2.x continue to satisfy the interface unmodified.
|
|
28
|
+
|
|
29
|
+
### Audit-pass refinements (post-implementation review, same `0.3.0` tag)
|
|
30
|
+
- **`StripeGateway.createPaymentIntent` now validates `amount` and `currency` against the existing intent on the reuse path.** If the invoice's terms drifted between attempts (admin edit applied between modal opens), the stale intent is discarded with a `warn` log rather than silently returning a `client_secret` that would charge the wrong amount.
|
|
31
|
+
- **Stale `providerPaymentId` no longer surfaces as `PaymentGatewayException`.** If `paymentIntents.retrieve` returns `resource_missing` (the stored intent was deleted at Stripe), the gateway logs `warn` and falls through to fresh-create — consumers no longer see a confusing "Stripe rejected the PaymentIntent" error.
|
|
32
|
+
- **`StripeGateway.cancelPaymentIntent` no longer classifies `processing` as `alreadyTerminal: true`.** `processing` and `requires_action` are both in-flight (non-terminal) and now both throw `PaymentIntentNotCancellableException`. A stale-booking cleanup CRON receives a "retry me later" signal instead of "this work is done". `alreadyTerminal: true` is now reserved for `succeeded` and `canceled` only.
|
|
33
|
+
- **`assertNoReservedIntentGatewayOptions` now consumes `STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS` directly** instead of carrying a duplicate inline list. A "stays in sync" spec iterates the exported constant and asserts each key is rejected.
|
|
34
|
+
- **`maybeReuseExistingIntent` logs `debug` for unknown future Stripe statuses** before falling through to fresh-create (forward compat).
|
|
35
|
+
- **JSDoc and README polish.** `cancelPaymentIntent` implementation JSDoc gained `@throws`. README's "Inline PaymentIntent" section now exhaustively documents the four-condition reuse criteria, the amount/currency drift behavior, the stale-row fall-through, and the cross-day `attemptId`-omitted idempotency-cache trap (recommendation: always pass `attemptId`). Sample wrapper resolver now imports `PaymentIntentStatusEnum` and uses `as PaymentIntentStatusEnum` instead of `as any`.
|
|
36
|
+
- **+10 specs**, total now 100 across 6 suites.
|
|
37
|
+
|
|
38
|
+
## [0.2.1] - 2026-05-28
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
- **`payment_intent.succeeded` Stripe webhook event is now handled.** Previously the event fell through to the `default → ignored` branch in `StripeGateway.normalizeWebhookEvent`, meaning any PaymentIntent created outside the Checkout flow — chiefly the inline Stripe Elements surface arriving in 0.3.0, but also any consumer calling `stripe.paymentIntents.create` directly — succeeded at Stripe with no corresponding invoice or payment-record update. The new handler mirrors `handleCheckoutSessionCompleted`'s `latest_charge` → `receipt_url` fetch pattern (including the inflated-object vs string-id fork) and emits `type: 'payment.succeeded'` with `providerPaymentId: intent.id`, so `PaymentService.handlePaymentSucceeded` matches the row stored at `createPendingPayment` time without an id-swap step. Consumers using direct-PaymentIntent flows MUST subscribe to `payment_intent.succeeded` in their Stripe Dashboard webhook configuration — see "Stripe Gateway & Webhooks" in the README. This is also a precondition for the inline-PaymentIntent surface arriving in 0.3.0.
|
|
42
|
+
|
|
10
43
|
## [0.1.3] - 2026-05-15
|
|
11
44
|
|
|
12
45
|
### Added
|
package/README.md
CHANGED
|
@@ -263,6 +263,14 @@ When `stripe` config is provided, the module registers `StripeGateway` and mount
|
|
|
263
263
|
- **Unrecognized event types** — Stripe fires many events per checkout (`payment_intent.created`, `charge.updated`, `charge.succeeded`, …) that the package does not route. These return 200 with a `debug`-level log and Stripe does not retry. The gateway surfaces them as an `IgnoredWebhookEvent` (`{ type: 'ignored', eventId, eventType }`) — if you implement a custom `PaymentGateway`, your `handleWebhook` must return this sentinel for unrouted events instead of throwing.
|
|
264
264
|
- **Error reporting** — configure `webhook.errorReporter` to pipe exceptions into Sentry/GlitchTip/etc.
|
|
265
265
|
|
|
266
|
+
**Stripe Dashboard webhook subscriptions.** Your Stripe Dashboard webhook endpoint MUST subscribe to (at minimum):
|
|
267
|
+
|
|
268
|
+
- `checkout.session.completed` — closes the loop for the Checkout-redirect flow.
|
|
269
|
+
- `payment_intent.processing` — observability for delayed bank-side methods.
|
|
270
|
+
- `payment_intent.succeeded` — closes the loop for direct-PaymentIntent flows (chiefly the inline Stripe Elements surface in v0.3.0, plus any consumer calling `paymentIntents.create` directly). Required as of **v0.2.1** — without it, inline payments succeed at Stripe but the invoice never updates.
|
|
271
|
+
- `payment_intent.payment_failed` — surfaces declines back into the payment record.
|
|
272
|
+
- `charge.refunded` — closes the loop on refunds.
|
|
273
|
+
|
|
266
274
|
> **Payable-status requirement.** `PaymentService.handlePaymentSucceeded` only applies an incoming payment if the invoice is in `SENT`, `PARTIALLY_PAID`, or `OVERDUE`. If a consumer creates a DRAFT invoice and starts checkout without first transitioning it to SENT, the SUCCEEDED payment lands in the `Payment` table but the invoice stays in DRAFT with `amountPaid=0`.
|
|
267
275
|
>
|
|
268
276
|
> As of v0.1.3 this fires a WARN log identifying the payment, provider, invoice, and status. As of v0.2.0, call `InvoiceService.ensureSent(invoiceId, eTransferEnabled, eTransferAutoDeposit, eTransferConfig?)` from your checkout flow immediately before `gateway.createPaymentSession(...)`. `ensureSent` is idempotent: DRAFT → SENT (delegates to `sendInvoice`), already-SENT/PARTIALLY_PAID/OVERDUE → returns the invoice unchanged with no re-emailed notification, PAID/VOID/REFUNDED → throws `InvalidInvoiceStateException`. `sendInvoice` itself remains strict (DRAFT-only) for callers that want the strictness.
|
|
@@ -315,6 +323,160 @@ The gateway **throws `PaymentGatewayException`** at session-creation time if `ga
|
|
|
315
323
|
|
|
316
324
|
The same list is exported as `STRIPE_RESERVED_GATEWAY_KEYS: readonly string[]` for consumers that wrap the gateway and want to share the validation.
|
|
317
325
|
|
|
326
|
+
#### Inline PaymentIntent (Stripe Elements)
|
|
327
|
+
|
|
328
|
+
*Added in v0.3.0.*
|
|
329
|
+
|
|
330
|
+
For consumer-facing flows that want the payment form embedded in the page (Stripe Elements on web, `flutter_stripe` on mobile, etc.) rather than redirecting to Stripe Checkout, `StripeGateway` ships two methods on the base `PaymentGateway` interface:
|
|
331
|
+
|
|
332
|
+
```typescript
|
|
333
|
+
gateway.createPaymentIntent(params): Promise<CreatePaymentIntentResult>;
|
|
334
|
+
gateway.cancelPaymentIntent(providerPaymentId): Promise<{ success; alreadyTerminal }>;
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
Both are optional on `PaymentGateway` (custom adapters from before v0.3.0 do not need to implement them). To get a type-narrowed gateway where the methods are non-optional, call `GatewayRegistryService.getInlineCapable('stripe')`. On gateways that don't support inline, the helper throws `PaymentIntentOperationNotSupportedException`.
|
|
338
|
+
|
|
339
|
+
**Set the publishable key.** Inline-PI needs the publishable key at module init:
|
|
340
|
+
|
|
341
|
+
```typescript
|
|
342
|
+
stripe: {
|
|
343
|
+
secretKey: cfg.get('STRIPE_SECRET_KEY'),
|
|
344
|
+
webhookSecret: cfg.get('STRIPE_WEBHOOK_SECRET'),
|
|
345
|
+
publishableKey: cfg.get('STRIPE_PUBLISHABLE_KEY'), // NEW for inline
|
|
346
|
+
},
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
If you forget, the first call to `createPaymentIntent` throws `PublishableKeyNotConfiguredException` with a precise message.
|
|
350
|
+
|
|
351
|
+
**Subscribe to `payment_intent.succeeded`.** Inline payments succeed at Stripe via a direct PaymentIntent confirmation (no Checkout session). The package handles `payment_intent.succeeded` as of v0.2.1 — your Stripe Dashboard webhook config must list this event or invoices will never close. See the bullet list at the top of "Stripe Gateway & Webhooks".
|
|
352
|
+
|
|
353
|
+
**Reuse-via-pending-row.** `StripeGateway.createPaymentIntent` looks up an existing PENDING payment for the same invoice via `IPaymentRepository.findReusablePendingByInvoiceId(invoiceId, provider)` and, when one is found, retrieves the intent from Stripe. The retrieved intent is reused **only when all of the following hold**:
|
|
354
|
+
|
|
355
|
+
- its status is still confirmable (`requires_payment_method`, `requires_confirmation`, or `requires_action`),
|
|
356
|
+
- its `amount` matches the new request,
|
|
357
|
+
- its `currency` matches the new request, and
|
|
358
|
+
- its `client_secret` is non-null.
|
|
359
|
+
|
|
360
|
+
When all four hold the existing intent's `client_secret` is returned with `reused: true` — no duplicate intent is created.
|
|
361
|
+
|
|
362
|
+
Other outcomes:
|
|
363
|
+
|
|
364
|
+
- **Already `processing` or `succeeded`:** throws `PaymentIntentNotReusableException` (the invoice is likely already paid; the consumer should refetch the invoice rather than create a new charge).
|
|
365
|
+
- **Amount or currency drift** (e.g. an admin edited the invoice between attempts): the stale intent is logged at `warn` and discarded; the call proceeds to create a fresh intent. The old intent stays open at Stripe until either the consumer's cleanup CRON (calling `cancelPaymentIntent`) or Stripe's 24h auto-expiry clears it.
|
|
366
|
+
- **Stored `providerPaymentId` no longer resolves at Stripe** (manual deletion, archived intent): logged at `warn` and discarded — the consumer is NOT surfaced a `PaymentGatewayException`; a fresh intent is created.
|
|
367
|
+
- **Dead states** (`canceled`, `requires_capture`) or any future Stripe status the package doesn't recognize: fall through to fresh-create.
|
|
368
|
+
|
|
369
|
+
The repository method is **optional**; consumers who skip implementing it lose the reuse path entirely and rely on Stripe-level idempotency alone. For best behavior at scale, implement the method and index `(invoiceId, provider, status)`.
|
|
370
|
+
|
|
371
|
+
**Idempotency / `attemptId`.** Pass a request-scoped UUID (`crypto.randomUUID()`) as `attemptId` for the most robust idempotency. The gateway builds `idempotencyKey = pi-create-{invoiceId}-{attemptId}`. Omitting `attemptId` falls back to invoice-only idempotency (`pi-create-{invoiceId}`), which protects against in-session double-clicks but introduces a 24-hour-window trap: if the invoice's amount/currency changes between attempts on the same day, the second call's `paymentIntents.create` collides with Stripe's cached idempotency key for a request with different params and throws `StripeIdempotencyError` (the gateway wraps it as `PaymentGatewayException` with a "pass a fresh attemptId per attempt" hint). The reuse-via-pending-row layer detects the drift earlier and falls through to fresh-create, but the fresh-create itself only succeeds when `attemptId` is supplied (otherwise it hits the same cached key). **Recommendation: always pass `attemptId`.**
|
|
372
|
+
|
|
373
|
+
**Vendor-neutral status.** The result's `status` field is the `PaymentIntentStatus` GraphQL enum: `REQUIRES_PAYMENT_METHOD | REQUIRES_CONFIRMATION | REQUIRES_ACTION | PROCESSING | SUCCEEDED`. The raw Stripe string is exposed via the nullable `providerStatus` field for debug logging and provider-specific UX branching.
|
|
374
|
+
|
|
375
|
+
**Reserved `gatewayOptions` keys for `createPaymentIntent`** (distinct from the Checkout-session list above):
|
|
376
|
+
|
|
377
|
+
- `metadata.invoiceId` — package-owned (webhook keys off it)
|
|
378
|
+
- `amount`, `currency` — first-class params; passing here is a dual source of truth
|
|
379
|
+
- `automatic_payment_methods` — package-owned (set to `{ enabled: true }`)
|
|
380
|
+
- `confirm` — `true` would server-side-confirm and defeat inline
|
|
381
|
+
- `payment_method` — would pre-attach a method and skip Stripe Elements
|
|
382
|
+
- `return_url` — irrelevant inline (no redirect)
|
|
383
|
+
- `customer`, `off_session` — reserved for future save-card-for-future-use surface
|
|
384
|
+
|
|
385
|
+
Exported as `STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS: readonly string[]`. For typed autocomplete on the passthrough bag, import `StripePaymentIntentGatewayOptions` from the package root.
|
|
386
|
+
|
|
387
|
+
**Cancellation.** `cancelPaymentIntent(providerPaymentId)` targets `pi_*` IDs only — contract-bound to inline. Use it for stale-booking cleanup (e.g., from a `@Cron`-scheduled job on the consumer side). Returns `{ success, alreadyTerminal }`; the `alreadyTerminal` flag distinguishes "we cancelled it" from "Stripe had already cancelled / completed it". Mid-3DS intents throw `PaymentIntentNotCancellableException` — retry after the challenge resolves. Distinct from `cancelPayment(...)`, which is the refund-adjacent variant used by `voidInvoice` cleanup.
|
|
388
|
+
|
|
389
|
+
**Sample consumer wrapper resolver:**
|
|
390
|
+
|
|
391
|
+
```typescript
|
|
392
|
+
// CONSUMER-SIDE, illustrative. The package does not ship resolvers.
|
|
393
|
+
import { Resolver, Mutation, Query, Args } from '@nestjs/graphql';
|
|
394
|
+
import { Throttle } from '@nestjs/throttler';
|
|
395
|
+
import { ForbiddenException, BadRequestException } from '@nestjs/common';
|
|
396
|
+
import { randomUUID } from 'node:crypto';
|
|
397
|
+
import {
|
|
398
|
+
GatewayRegistryService,
|
|
399
|
+
InvoiceService,
|
|
400
|
+
PaymentService,
|
|
401
|
+
InlinePaymentIntentModel,
|
|
402
|
+
StripePublicConfigModel,
|
|
403
|
+
PaymentIntentNotReusableException,
|
|
404
|
+
PaymentIntentStatusEnum,
|
|
405
|
+
StripeGateway,
|
|
406
|
+
} from '@ambushsoftworks/nestjs-payments-graphql';
|
|
407
|
+
|
|
408
|
+
@Resolver()
|
|
409
|
+
export class ClientInvoicesResolver {
|
|
410
|
+
constructor(
|
|
411
|
+
private readonly registry: GatewayRegistryService,
|
|
412
|
+
private readonly invoiceService: InvoiceService,
|
|
413
|
+
private readonly paymentService: PaymentService,
|
|
414
|
+
) {}
|
|
415
|
+
|
|
416
|
+
// Trivial 5-liner — return null when inline is not configured so the
|
|
417
|
+
// FE can fall back to Checkout-redirect cleanly.
|
|
418
|
+
@Query(() => StripePublicConfigModel, { nullable: true })
|
|
419
|
+
async stripePublicConfig(): Promise<StripePublicConfigModel | null> {
|
|
420
|
+
const gateway = this.registry.get('stripe') as StripeGateway;
|
|
421
|
+
if (!gateway.publishableKey) return null;
|
|
422
|
+
return { publishableKey: gateway.publishableKey };
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
@Mutation(() => InlinePaymentIntentModel)
|
|
426
|
+
@Throttle({ default: { limit: 5, ttl: 60_000 } })
|
|
427
|
+
async createInlinePaymentIntent(
|
|
428
|
+
@Args('invoiceId') invoiceId: string,
|
|
429
|
+
// Consumer's own @CurrentUser() context, ownership check, etc.
|
|
430
|
+
): Promise<InlinePaymentIntentModel> {
|
|
431
|
+
const invoice = await this.invoiceService.findInvoiceById(invoiceId);
|
|
432
|
+
// ... consumer-side ownership + payable-status guards ...
|
|
433
|
+
const sent = await this.invoiceService.ensureSent(invoiceId, false, false);
|
|
434
|
+
|
|
435
|
+
const stripe = this.registry.getInlineCapable('stripe');
|
|
436
|
+
try {
|
|
437
|
+
const intent = await stripe.createPaymentIntent({
|
|
438
|
+
invoiceId,
|
|
439
|
+
amount: sent.amountDue,
|
|
440
|
+
currency: sent.currency,
|
|
441
|
+
attemptId: randomUUID(),
|
|
442
|
+
description: `Invoice ${sent.invoiceNumber}`,
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
await this.paymentService.createPendingPayment({
|
|
446
|
+
invoiceId,
|
|
447
|
+
amount: sent.amountDue,
|
|
448
|
+
currency: sent.currency,
|
|
449
|
+
method: 'CREDIT_CARD',
|
|
450
|
+
provider: 'stripe',
|
|
451
|
+
providerPaymentId: intent.providerPaymentId,
|
|
452
|
+
createdBy: 'user-id-here',
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
return {
|
|
456
|
+
provider: 'stripe',
|
|
457
|
+
// Safe non-null: createPaymentIntent already called
|
|
458
|
+
// requirePublishableKey() and threw if it was null.
|
|
459
|
+
publishableKey: stripe.publishableKey!,
|
|
460
|
+
providerPaymentId: intent.providerPaymentId,
|
|
461
|
+
clientSecret: intent.clientSecret,
|
|
462
|
+
// String union → enum cast — both share the same string values
|
|
463
|
+
// (REQUIRES_PAYMENT_METHOD, etc.) so the cast is structurally safe.
|
|
464
|
+
status: intent.status as PaymentIntentStatusEnum,
|
|
465
|
+
reused: intent.reused,
|
|
466
|
+
providerStatus: intent.providerStatus,
|
|
467
|
+
};
|
|
468
|
+
} catch (err) {
|
|
469
|
+
if (err instanceof PaymentIntentNotReusableException) {
|
|
470
|
+
throw new BadRequestException(
|
|
471
|
+
'This invoice is already being processed. Please refresh the page.',
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
throw err;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
```
|
|
479
|
+
|
|
318
480
|
### Refunds
|
|
319
481
|
|
|
320
482
|
Full and partial refunds through Stripe (when the originating payment went through Stripe) or manual refund records. All amounts in cents.
|
|
@@ -469,11 +631,14 @@ await transactionManager.runInTransaction(async (repos) => {
|
|
|
469
631
|
stripe: {
|
|
470
632
|
secretKey: string;
|
|
471
633
|
webhookSecret: string;
|
|
634
|
+
publishableKey?: string; // v0.3.0+ — required only for inline PaymentIntent flows
|
|
472
635
|
}
|
|
473
636
|
```
|
|
474
637
|
|
|
475
638
|
Omit the entire `stripe` key for non-Stripe deployments. A warning logs at startup if no gateway is configured.
|
|
476
639
|
|
|
640
|
+
`publishableKey` is **optional**. It is required only if your consumer uses `StripeGateway.createPaymentIntent` (inline Stripe Elements) or exposes a `stripePublicConfig` GraphQL query. Validation happens at first call rather than at module init — consumers using only Checkout-redirect never need to set this. Per Stripe's docs, the publishable key is safe to ship to any client; it cannot create charges on its own.
|
|
641
|
+
|
|
477
642
|
### Email Options
|
|
478
643
|
|
|
479
644
|
```typescript
|
|
@@ -538,9 +703,9 @@ import {
|
|
|
538
703
|
|
|
539
704
|
The package registers these names on module import. Consumers **must not** redefine or re-register them, or GraphQL will throw `"type already registered"`.
|
|
540
705
|
|
|
541
|
-
**Object types:** `Invoice`, `InvoiceLineItem`, `InvoiceClient`, `Payment`, `Refund`, `PaymentPlan`, `PaymentPlanInstallment`, `PaymentConfig`, `PaymentProvider`, `PaymentMethodSetup`, `ETransferInstructions`, `OnlinePaymentSession`, `RecurringInvoice`, `RecurringInvoiceLineItem`, `PaginatedInvoices`, `PaginatedPaymentPlans`, `PaginatedRecurringInvoices`
|
|
706
|
+
**Object types:** `Invoice`, `InvoiceLineItem`, `InvoiceClient`, `Payment`, `Refund`, `PaymentPlan`, `PaymentPlanInstallment`, `PaymentConfig`, `PaymentProvider`, `PaymentMethodSetup`, `ETransferInstructions`, `OnlinePaymentSession`, `RecurringInvoice`, `RecurringInvoiceLineItem`, `PaginatedInvoices`, `PaginatedPaymentPlans`, `PaginatedRecurringInvoices`, `InlinePaymentIntent`, `StripePublicConfig`
|
|
542
707
|
|
|
543
|
-
**Enums:** `InvoiceStatus`, `PaymentMethod`, `PaymentStatus`, `RefundStatus`, `PaymentPlanStatus`, `InstallmentStatus`, `RecurringIntervalUnit`, `RecurringInvoiceStatus`
|
|
708
|
+
**Enums:** `InvoiceStatus`, `PaymentMethod`, `PaymentStatus`, `RefundStatus`, `PaymentPlanStatus`, `InstallmentStatus`, `RecurringIntervalUnit`, `RecurringInvoiceStatus`, `PaymentIntentStatus`
|
|
544
709
|
|
|
545
710
|
**Input types:** `CreateInvoiceInput`, `CreateLineItemInput`, `CreateRefundInput`, `CreateInstallmentInput`, `CreatePaymentPlanInput`, `CreateRecurringInvoiceInput`, `CreateRecurringLineItemInput`, `RecordManualPaymentInput`, `UpdatePaymentConfigInput`, `UpdateInvoiceMetadataInput`, `UpdateRecurringTemplateInput`, `UpsertPaymentProviderInput`, `InvoiceFilterInput`, `PaymentPlanFilterInput`, `RecurringInvoiceFilterInput`
|
|
546
711
|
|
|
@@ -562,6 +727,10 @@ All exceptions extend `PaymentException` (a plain `Error` subclass) with a stabl
|
|
|
562
727
|
| `InvalidPaymentStateException` | `INVALID_PAYMENT_STATE` |
|
|
563
728
|
| `InvalidRecurringInvoiceStateException` | `INVALID_RECURRING_INVOICE_STATE` |
|
|
564
729
|
| `UniqueConstraintViolationException` | `UNIQUE_CONSTRAINT_VIOLATION` |
|
|
730
|
+
| `PublishableKeyNotConfiguredException` | `PUBLISHABLE_KEY_NOT_CONFIGURED` |
|
|
731
|
+
| `PaymentIntentNotReusableException` | `PAYMENT_INTENT_NOT_REUSABLE` |
|
|
732
|
+
| `PaymentIntentNotCancellableException` | `PAYMENT_INTENT_NOT_CANCELLABLE` |
|
|
733
|
+
| `PaymentIntentOperationNotSupportedException` | `PAYMENT_INTENT_OPERATION_NOT_SUPPORTED` |
|
|
565
734
|
|
|
566
735
|
Repository adapters are responsible for translating ORM-specific unique-constraint errors (e.g. Prisma `P2002`) into `UniqueConstraintViolationException` so core services stay ORM-agnostic.
|
|
567
736
|
|
|
@@ -32,3 +32,15 @@ export declare class InvalidRecurringInvoiceStateException extends PaymentExcept
|
|
|
32
32
|
export declare class UniqueConstraintViolationException extends PaymentException {
|
|
33
33
|
constructor(message?: string);
|
|
34
34
|
}
|
|
35
|
+
export declare class PublishableKeyNotConfiguredException extends PaymentException {
|
|
36
|
+
constructor(message?: string);
|
|
37
|
+
}
|
|
38
|
+
export declare class PaymentIntentNotReusableException extends PaymentException {
|
|
39
|
+
constructor(message: string);
|
|
40
|
+
}
|
|
41
|
+
export declare class PaymentIntentNotCancellableException extends PaymentException {
|
|
42
|
+
constructor(message: string);
|
|
43
|
+
}
|
|
44
|
+
export declare class PaymentIntentOperationNotSupportedException extends PaymentException {
|
|
45
|
+
constructor(message: string);
|
|
46
|
+
}
|
package/dist/exceptions/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UniqueConstraintViolationException = exports.InvalidRecurringInvoiceStateException = exports.InvalidPaymentStateException = exports.RefundNotAllowedException = exports.InvoiceNumberExhaustedException = exports.InvoiceNotPayableException = exports.DuplicatePaymentException = exports.PaymentGatewayException = exports.PaymentAmountExceededException = exports.InvalidInvoiceStateException = exports.PaymentException = void 0;
|
|
3
|
+
exports.PaymentIntentOperationNotSupportedException = exports.PaymentIntentNotCancellableException = exports.PaymentIntentNotReusableException = exports.PublishableKeyNotConfiguredException = exports.UniqueConstraintViolationException = exports.InvalidRecurringInvoiceStateException = exports.InvalidPaymentStateException = exports.RefundNotAllowedException = exports.InvoiceNumberExhaustedException = exports.InvoiceNotPayableException = exports.DuplicatePaymentException = exports.PaymentGatewayException = exports.PaymentAmountExceededException = exports.InvalidInvoiceStateException = exports.PaymentException = void 0;
|
|
4
4
|
class PaymentException extends Error {
|
|
5
5
|
constructor(message, code) {
|
|
6
6
|
super(message);
|
|
@@ -70,4 +70,30 @@ class UniqueConstraintViolationException extends PaymentException {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
exports.UniqueConstraintViolationException = UniqueConstraintViolationException;
|
|
73
|
+
class PublishableKeyNotConfiguredException extends PaymentException {
|
|
74
|
+
constructor(message = 'Stripe publishableKey is not configured. Set ' +
|
|
75
|
+
'stripe.publishableKey in PaymentsModule options to enable inline ' +
|
|
76
|
+
'PaymentIntent creation.') {
|
|
77
|
+
super(message, 'PUBLISHABLE_KEY_NOT_CONFIGURED');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.PublishableKeyNotConfiguredException = PublishableKeyNotConfiguredException;
|
|
81
|
+
class PaymentIntentNotReusableException extends PaymentException {
|
|
82
|
+
constructor(message) {
|
|
83
|
+
super(message, 'PAYMENT_INTENT_NOT_REUSABLE');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.PaymentIntentNotReusableException = PaymentIntentNotReusableException;
|
|
87
|
+
class PaymentIntentNotCancellableException extends PaymentException {
|
|
88
|
+
constructor(message) {
|
|
89
|
+
super(message, 'PAYMENT_INTENT_NOT_CANCELLABLE');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
exports.PaymentIntentNotCancellableException = PaymentIntentNotCancellableException;
|
|
93
|
+
class PaymentIntentOperationNotSupportedException extends PaymentException {
|
|
94
|
+
constructor(message) {
|
|
95
|
+
super(message, 'PAYMENT_INTENT_OPERATION_NOT_SUPPORTED');
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.PaymentIntentOperationNotSupportedException = PaymentIntentOperationNotSupportedException;
|
|
73
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exceptions/index.ts"],"names":[],"mappings":";;;AAQA,MAAa,gBAAiB,SAAQ,KAAK;IAGzC,YAAY,OAAe,EAAE,IAAY;QACvC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI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e;QACzB,KAAK,CAAC,OAAO,EAAE,gCAAgC,CAAC,CAAC;IACnD,CAAC;CACF;AAJD,oFAIC;AASD,MAAa,2CAA4C,SAAQ,gBAAgB;IAC/E,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAC;IAC3D,CAAC;CACF;AAJD,kGAIC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import type { PaymentGateway } from './payment-gateway.interface';
|
|
2
2
|
import type { RecurringPaymentGateway } from './recurring-payment-gateway.interface';
|
|
3
|
+
export type InlineCapableGateway = PaymentGateway & {
|
|
4
|
+
createPaymentIntent: NonNullable<PaymentGateway['createPaymentIntent']>;
|
|
5
|
+
cancelPaymentIntent: NonNullable<PaymentGateway['cancelPaymentIntent']>;
|
|
6
|
+
};
|
|
3
7
|
export declare class GatewayRegistryService {
|
|
4
8
|
private readonly gateways;
|
|
5
9
|
register(gateway: PaymentGateway): void;
|
|
6
10
|
get(providerType: string): PaymentGateway;
|
|
7
11
|
getRecurring(providerType: string): PaymentGateway & RecurringPaymentGateway;
|
|
12
|
+
getInlineCapable(providerType: string): InlineCapableGateway;
|
|
8
13
|
getAvailable(): string[];
|
|
9
14
|
private isRecurringCapable;
|
|
10
15
|
}
|
|
@@ -8,6 +8,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.GatewayRegistryService = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
|
+
const exceptions_1 = require("../exceptions");
|
|
11
12
|
let GatewayRegistryService = class GatewayRegistryService {
|
|
12
13
|
constructor() {
|
|
13
14
|
this.gateways = new Map();
|
|
@@ -29,6 +30,14 @@ let GatewayRegistryService = class GatewayRegistryService {
|
|
|
29
30
|
}
|
|
30
31
|
return gateway;
|
|
31
32
|
}
|
|
33
|
+
getInlineCapable(providerType) {
|
|
34
|
+
const gateway = this.get(providerType);
|
|
35
|
+
if (typeof gateway.createPaymentIntent !== 'function' ||
|
|
36
|
+
typeof gateway.cancelPaymentIntent !== 'function') {
|
|
37
|
+
throw new exceptions_1.PaymentIntentOperationNotSupportedException(`Gateway "${providerType}" does not support inline PaymentIntent operations`);
|
|
38
|
+
}
|
|
39
|
+
return gateway;
|
|
40
|
+
}
|
|
32
41
|
getAvailable() {
|
|
33
42
|
return Array.from(this.gateways.keys());
|
|
34
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateway-registry.service.js","sourceRoot":"","sources":["../../src/gateways/gateway-registry.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;
|
|
1
|
+
{"version":3,"file":"gateway-registry.service.js","sourceRoot":"","sources":["../../src/gateways/gateway-registry.service.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA4C;AAG5C,8CAA4E;AAuBrE,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QACY,aAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IAuEhE,CAAC;IApEC,QAAQ,CAAC,OAAuB;QAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAMD,GAAG,CAAC,YAAoB;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAChD,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CACb,oDAAoD,YAAY,GAAG,CACpE,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAMD,YAAY,CAAC,YAAoB;QAC/B,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC;YACtC,MAAM,IAAI,KAAK,CACb,YAAY,YAAY,uCAAuC,CAChE,CAAC;QACJ,CAAC;QACD,OAAO,OAAmD,CAAC;IAC7D,CAAC;IAaD,gBAAgB,CAAC,YAAoB;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACvC,IACE,OAAO,OAAO,CAAC,mBAAmB,KAAK,UAAU;YACjD,OAAO,OAAO,CAAC,mBAAmB,KAAK,UAAU,EACjD,CAAC;YACD,MAAM,IAAI,wDAA2C,CACnD,YAAY,YAAY,oDAAoD,CAC7E,CAAC;QACJ,CAAC;QACD,OAAO,OAA+B,CAAC;IACzC,CAAC;IAGD,YAAY;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;IAEO,kBAAkB,CAAC,OAAuB;QAChD,OAAO,CACL,0BAA0B,IAAI,OAAO;YACrC,yBAAyB,IAAI,OAAO;YACpC,oBAAoB,IAAI,OAAO,CAChC,CAAC;IACJ,CAAC;CACF,CAAA;AAxEY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,mBAAU,GAAE;GACA,sBAAsB,CAwElC"}
|
|
@@ -37,6 +37,29 @@ export interface PaymentGateway {
|
|
|
37
37
|
headers: Record<string, string>;
|
|
38
38
|
body: Buffer;
|
|
39
39
|
}): Promise<NormalizedWebhookEvent>;
|
|
40
|
+
createPaymentIntent?(params: CreatePaymentIntentParams): Promise<CreatePaymentIntentResult>;
|
|
41
|
+
cancelPaymentIntent?(providerPaymentId: string): Promise<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
alreadyTerminal: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export type PaymentIntentStatus = 'REQUIRES_PAYMENT_METHOD' | 'REQUIRES_CONFIRMATION' | 'REQUIRES_ACTION' | 'PROCESSING' | 'SUCCEEDED';
|
|
47
|
+
export interface CreatePaymentIntentParams {
|
|
48
|
+
invoiceId: string;
|
|
49
|
+
amount: number;
|
|
50
|
+
currency: string;
|
|
51
|
+
customerEmail?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
metadata?: Record<string, string>;
|
|
54
|
+
attemptId?: string;
|
|
55
|
+
gatewayOptions?: Record<string, unknown>;
|
|
56
|
+
}
|
|
57
|
+
export interface CreatePaymentIntentResult {
|
|
58
|
+
providerPaymentId: string;
|
|
59
|
+
clientSecret: string;
|
|
60
|
+
status: PaymentIntentStatus;
|
|
61
|
+
reused: boolean;
|
|
62
|
+
providerStatus?: string;
|
|
40
63
|
}
|
|
41
64
|
export type PaymentWebhookEventType = 'payment.processing' | 'payment.succeeded' | 'payment.failed' | 'payment.cancelled' | 'refund.succeeded' | 'refund.failed' | 'setup.succeeded';
|
|
42
65
|
export interface PaymentWebhookEvent {
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import type { NormalizedWebhookEvent, PaymentGateway } from '../payment-gateway.interface';
|
|
1
|
+
import type { CreatePaymentIntentParams, CreatePaymentIntentResult, NormalizedWebhookEvent, PaymentGateway } from '../payment-gateway.interface';
|
|
2
2
|
import type { RecurringPaymentGateway } from '../recurring-payment-gateway.interface';
|
|
3
|
+
import type { IPaymentRepository } from '../../interfaces/payment-repository.interface';
|
|
3
4
|
export declare class StripeGateway implements PaymentGateway, RecurringPaymentGateway {
|
|
4
5
|
readonly providerType = "stripe";
|
|
5
6
|
private readonly stripe;
|
|
6
7
|
private readonly webhookSecret;
|
|
8
|
+
private readonly publishableKeyValue;
|
|
9
|
+
private readonly paymentRepository;
|
|
7
10
|
private readonly logger;
|
|
8
|
-
constructor(secretKey: string, webhookSecret?: string);
|
|
11
|
+
constructor(secretKey: string, webhookSecret?: string, publishableKey?: string | null, paymentRepository?: IPaymentRepository | null);
|
|
12
|
+
get publishableKey(): string | null;
|
|
13
|
+
private requirePublishableKey;
|
|
9
14
|
createPaymentSession(params: {
|
|
10
15
|
invoiceId: string;
|
|
11
16
|
amount: number;
|
|
@@ -42,6 +47,13 @@ export declare class StripeGateway implements PaymentGateway, RecurringPaymentGa
|
|
|
42
47
|
cancelPayment(providerPaymentId: string): Promise<{
|
|
43
48
|
success: boolean;
|
|
44
49
|
}>;
|
|
50
|
+
createPaymentIntent(params: CreatePaymentIntentParams): Promise<CreatePaymentIntentResult>;
|
|
51
|
+
private maybeReuseExistingIntent;
|
|
52
|
+
cancelPaymentIntent(providerPaymentId: string): Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
alreadyTerminal: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
private assertNoReservedIntentGatewayOptions;
|
|
45
57
|
handleWebhook(params: {
|
|
46
58
|
headers: Record<string, string>;
|
|
47
59
|
body: Buffer;
|
|
@@ -79,8 +91,10 @@ export declare class StripeGateway implements PaymentGateway, RecurringPaymentGa
|
|
|
79
91
|
private handleCheckoutSessionCompleted;
|
|
80
92
|
private handleSetupSessionCompleted;
|
|
81
93
|
private handlePaymentIntentProcessing;
|
|
94
|
+
private handlePaymentIntentSucceeded;
|
|
82
95
|
private handlePaymentIntentFailed;
|
|
83
96
|
private handleChargeRefunded;
|
|
84
97
|
private mapPaymentIntentStatus;
|
|
98
|
+
private mapPaymentIntentStatusV2;
|
|
85
99
|
private mapRefundStatus;
|
|
86
100
|
}
|
|
@@ -7,16 +7,28 @@ exports.StripeGateway = void 0;
|
|
|
7
7
|
const common_1 = require("@nestjs/common");
|
|
8
8
|
const stripe_1 = __importDefault(require("stripe"));
|
|
9
9
|
const exceptions_1 = require("../../exceptions");
|
|
10
|
+
const types_1 = require("./types");
|
|
10
11
|
class StripeGateway {
|
|
11
|
-
constructor(secretKey, webhookSecret = '') {
|
|
12
|
+
constructor(secretKey, webhookSecret = '', publishableKey = null, paymentRepository = null) {
|
|
12
13
|
this.providerType = 'stripe';
|
|
13
14
|
this.logger = new common_1.Logger(StripeGateway.name);
|
|
14
15
|
this.webhookSecret = webhookSecret;
|
|
16
|
+
this.publishableKeyValue = publishableKey;
|
|
17
|
+
this.paymentRepository = paymentRepository;
|
|
15
18
|
this.stripe = new stripe_1.default(secretKey, {
|
|
16
19
|
apiVersion: '2025-02-24.acacia',
|
|
17
20
|
typescript: true,
|
|
18
21
|
});
|
|
19
22
|
}
|
|
23
|
+
get publishableKey() {
|
|
24
|
+
return this.publishableKeyValue;
|
|
25
|
+
}
|
|
26
|
+
requirePublishableKey() {
|
|
27
|
+
if (!this.publishableKeyValue) {
|
|
28
|
+
throw new exceptions_1.PublishableKeyNotConfiguredException();
|
|
29
|
+
}
|
|
30
|
+
return this.publishableKeyValue;
|
|
31
|
+
}
|
|
20
32
|
async createPaymentSession(params) {
|
|
21
33
|
try {
|
|
22
34
|
this.assertNoReservedGatewayOptions(params.gatewayOptions);
|
|
@@ -217,6 +229,178 @@ class StripeGateway {
|
|
|
217
229
|
throw error;
|
|
218
230
|
}
|
|
219
231
|
}
|
|
232
|
+
async createPaymentIntent(params) {
|
|
233
|
+
this.requirePublishableKey();
|
|
234
|
+
this.assertNoReservedIntentGatewayOptions(params.gatewayOptions);
|
|
235
|
+
try {
|
|
236
|
+
const reused = await this.maybeReuseExistingIntent(params);
|
|
237
|
+
if (reused)
|
|
238
|
+
return reused;
|
|
239
|
+
const { metadata: gatewayMetadata, ...topLevelGatewayOptions } = params.gatewayOptions ?? {};
|
|
240
|
+
const mergedMetadata = {
|
|
241
|
+
...(gatewayMetadata ?? {}),
|
|
242
|
+
...(params.metadata ?? {}),
|
|
243
|
+
invoiceId: params.invoiceId,
|
|
244
|
+
};
|
|
245
|
+
const sdkParams = {
|
|
246
|
+
...topLevelGatewayOptions,
|
|
247
|
+
amount: params.amount,
|
|
248
|
+
currency: params.currency.toLowerCase(),
|
|
249
|
+
description: params.description ?? `Invoice ${params.invoiceId}`,
|
|
250
|
+
receipt_email: params.customerEmail,
|
|
251
|
+
metadata: mergedMetadata,
|
|
252
|
+
automatic_payment_methods: { enabled: true },
|
|
253
|
+
};
|
|
254
|
+
const idempotencyKey = params.attemptId
|
|
255
|
+
? `pi-create-${params.invoiceId}-${params.attemptId}`
|
|
256
|
+
: `pi-create-${params.invoiceId}`;
|
|
257
|
+
const intent = await this.stripe.paymentIntents.create(sdkParams, {
|
|
258
|
+
idempotencyKey,
|
|
259
|
+
});
|
|
260
|
+
if (!intent.client_secret) {
|
|
261
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe created PaymentIntent ${intent.id} but returned no ` +
|
|
262
|
+
`client_secret. This indicates an account-level configuration ` +
|
|
263
|
+
`issue (likely a payment-method-type incompatibility).`);
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
providerPaymentId: intent.id,
|
|
267
|
+
clientSecret: intent.client_secret,
|
|
268
|
+
status: this.mapPaymentIntentStatusV2(intent.status),
|
|
269
|
+
reused: false,
|
|
270
|
+
providerStatus: intent.status,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
if (error instanceof exceptions_1.PaymentGatewayException)
|
|
275
|
+
throw error;
|
|
276
|
+
if (error instanceof exceptions_1.PaymentIntentNotReusableException)
|
|
277
|
+
throw error;
|
|
278
|
+
if (error instanceof exceptions_1.PublishableKeyNotConfiguredException)
|
|
279
|
+
throw error;
|
|
280
|
+
if (error instanceof stripe_1.default.errors.StripeError) {
|
|
281
|
+
this.logger.error(`Stripe createPaymentIntent failed: ${error.message}`, error.stack);
|
|
282
|
+
if (error instanceof stripe_1.default.errors.StripeAuthenticationError) {
|
|
283
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe authentication failed — check secretKey configuration: ${error.message}`);
|
|
284
|
+
}
|
|
285
|
+
if (error instanceof stripe_1.default.errors.StripeIdempotencyError) {
|
|
286
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe idempotency conflict: ${error.message}. The same ` +
|
|
287
|
+
`attemptId was used for a different request — pass a fresh ` +
|
|
288
|
+
`attemptId per attempt.`);
|
|
289
|
+
}
|
|
290
|
+
if (error instanceof stripe_1.default.errors.StripeInvalidRequestError) {
|
|
291
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe rejected the PaymentIntent: ${error.message}`);
|
|
292
|
+
}
|
|
293
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe error: ${error.message}`);
|
|
294
|
+
}
|
|
295
|
+
throw error;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
async maybeReuseExistingIntent(params) {
|
|
299
|
+
const repo = this.paymentRepository;
|
|
300
|
+
if (!repo || !repo.findReusablePendingByInvoiceId)
|
|
301
|
+
return null;
|
|
302
|
+
const existing = await repo.findReusablePendingByInvoiceId(params.invoiceId, this.providerType);
|
|
303
|
+
if (!existing?.providerPaymentId)
|
|
304
|
+
return null;
|
|
305
|
+
let intent;
|
|
306
|
+
try {
|
|
307
|
+
intent = await this.stripe.paymentIntents.retrieve(existing.providerPaymentId);
|
|
308
|
+
}
|
|
309
|
+
catch (error) {
|
|
310
|
+
if (error instanceof stripe_1.default.errors.StripeError &&
|
|
311
|
+
error.code === 'resource_missing') {
|
|
312
|
+
this.logger.warn(`Pending payment ${existing.id} points at non-existent ` +
|
|
313
|
+
`PaymentIntent ${existing.providerPaymentId}; creating fresh`);
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
throw error;
|
|
317
|
+
}
|
|
318
|
+
if (intent.amount !== params.amount ||
|
|
319
|
+
intent.currency.toLowerCase() !== params.currency.toLowerCase()) {
|
|
320
|
+
this.logger.warn(`Existing PaymentIntent ${intent.id} for invoice ${params.invoiceId} ` +
|
|
321
|
+
`has drifted parameters (intent=${intent.amount}${intent.currency.toUpperCase()}, ` +
|
|
322
|
+
`request=${params.amount}${params.currency.toUpperCase()}); creating fresh. ` +
|
|
323
|
+
`Stripe-level idempotency on the create call requires a fresh attemptId — ` +
|
|
324
|
+
`consumers that omit attemptId may see StripeIdempotencyError on this path.`);
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
switch (intent.status) {
|
|
328
|
+
case 'requires_payment_method':
|
|
329
|
+
case 'requires_confirmation':
|
|
330
|
+
case 'requires_action':
|
|
331
|
+
if (!intent.client_secret) {
|
|
332
|
+
this.logger.warn(`Reusable PaymentIntent ${intent.id} has no client_secret; creating fresh`);
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
providerPaymentId: intent.id,
|
|
337
|
+
clientSecret: intent.client_secret,
|
|
338
|
+
status: this.mapPaymentIntentStatusV2(intent.status),
|
|
339
|
+
reused: true,
|
|
340
|
+
providerStatus: intent.status,
|
|
341
|
+
};
|
|
342
|
+
case 'processing':
|
|
343
|
+
case 'succeeded':
|
|
344
|
+
throw new exceptions_1.PaymentIntentNotReusableException(`PaymentIntent ${intent.id} for invoice ${params.invoiceId} is ` +
|
|
345
|
+
`already ${intent.status}. Refetch the invoice — it is ` +
|
|
346
|
+
`likely already paid.`);
|
|
347
|
+
case 'canceled':
|
|
348
|
+
case 'requires_capture':
|
|
349
|
+
return null;
|
|
350
|
+
default:
|
|
351
|
+
this.logger.debug(`Existing PaymentIntent ${intent.id} in unknown status ` +
|
|
352
|
+
`"${intent.status}"; creating fresh`);
|
|
353
|
+
return null;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
async cancelPaymentIntent(providerPaymentId) {
|
|
357
|
+
try {
|
|
358
|
+
await this.stripe.paymentIntents.cancel(providerPaymentId);
|
|
359
|
+
return { success: true, alreadyTerminal: false };
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
if (error instanceof stripe_1.default.errors.StripeError) {
|
|
363
|
+
if (error.code === 'payment_intent_unexpected_state') {
|
|
364
|
+
const intent = await this.stripe.paymentIntents.retrieve(providerPaymentId);
|
|
365
|
+
if (intent.status === 'succeeded' || intent.status === 'canceled') {
|
|
366
|
+
return { success: true, alreadyTerminal: true };
|
|
367
|
+
}
|
|
368
|
+
if (intent.status === 'processing') {
|
|
369
|
+
throw new exceptions_1.PaymentIntentNotCancellableException(`PaymentIntent ${providerPaymentId} is in processing state ` +
|
|
370
|
+
`(Stripe is confirming the charge). Wait for it to settle ` +
|
|
371
|
+
`to succeeded or back to requires_payment_method before ` +
|
|
372
|
+
`retrying cancellation.`);
|
|
373
|
+
}
|
|
374
|
+
if (intent.status === 'requires_action') {
|
|
375
|
+
throw new exceptions_1.PaymentIntentNotCancellableException(`PaymentIntent ${providerPaymentId} is in requires_action ` +
|
|
376
|
+
`state (mid-3DS). Wait for the challenge to resolve or ` +
|
|
377
|
+
`expire before retrying cancellation.`);
|
|
378
|
+
}
|
|
379
|
+
throw new exceptions_1.PaymentGatewayException(`PaymentIntent ${providerPaymentId} in unexpected state ` +
|
|
380
|
+
`"${intent.status}" — cannot cancel.`);
|
|
381
|
+
}
|
|
382
|
+
this.logger.error(`Stripe cancelPaymentIntent failed: ${error.message}`, error.stack);
|
|
383
|
+
throw new exceptions_1.PaymentGatewayException(`Stripe cancelPaymentIntent failed: ${error.message}`);
|
|
384
|
+
}
|
|
385
|
+
throw error;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
assertNoReservedIntentGatewayOptions(gatewayOptions) {
|
|
389
|
+
if (!gatewayOptions)
|
|
390
|
+
return;
|
|
391
|
+
const topLevelMetadata = gatewayOptions.metadata;
|
|
392
|
+
if (topLevelMetadata && topLevelMetadata.invoiceId !== undefined) {
|
|
393
|
+
throw new exceptions_1.PaymentGatewayException('metadata.invoiceId is reserved by the package and cannot be ' +
|
|
394
|
+
'overridden via gatewayOptions');
|
|
395
|
+
}
|
|
396
|
+
const reservedTopLevel = types_1.STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS.filter((key) => !key.includes('.'));
|
|
397
|
+
for (const key of reservedTopLevel) {
|
|
398
|
+
if (gatewayOptions[key] !== undefined) {
|
|
399
|
+
throw new exceptions_1.PaymentGatewayException(`${key} is reserved by the package for createPaymentIntent and ` +
|
|
400
|
+
`cannot be overridden via gatewayOptions`);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
220
404
|
async handleWebhook(params) {
|
|
221
405
|
const sig = params.headers['stripe-signature'];
|
|
222
406
|
if (!sig) {
|
|
@@ -330,6 +514,8 @@ class StripeGateway {
|
|
|
330
514
|
return this.handleCheckoutSessionCompleted(event);
|
|
331
515
|
case 'payment_intent.processing':
|
|
332
516
|
return this.handlePaymentIntentProcessing(event);
|
|
517
|
+
case 'payment_intent.succeeded':
|
|
518
|
+
return this.handlePaymentIntentSucceeded(event);
|
|
333
519
|
case 'payment_intent.payment_failed':
|
|
334
520
|
return this.handlePaymentIntentFailed(event);
|
|
335
521
|
case 'charge.refunded':
|
|
@@ -411,6 +597,36 @@ class StripeGateway {
|
|
|
411
597
|
},
|
|
412
598
|
};
|
|
413
599
|
}
|
|
600
|
+
async handlePaymentIntentSucceeded(event) {
|
|
601
|
+
const intent = event.data.object;
|
|
602
|
+
let receiptUrl;
|
|
603
|
+
const charge = intent.latest_charge;
|
|
604
|
+
if (charge && typeof charge === 'object') {
|
|
605
|
+
receiptUrl = charge.receipt_url ?? undefined;
|
|
606
|
+
}
|
|
607
|
+
else if (typeof charge === 'string') {
|
|
608
|
+
try {
|
|
609
|
+
const c = await this.stripe.charges.retrieve(charge);
|
|
610
|
+
receiptUrl = c.receipt_url ?? undefined;
|
|
611
|
+
}
|
|
612
|
+
catch (error) {
|
|
613
|
+
this.logger.warn(`Failed to fetch charge for receipt_url: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
type: 'payment.succeeded',
|
|
618
|
+
eventId: event.id,
|
|
619
|
+
providerPaymentId: intent.id,
|
|
620
|
+
amount: intent.amount,
|
|
621
|
+
currency: intent.currency.toUpperCase(),
|
|
622
|
+
receiptUrl,
|
|
623
|
+
providerData: {
|
|
624
|
+
paymentIntentId: intent.id,
|
|
625
|
+
invoiceId: intent.metadata?.invoiceId,
|
|
626
|
+
paymentStatus: intent.status,
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
|
414
630
|
handlePaymentIntentFailed(event) {
|
|
415
631
|
const intent = event.data.object;
|
|
416
632
|
return {
|
|
@@ -464,6 +680,24 @@ class StripeGateway {
|
|
|
464
680
|
return 'failed';
|
|
465
681
|
}
|
|
466
682
|
}
|
|
683
|
+
mapPaymentIntentStatusV2(status) {
|
|
684
|
+
switch (status) {
|
|
685
|
+
case 'requires_payment_method':
|
|
686
|
+
return 'REQUIRES_PAYMENT_METHOD';
|
|
687
|
+
case 'requires_confirmation':
|
|
688
|
+
return 'REQUIRES_CONFIRMATION';
|
|
689
|
+
case 'requires_action':
|
|
690
|
+
return 'REQUIRES_ACTION';
|
|
691
|
+
case 'processing':
|
|
692
|
+
return 'PROCESSING';
|
|
693
|
+
case 'succeeded':
|
|
694
|
+
return 'SUCCEEDED';
|
|
695
|
+
default:
|
|
696
|
+
throw new exceptions_1.PaymentGatewayException(`Unexpected PaymentIntent status "${status}" from createPaymentIntent — ` +
|
|
697
|
+
`contract violation. Expected one of requires_payment_method, ` +
|
|
698
|
+
`requires_confirmation, requires_action, processing, succeeded.`);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
467
701
|
mapRefundStatus(status) {
|
|
468
702
|
switch (status) {
|
|
469
703
|
case 'succeeded':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.gateway.js","sourceRoot":"","sources":["../../../src/gateways/stripe/stripe.gateway.ts"],"names":[],"mappings":";;;;;;AAAA,2CAAwC;AACxC,oDAA4B;AAQ5B,iDAA2D;AAQ3D,MAAa,aAAa;IAOxB,YAAY,SAAiB,EAAE,gBAAwB,EAAE;QANhD,iBAAY,GAAG,QAAQ,CAAC;QAIhB,WAAM,GAAG,IAAI,eAAM,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;QAGvD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,gBAAM,CAAC,SAAS,EAAE;YAClC,UAAU,EAAE,mBAAmB;YAC/B,UAAU,EAAE,IAAI;S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Y;gBACf,OAAO,YAAY,CAAC;YACtB,KAAK,WAAW;gBACd,OAAO,WAAW,CAAC;YACrB;gBACE,MAAM,IAAI,oCAAuB,CAC/B,oCAAoC,MAAM,+BAA+B;oBACvE,+DAA+D;oBAC/D,gEAAgE,CACnE,CAAC;QACN,CAAC;IACH,CAAC;IAEO,eAAe,CACrB,MAAqB;QAErB,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,WAAW;gBACd,OAAO,WAAW,CAAC;YACrB,KAAK,SAAS;gBACZ,OAAO,SAAS,CAAC;YACnB,KAAK,QAAQ;gBACX,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,YAAY,CAAC;QACxB,CAAC;IACH,CAAC;CACF;AAntCD,sCAmtCC"}
|
|
@@ -20,3 +20,16 @@ export interface StripeGatewayOptions {
|
|
|
20
20
|
[key: string]: unknown;
|
|
21
21
|
}
|
|
22
22
|
export declare const STRIPE_RESERVED_GATEWAY_KEYS: readonly string[];
|
|
23
|
+
export interface StripePaymentIntentGatewayOptions {
|
|
24
|
+
metadata?: Record<string, string>;
|
|
25
|
+
statement_descriptor_suffix?: string;
|
|
26
|
+
statement_descriptor?: string;
|
|
27
|
+
application_fee_amount?: number;
|
|
28
|
+
on_behalf_of?: string;
|
|
29
|
+
transfer_data?: {
|
|
30
|
+
destination: string;
|
|
31
|
+
amount?: number;
|
|
32
|
+
};
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export declare const STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS: readonly string[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STRIPE_RESERVED_GATEWAY_KEYS = void 0;
|
|
3
|
+
exports.STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS = exports.STRIPE_RESERVED_GATEWAY_KEYS = void 0;
|
|
4
4
|
exports.STRIPE_RESERVED_GATEWAY_KEYS = Object.freeze([
|
|
5
5
|
'metadata.invoiceId',
|
|
6
6
|
'success_url',
|
|
@@ -9,4 +9,15 @@ exports.STRIPE_RESERVED_GATEWAY_KEYS = Object.freeze([
|
|
|
9
9
|
'mode',
|
|
10
10
|
'line_items',
|
|
11
11
|
]);
|
|
12
|
+
exports.STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS = Object.freeze([
|
|
13
|
+
'metadata.invoiceId',
|
|
14
|
+
'amount',
|
|
15
|
+
'currency',
|
|
16
|
+
'automatic_payment_methods',
|
|
17
|
+
'confirm',
|
|
18
|
+
'payment_method',
|
|
19
|
+
'return_url',
|
|
20
|
+
'customer',
|
|
21
|
+
'off_session',
|
|
22
|
+
]);
|
|
12
23
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/gateways/stripe/types.ts"],"names":[],"mappings":";;;AAsEa,QAAA,4BAA4B,GAAsB,MAAM,CAAC,MAAM,CAAC;IAC3E,oBAAoB;IACpB,aAAa;IACb,YAAY;IACZ,qBAAqB;IACrB,MAAM;IACN,YAAY;CACb,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/gateways/stripe/types.ts"],"names":[],"mappings":";;;AAsEa,QAAA,4BAA4B,GAAsB,MAAM,CAAC,MAAM,CAAC;IAC3E,oBAAoB;IACpB,aAAa;IACb,YAAY;IACZ,qBAAqB;IACrB,MAAM;IACN,YAAY;CACb,CAAC,CAAC;AAoEU,QAAA,2CAA2C,GACtD,MAAM,CAAC,MAAM,CAAC;IACZ,oBAAoB;IACpB,QAAQ;IACR,UAAU;IACV,2BAA2B;IAC3B,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,UAAU;IACV,aAAa;CACd,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,8 +12,9 @@ export type { IPaymentCustomerRepository } from './interfaces/payment-customer-r
|
|
|
12
12
|
export type { ITransactionManager, TransactionRepositories, } from './interfaces/transaction-manager.interface';
|
|
13
13
|
export type { IPaymentEmailSender, IPaymentClientResolver, PaymentEmailBrandingConfig, IPaymentEmailBrandingResolver, RenderedPaymentEmail, IPaymentEmailTemplateRenderer, InvoiceEmailParams, ETransferEmailParams, PaymentConfirmationEmailParams, OverdueReminderEmailParams, RefundConfirmationEmailParams, } from './interfaces/payment-email.interfaces';
|
|
14
14
|
export type { IPaymentEventListener, InvoiceLineItemEvent, PaidInvoiceEvent, RefundedInvoiceEvent, RecurringInvoiceGeneratedEvent, RecurringPaymentFailedEvent, RecurringInvoicePausedEvent, } from './interfaces/payment-event-listener.interface';
|
|
15
|
-
export type { PaymentGateway, PaymentWebhookEventType, PaymentWebhookEvent, IgnoredWebhookEvent, NormalizedWebhookEvent, } from './gateways/payment-gateway.interface';
|
|
15
|
+
export type { PaymentGateway, PaymentWebhookEventType, PaymentWebhookEvent, IgnoredWebhookEvent, NormalizedWebhookEvent, CreatePaymentIntentParams, CreatePaymentIntentResult, PaymentIntentStatus, } from './gateways/payment-gateway.interface';
|
|
16
16
|
export type { RecurringPaymentGateway } from './gateways/recurring-payment-gateway.interface';
|
|
17
|
+
export type { InlineCapableGateway } from './gateways/gateway-registry.service';
|
|
17
18
|
export { InvoiceService } from './services/invoice.service';
|
|
18
19
|
export { InvoiceNumberService } from './services/invoice-number.service';
|
|
19
20
|
export { PaymentService } from './services/payment.service';
|
|
@@ -27,7 +28,7 @@ export { CustomerService } from './services/customer.service';
|
|
|
27
28
|
export { ETransferService } from './services/e-transfer.service';
|
|
28
29
|
export { GatewayRegistryService } from './gateways/gateway-registry.service';
|
|
29
30
|
export type { DecimalLike, InvoiceStatus, PaymentMethod, PaymentStatus, RefundStatus, PaymentPlanStatus, InstallmentStatus, Invoice, InvoiceLineItem, InvoiceWithItems, Payment, Refund, PaymentPlan, PaymentPlanInstallment, PaymentConfig, PaymentProvider, CreateInvoiceData, CreateLineItemData, CreatePaymentData, CreateRefundData, CreatePaymentPlanData, CreateInstallmentData, CreatePaymentConfigData, InvoiceFilter, PaymentPlanFilter, RecurringIntervalUnit, RecurringInvoiceStatus, RecurringInvoice, RecurringInvoiceLineItem, RecurringInvoiceWithItems, CreateRecurringInvoiceData, CreateRecurringLineItemData, RecurringInvoiceFilter, PaymentCustomer, CreatePaymentCustomerData, } from './types';
|
|
30
|
-
export { PaymentException, InvalidInvoiceStateException, PaymentAmountExceededException, PaymentGatewayException, DuplicatePaymentException, InvoiceNotPayableException, InvoiceNumberExhaustedException, RefundNotAllowedException, InvalidPaymentStateException, InvalidRecurringInvoiceStateException, UniqueConstraintViolationException, } from './exceptions';
|
|
31
|
+
export { PaymentException, InvalidInvoiceStateException, PaymentAmountExceededException, PaymentGatewayException, DuplicatePaymentException, InvoiceNotPayableException, InvoiceNumberExhaustedException, RefundNotAllowedException, InvalidPaymentStateException, InvalidRecurringInvoiceStateException, UniqueConstraintViolationException, PublishableKeyNotConfiguredException, PaymentIntentNotReusableException, PaymentIntentNotCancellableException, PaymentIntentOperationNotSupportedException, } from './exceptions';
|
|
31
32
|
export { InvoiceModel, InvoiceStatusEnum, PaymentMethodEnum, PaymentStatusEnum, RefundStatusEnum, PaymentPlanStatusEnum, InstallmentStatusEnum, } from './models/invoice.model';
|
|
32
33
|
export { InvoiceLineItemModel } from './models/invoice-line-item.model';
|
|
33
34
|
export { InvoiceClientModel } from './models/invoice-client.model';
|
|
@@ -47,6 +48,9 @@ export { RecurringIntervalUnitEnum, RecurringInvoiceStatusEnum, } from './models
|
|
|
47
48
|
export { RecurringInvoiceLineItemModel } from './models/recurring-invoice-line-item.model';
|
|
48
49
|
export { Paginated } from './models/paginated.model';
|
|
49
50
|
export type { IPaginatedType } from './models/paginated.model';
|
|
51
|
+
export { InlinePaymentIntentModel } from './models/inline-payment-intent.model';
|
|
52
|
+
export { StripePublicConfigModel } from './models/stripe-public-config.model';
|
|
53
|
+
export { PaymentIntentStatusEnum } from './models/payment-intent-status.enum';
|
|
50
54
|
export { CreateInvoiceInput } from './dto/create-invoice.input';
|
|
51
55
|
export { CreateLineItemInput } from './dto/create-line-item.input';
|
|
52
56
|
export { CreateRefundInput } from './dto/create-refund.input';
|
|
@@ -64,8 +68,8 @@ export { PaymentPlanFilterInput } from './dto/payment-plan-filter.input';
|
|
|
64
68
|
export { RecurringInvoiceFilterInput } from './dto/recurring-invoice-filter.input';
|
|
65
69
|
export { IsMetadata } from './dto/validators/is-metadata';
|
|
66
70
|
export { StripeGateway } from './gateways/stripe/stripe.gateway';
|
|
67
|
-
export type { StripeGatewayOptions } from './gateways/stripe/types';
|
|
68
|
-
export { STRIPE_RESERVED_GATEWAY_KEYS } from './gateways/stripe/types';
|
|
71
|
+
export type { StripeGatewayOptions, StripePaymentIntentGatewayOptions, } from './gateways/stripe/types';
|
|
72
|
+
export { STRIPE_RESERVED_GATEWAY_KEYS, STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS, } from './gateways/stripe/types';
|
|
69
73
|
export { PaymentsWebhook, PAYMENTS_WEBHOOK, } from './gateways/stripe/stripe-webhook.controller';
|
|
70
74
|
export { StaticBrandingResolver } from './services/static-branding-resolver';
|
|
71
75
|
export { computeNextInvoiceDate, computeCycleCount, } from './services/recurring-interval.util';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.DefaultPaymentEmailTemplateRenderer = exports.computeCycleCount = exports.computeNextInvoiceDate = exports.StaticBrandingResolver = exports.PAYMENTS_WEBHOOK = exports.PaymentsWebhook = exports.STRIPE_RESERVED_GATEWAY_KEYS = exports.StripeGateway = exports.IsMetadata = exports.RecurringInvoiceFilterInput = exports.PaymentPlanFilterInput = exports.InvoiceFilterInput = exports.UpsertPaymentProviderInput = exports.UpdateRecurringTemplateInput = exports.UpdateInvoiceMetadataInput = exports.UpdatePaymentConfigInput = exports.RecordManualPaymentInput = exports.CreateRecurringLineItemInput = exports.CreateRecurringInvoiceInput = exports.CreatePaymentPlanInput = exports.CreateInstallmentInput = exports.CreateRefundInput = exports.CreateLineItemInput = exports.CreateInvoiceInput = exports.Paginated = exports.RecurringInvoiceLineItemModel = exports.RecurringInvoiceStatusEnum = exports.RecurringIntervalUnitEnum = exports.RecurringInvoiceModel = exports.PaginatedRecurringInvoices = exports.PaginatedPaymentPlans = exports.PaginatedInvoices = exports.PaymentMethodSetupModel = exports.PaymentPlanInstallmentModel = exports.PaymentPlanModel = exports.PaymentProviderModel = exports.PaymentConfigModel = exports.OnlinePaymentSessionModel = exports.ETransferInstructionsModel = exports.RefundModel = void 0;
|
|
3
|
+
exports.PaymentPlanStatusEnum = exports.RefundStatusEnum = exports.PaymentStatusEnum = exports.PaymentMethodEnum = exports.InvoiceStatusEnum = exports.InvoiceModel = exports.PaymentIntentOperationNotSupportedException = exports.PaymentIntentNotCancellableException = exports.PaymentIntentNotReusableException = exports.PublishableKeyNotConfiguredException = exports.UniqueConstraintViolationException = exports.InvalidRecurringInvoiceStateException = exports.InvalidPaymentStateException = exports.RefundNotAllowedException = exports.InvoiceNumberExhaustedException = exports.InvoiceNotPayableException = exports.DuplicatePaymentException = exports.PaymentGatewayException = exports.PaymentAmountExceededException = exports.InvalidInvoiceStateException = exports.PaymentException = exports.GatewayRegistryService = exports.ETransferService = exports.CustomerService = exports.RecurringInvoiceService = exports.PaymentEmailService = exports.PaymentPlanService = exports.PaymentConfigService = exports.RefundService = exports.PaymentService = exports.InvoiceNumberService = exports.InvoiceService = exports.E_TRANSFER_CODE_PREFIX = exports.DEFAULT_CURRENCY = exports.WEBHOOK_ERROR_REPORTER = exports.PAYMENT_EMAIL_TEMPLATE_RENDERER = exports.PAYMENT_EMAIL_BRANDING_RESOLVER = exports.PAYMENT_CLIENT_RESOLVER = exports.PAYMENT_EMAIL_SENDER = exports.PAYMENT_EVENT_LISTENER = exports.TRANSACTION_MANAGER = exports.PAYMENT_CUSTOMER_REPOSITORY = exports.RECURRING_INVOICE_REPOSITORY = exports.WEBHOOK_IDEMPOTENCY_REPOSITORY = exports.PAYMENT_CONFIG_REPOSITORY = exports.PAYMENT_PLAN_REPOSITORY = exports.REFUND_REPOSITORY = exports.PAYMENT_REPOSITORY = exports.INVOICE_REPOSITORY = exports.PaymentsModule = void 0;
|
|
4
|
+
exports.DefaultPaymentEmailTemplateRenderer = exports.computeCycleCount = exports.computeNextInvoiceDate = exports.StaticBrandingResolver = exports.PAYMENTS_WEBHOOK = exports.PaymentsWebhook = exports.STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS = exports.STRIPE_RESERVED_GATEWAY_KEYS = exports.StripeGateway = exports.IsMetadata = exports.RecurringInvoiceFilterInput = exports.PaymentPlanFilterInput = exports.InvoiceFilterInput = exports.UpsertPaymentProviderInput = exports.UpdateRecurringTemplateInput = exports.UpdateInvoiceMetadataInput = exports.UpdatePaymentConfigInput = exports.RecordManualPaymentInput = exports.CreateRecurringLineItemInput = exports.CreateRecurringInvoiceInput = exports.CreatePaymentPlanInput = exports.CreateInstallmentInput = exports.CreateRefundInput = exports.CreateLineItemInput = exports.CreateInvoiceInput = exports.PaymentIntentStatusEnum = exports.StripePublicConfigModel = exports.InlinePaymentIntentModel = exports.Paginated = exports.RecurringInvoiceLineItemModel = exports.RecurringInvoiceStatusEnum = exports.RecurringIntervalUnitEnum = exports.RecurringInvoiceModel = exports.PaginatedRecurringInvoices = exports.PaginatedPaymentPlans = exports.PaginatedInvoices = exports.PaymentMethodSetupModel = exports.PaymentPlanInstallmentModel = exports.PaymentPlanModel = exports.PaymentProviderModel = exports.PaymentConfigModel = exports.OnlinePaymentSessionModel = exports.ETransferInstructionsModel = exports.RefundModel = exports.PaymentModel = exports.InvoiceClientModel = exports.InvoiceLineItemModel = exports.InstallmentStatusEnum = void 0;
|
|
5
5
|
var payments_module_1 = require("./payments.module");
|
|
6
6
|
Object.defineProperty(exports, "PaymentsModule", { enumerable: true, get: function () { return payments_module_1.PaymentsModule; } });
|
|
7
7
|
var constants_1 = require("./constants");
|
|
@@ -56,6 +56,10 @@ Object.defineProperty(exports, "RefundNotAllowedException", { enumerable: true,
|
|
|
56
56
|
Object.defineProperty(exports, "InvalidPaymentStateException", { enumerable: true, get: function () { return exceptions_1.InvalidPaymentStateException; } });
|
|
57
57
|
Object.defineProperty(exports, "InvalidRecurringInvoiceStateException", { enumerable: true, get: function () { return exceptions_1.InvalidRecurringInvoiceStateException; } });
|
|
58
58
|
Object.defineProperty(exports, "UniqueConstraintViolationException", { enumerable: true, get: function () { return exceptions_1.UniqueConstraintViolationException; } });
|
|
59
|
+
Object.defineProperty(exports, "PublishableKeyNotConfiguredException", { enumerable: true, get: function () { return exceptions_1.PublishableKeyNotConfiguredException; } });
|
|
60
|
+
Object.defineProperty(exports, "PaymentIntentNotReusableException", { enumerable: true, get: function () { return exceptions_1.PaymentIntentNotReusableException; } });
|
|
61
|
+
Object.defineProperty(exports, "PaymentIntentNotCancellableException", { enumerable: true, get: function () { return exceptions_1.PaymentIntentNotCancellableException; } });
|
|
62
|
+
Object.defineProperty(exports, "PaymentIntentOperationNotSupportedException", { enumerable: true, get: function () { return exceptions_1.PaymentIntentOperationNotSupportedException; } });
|
|
59
63
|
var invoice_model_1 = require("./models/invoice.model");
|
|
60
64
|
Object.defineProperty(exports, "InvoiceModel", { enumerable: true, get: function () { return invoice_model_1.InvoiceModel; } });
|
|
61
65
|
Object.defineProperty(exports, "InvoiceStatusEnum", { enumerable: true, get: function () { return invoice_model_1.InvoiceStatusEnum; } });
|
|
@@ -100,6 +104,12 @@ var recurring_invoice_line_item_model_1 = require("./models/recurring-invoice-li
|
|
|
100
104
|
Object.defineProperty(exports, "RecurringInvoiceLineItemModel", { enumerable: true, get: function () { return recurring_invoice_line_item_model_1.RecurringInvoiceLineItemModel; } });
|
|
101
105
|
var paginated_model_1 = require("./models/paginated.model");
|
|
102
106
|
Object.defineProperty(exports, "Paginated", { enumerable: true, get: function () { return paginated_model_1.Paginated; } });
|
|
107
|
+
var inline_payment_intent_model_1 = require("./models/inline-payment-intent.model");
|
|
108
|
+
Object.defineProperty(exports, "InlinePaymentIntentModel", { enumerable: true, get: function () { return inline_payment_intent_model_1.InlinePaymentIntentModel; } });
|
|
109
|
+
var stripe_public_config_model_1 = require("./models/stripe-public-config.model");
|
|
110
|
+
Object.defineProperty(exports, "StripePublicConfigModel", { enumerable: true, get: function () { return stripe_public_config_model_1.StripePublicConfigModel; } });
|
|
111
|
+
var payment_intent_status_enum_1 = require("./models/payment-intent-status.enum");
|
|
112
|
+
Object.defineProperty(exports, "PaymentIntentStatusEnum", { enumerable: true, get: function () { return payment_intent_status_enum_1.PaymentIntentStatusEnum; } });
|
|
103
113
|
var create_invoice_input_1 = require("./dto/create-invoice.input");
|
|
104
114
|
Object.defineProperty(exports, "CreateInvoiceInput", { enumerable: true, get: function () { return create_invoice_input_1.CreateInvoiceInput; } });
|
|
105
115
|
var create_line_item_input_1 = require("./dto/create-line-item.input");
|
|
@@ -136,6 +146,7 @@ var stripe_gateway_1 = require("./gateways/stripe/stripe.gateway");
|
|
|
136
146
|
Object.defineProperty(exports, "StripeGateway", { enumerable: true, get: function () { return stripe_gateway_1.StripeGateway; } });
|
|
137
147
|
var types_1 = require("./gateways/stripe/types");
|
|
138
148
|
Object.defineProperty(exports, "STRIPE_RESERVED_GATEWAY_KEYS", { enumerable: true, get: function () { return types_1.STRIPE_RESERVED_GATEWAY_KEYS; } });
|
|
149
|
+
Object.defineProperty(exports, "STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS", { enumerable: true, get: function () { return types_1.STRIPE_PAYMENT_INTENT_RESERVED_GATEWAY_KEYS; } });
|
|
139
150
|
var stripe_webhook_controller_1 = require("./gateways/stripe/stripe-webhook.controller");
|
|
140
151
|
Object.defineProperty(exports, "PaymentsWebhook", { enumerable: true, get: function () { return stripe_webhook_controller_1.PaymentsWebhook; } });
|
|
141
152
|
Object.defineProperty(exports, "PAYMENTS_WEBHOOK", { enumerable: true, get: function () { return stripe_webhook_controller_1.PAYMENTS_WEBHOOK; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAOvB,yCAkBqB;AAjBnB,+GAAA,kBAAkB,OAAA;AAClB,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,oHAAA,uBAAuB,OAAA;AACvB,sHAAA,yBAAyB,OAAA;AACzB,2HAAA,8BAA8B,OAAA;AAC9B,yHAAA,4BAA4B,OAAA;AAC5B,wHAAA,2BAA2B,OAAA;AAC3B,gHAAA,mBAAmB,OAAA;AACnB,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,4HAAA,+BAA+B,OAAA;AAC/B,4HAAA,+BAA+B,OAAA;AAC/B,mHAAA,sBAAsB,OAAA;AACtB,6GAAA,gBAAgB,OAAA;AAChB,mHAAA,sBAAsB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAKA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAOvB,yCAkBqB;AAjBnB,+GAAA,kBAAkB,OAAA;AAClB,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,oHAAA,uBAAuB,OAAA;AACvB,sHAAA,yBAAyB,OAAA;AACzB,2HAAA,8BAA8B,OAAA;AAC9B,yHAAA,4BAA4B,OAAA;AAC5B,wHAAA,2BAA2B,OAAA;AAC3B,gHAAA,mBAAmB,OAAA;AACnB,mHAAA,sBAAsB,OAAA;AACtB,iHAAA,oBAAoB,OAAA;AACpB,oHAAA,uBAAuB,OAAA;AACvB,4HAAA,+BAA+B,OAA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;AACrC,iFAA6E;AAApE,uIAAA,wBAAwB,OAAA;AACjC,iFAA6E;AAApE,uIAAA,wBAAwB,OAAA;AACjC,qFAAiF;AAAxE,2IAAA,0BAA0B,OAAA;AACnC,yFAAqF;AAA5E,+IAAA,4BAA4B,OAAA;AACrC,qFAAiF;AAAxE,2IAAA,0BAA0B,OAAA;AACnC,mEAAgE;AAAvD,0HAAA,kBAAkB,OAAA;AAC3B,6EAAyE;AAAhE,mIAAA,sBAAsB,OAAA;AAC/B,uFAAmF;AAA1E,6IAAA,2BAA2B,OAAA;AAGpC,4DAA0D;AAAjD,yGAAA,UAAU,OAAA;AAGnB,mEAAiE;AAAxD,+GAAA,aAAa,OAAA;AAKtB,iDAGiC;AAF/B,qHAAA,4BAA4B,OAAA;AAC5B,oIAAA,2CAA2C,OAAA;AAI7C,yFAGqD;AAFnD,4HAAA,eAAe,OAAA;AACf,6HAAA,gBAAgB,OAAA;AAIlB,gFAA6E;AAApE,kIAAA,sBAAsB,OAAA;AAC/B,8EAG4C;AAF1C,iIAAA,sBAAsB,OAAA;AACtB,4HAAA,iBAAiB,OAAA;AAEnB,8FAAiG;AAAxF,sJAAA,mCAAmC,OAAA"}
|
|
@@ -10,4 +10,5 @@ export interface IPaymentRepository {
|
|
|
10
10
|
findByIdForUpdate(id: string): Promise<Payment | null>;
|
|
11
11
|
sumPendingConfirmationByInvoiceId(invoiceId: string): Promise<number>;
|
|
12
12
|
withTransaction<T>(fn: (repo: IPaymentRepository) => Promise<T>): Promise<T>;
|
|
13
|
+
findReusablePendingByInvoiceId?(invoiceId: string, provider: string): Promise<Payment | null>;
|
|
13
14
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PaymentIntentStatusEnum } from './payment-intent-status.enum';
|
|
2
|
+
export declare class InlinePaymentIntentModel {
|
|
3
|
+
provider: string;
|
|
4
|
+
publishableKey: string;
|
|
5
|
+
providerPaymentId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
status: PaymentIntentStatusEnum;
|
|
8
|
+
reused: boolean;
|
|
9
|
+
providerStatus?: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.InlinePaymentIntentModel = void 0;
|
|
13
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
+
const payment_intent_status_enum_1 = require("./payment-intent-status.enum");
|
|
15
|
+
let InlinePaymentIntentModel = class InlinePaymentIntentModel {
|
|
16
|
+
};
|
|
17
|
+
exports.InlinePaymentIntentModel = InlinePaymentIntentModel;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, graphql_1.Field)(),
|
|
20
|
+
__metadata("design:type", String)
|
|
21
|
+
], InlinePaymentIntentModel.prototype, "provider", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, graphql_1.Field)(),
|
|
24
|
+
__metadata("design:type", String)
|
|
25
|
+
], InlinePaymentIntentModel.prototype, "publishableKey", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, graphql_1.Field)(),
|
|
28
|
+
__metadata("design:type", String)
|
|
29
|
+
], InlinePaymentIntentModel.prototype, "providerPaymentId", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, graphql_1.Field)(),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], InlinePaymentIntentModel.prototype, "clientSecret", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, graphql_1.Field)(() => payment_intent_status_enum_1.PaymentIntentStatusEnum),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], InlinePaymentIntentModel.prototype, "status", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, graphql_1.Field)(),
|
|
40
|
+
__metadata("design:type", Boolean)
|
|
41
|
+
], InlinePaymentIntentModel.prototype, "reused", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, graphql_1.Field)({ nullable: true }),
|
|
44
|
+
__metadata("design:type", String)
|
|
45
|
+
], InlinePaymentIntentModel.prototype, "providerStatus", void 0);
|
|
46
|
+
exports.InlinePaymentIntentModel = InlinePaymentIntentModel = __decorate([
|
|
47
|
+
(0, graphql_1.ObjectType)('InlinePaymentIntent')
|
|
48
|
+
], InlinePaymentIntentModel);
|
|
49
|
+
//# sourceMappingURL=inline-payment-intent.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-payment-intent.model.js","sourceRoot":"","sources":["../../src/models/inline-payment-intent.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AACpD,6EAAuE;AAehE,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;CAkDpC,CAAA;AAlDY,4DAAwB;AAGnC;IADC,IAAA,eAAK,GAAE;;0DACS;AAQjB;IADC,IAAA,eAAK,GAAE;;gEACe;AAIvB;IADC,IAAA,eAAK,GAAE;;mEACkB;AAU1B;IADC,IAAA,eAAK,GAAE;;8DACa;AAIrB;IADC,IAAA,eAAK,EAAC,GAAG,EAAE,CAAC,oDAAuB,CAAC;;wDACL;AAUhC;IADC,IAAA,eAAK,GAAE;;wDACQ;AAUhB;IADC,IAAA,eAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gEACF;mCAjDb,wBAAwB;IADpC,IAAA,oBAAU,EAAC,qBAAqB,CAAC;GACrB,wBAAwB,CAkDpC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PaymentIntentStatusEnum = void 0;
|
|
4
|
+
var PaymentIntentStatusEnum;
|
|
5
|
+
(function (PaymentIntentStatusEnum) {
|
|
6
|
+
PaymentIntentStatusEnum["REQUIRES_PAYMENT_METHOD"] = "REQUIRES_PAYMENT_METHOD";
|
|
7
|
+
PaymentIntentStatusEnum["REQUIRES_CONFIRMATION"] = "REQUIRES_CONFIRMATION";
|
|
8
|
+
PaymentIntentStatusEnum["REQUIRES_ACTION"] = "REQUIRES_ACTION";
|
|
9
|
+
PaymentIntentStatusEnum["PROCESSING"] = "PROCESSING";
|
|
10
|
+
PaymentIntentStatusEnum["SUCCEEDED"] = "SUCCEEDED";
|
|
11
|
+
})(PaymentIntentStatusEnum || (exports.PaymentIntentStatusEnum = PaymentIntentStatusEnum = {}));
|
|
12
|
+
//# sourceMappingURL=payment-intent-status.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-intent-status.enum.js","sourceRoot":"","sources":["../../src/models/payment-intent-status.enum.ts"],"names":[],"mappings":";;;AAYA,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,8EAAmD,CAAA;IACnD,0EAA+C,CAAA;IAC/C,8DAAmC,CAAA;IACnC,oDAAyB,CAAA;IACzB,kDAAuB,CAAA;AACzB,CAAC,EANW,uBAAuB,uCAAvB,uBAAuB,QAMlC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.StripePublicConfigModel = void 0;
|
|
13
|
+
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
+
let StripePublicConfigModel = class StripePublicConfigModel {
|
|
15
|
+
};
|
|
16
|
+
exports.StripePublicConfigModel = StripePublicConfigModel;
|
|
17
|
+
__decorate([
|
|
18
|
+
(0, graphql_1.Field)(),
|
|
19
|
+
__metadata("design:type", String)
|
|
20
|
+
], StripePublicConfigModel.prototype, "publishableKey", void 0);
|
|
21
|
+
exports.StripePublicConfigModel = StripePublicConfigModel = __decorate([
|
|
22
|
+
(0, graphql_1.ObjectType)('StripePublicConfig')
|
|
23
|
+
], StripePublicConfigModel);
|
|
24
|
+
//# sourceMappingURL=stripe-public-config.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe-public-config.model.js","sourceRoot":"","sources":["../../src/models/stripe-public-config.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAAoD;AAe7C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;CAGnC,CAAA;AAHY,0DAAuB;AAElC;IADC,IAAA,eAAK,GAAE;;+DACe;kCAFZ,uBAAuB;IADnC,IAAA,oBAAU,EAAC,oBAAoB,CAAC;GACpB,uBAAuB,CAGnC"}
|
package/dist/payments.module.js
CHANGED
|
@@ -169,7 +169,7 @@ let PaymentsModule = PaymentsModule_1 = class PaymentsModule {
|
|
|
169
169
|
return null;
|
|
170
170
|
const logger = new common_1.Logger('StripeGatewayFactory');
|
|
171
171
|
try {
|
|
172
|
-
const gateway = new stripe_gateway_1.StripeGateway(opts.stripe.secretKey, opts.stripe.webhookSecret);
|
|
172
|
+
const gateway = new stripe_gateway_1.StripeGateway(opts.stripe.secretKey, opts.stripe.webhookSecret, opts.stripe.publishableKey ?? null, opts.paymentRepositoryInstance);
|
|
173
173
|
registry.register(gateway);
|
|
174
174
|
logger.log('Stripe gateway registered successfully');
|
|
175
175
|
return gateway;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.module.js","sourceRoot":"","sources":["../src/payments.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAkF;AAElF,oCAAkC;AAGlC,2CAkBqB;AAqBrB,gEAA4D;AAC5D,8EAAyE;AACzE,gEAA4D;AAC5D,8DAA0D;AAC1D,8EAAyE;AACzE,0EAAqE;AACrE,4EAAuE;AACvE,oFAA+E;AAC/E,kEAA8D;AAC9D,sEAAiE;AAGjE,kFAA6E;AAC7E,qEAAiE;AACjE,2FAAsF;
|
|
1
|
+
{"version":3,"file":"payments.module.js","sourceRoot":"","sources":["../src/payments.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAAkF;AAElF,oCAAkC;AAGlC,2CAkBqB;AAqBrB,gEAA4D;AAC5D,8EAAyE;AACzE,gEAA4D;AAC5D,8DAA0D;AAC1D,8EAAyE;AACzE,0EAAqE;AACrE,4EAAuE;AACvE,oFAA+E;AAC/E,kEAA8D;AAC9D,sEAAiE;AAGjE,kFAA6E;AAC7E,qEAAiE;AACjE,2FAAsF;AAsFtF,MAAM,uBAAuB,GAAG,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAMhE,SAAS,eAAe,CAAC,IAA2B;IAClD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,gBAAgB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OAAO,CAAC;oBACjB,CAAC;oBAAC,OAAO,KAAK,EAAE,CAAC;wBACf,MAAM,CAAC,KAAK,CACV,sCAAsC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC/F,CAAC;wBACF,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;gBACD,MAAM,EAAE,CAAC,uBAAuB,EAAE,iDAAsB,CAAC;aAC1D;SACF,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,gBAAc;YACtB,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE;YACnC,WAAW,EAAE,CAAC,mDAAuB,CAAC;YACtC,SAAS;YACT,OAAO,EAAE;gBACP,gCAAc;gBACd,6CAAoB;gBACpB,gCAAc;gBACd,8BAAa;gBACb,6CAAoB;gBACpB,yCAAkB;gBAClB,iDAAsB;gBACtB,2CAAmB;gBACnB,mDAAuB;gBACvB,kCAAe;gBACf,qCAAgB;aACjB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAnMY,wCAAc;yBAAd,cAAc;IAD1B,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,cAAc,CAmM1B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const graphql_1 = require("@nestjs/graphql");
|
|
4
4
|
const invoice_model_1 = require("./models/invoice.model");
|
|
5
5
|
const recurring_invoice_model_1 = require("./models/recurring-invoice.model");
|
|
6
|
+
const payment_intent_status_enum_1 = require("./models/payment-intent-status.enum");
|
|
6
7
|
(0, graphql_1.registerEnumType)(invoice_model_1.InvoiceStatusEnum, { name: 'InvoiceStatus' });
|
|
7
8
|
(0, graphql_1.registerEnumType)(invoice_model_1.PaymentMethodEnum, { name: 'PaymentMethod' });
|
|
8
9
|
(0, graphql_1.registerEnumType)(invoice_model_1.PaymentStatusEnum, { name: 'PaymentStatus' });
|
|
@@ -15,4 +16,5 @@ const recurring_invoice_model_1 = require("./models/recurring-invoice.model");
|
|
|
15
16
|
(0, graphql_1.registerEnumType)(recurring_invoice_model_1.RecurringInvoiceStatusEnum, {
|
|
16
17
|
name: 'RecurringInvoiceStatus',
|
|
17
18
|
});
|
|
19
|
+
(0, graphql_1.registerEnumType)(payment_intent_status_enum_1.PaymentIntentStatusEnum, { name: 'PaymentIntentStatus' });
|
|
18
20
|
//# sourceMappingURL=register-payment-enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-payment-enums.js","sourceRoot":"","sources":["../src/register-payment-enums.ts"],"names":[],"mappings":";;AAWA,6CAAmD;AAEnD,0DAOgC;AAChC,8EAG0C;
|
|
1
|
+
{"version":3,"file":"register-payment-enums.js","sourceRoot":"","sources":["../src/register-payment-enums.ts"],"names":[],"mappings":";;AAWA,6CAAmD;AAEnD,0DAOgC;AAChC,8EAG0C;AAC1C,oFAA8E;AAE9E,IAAA,0BAAgB,EAAC,iCAAiB,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAC/D,IAAA,0BAAgB,EAAC,iCAAiB,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAC/D,IAAA,0BAAgB,EAAC,iCAAiB,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;AAC/D,IAAA,0BAAgB,EAAC,gCAAgB,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAC;AAC7D,IAAA,0BAAgB,EAAC,qCAAqB,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACvE,IAAA,0BAAgB,EAAC,qCAAqB,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC;AACvE,IAAA,0BAAgB,EAAC,mDAAyB,EAAE;IAC1C,IAAI,EAAE,uBAAuB;CAC9B,CAAC,CAAC;AACH,IAAA,0BAAgB,EAAC,oDAA0B,EAAE;IAC3C,IAAI,EAAE,wBAAwB;CAC/B,CAAC,CAAC;AACH,IAAA,0BAAgB,EAAC,oDAAuB,EAAE,EAAE,IAAI,EAAE,qBAAqB,EAAE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ambushsoftworks/nestjs-payments-graphql",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "NestJS payments module with GraphQL support — invoicing, payment processing, recurring billing, and email notifications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|