@apexara/stripe 1.0.4 → 1.1.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.
Files changed (57) hide show
  1. package/README.md +450 -28
  2. package/dist/apex-stripe.d.ts.map +1 -1
  3. package/dist/apex-stripe.js +10 -8
  4. package/dist/errors/http-error.d.ts +2 -1
  5. package/dist/errors/http-error.d.ts.map +1 -1
  6. package/dist/errors/http-error.js +3 -1
  7. package/dist/errors/stripe-error-status.d.ts +16 -0
  8. package/dist/errors/stripe-error-status.d.ts.map +1 -0
  9. package/dist/errors/stripe-error-status.js +60 -0
  10. package/dist/models/config.model.d.ts +2 -0
  11. package/dist/models/config.model.d.ts.map +1 -1
  12. package/dist/models/stripe.model.d.ts +13 -0
  13. package/dist/models/stripe.model.d.ts.map +1 -1
  14. package/dist/models/subscription.model.d.ts +1 -0
  15. package/dist/models/subscription.model.d.ts.map +1 -1
  16. package/dist/models/webhook.model.d.ts +16 -0
  17. package/dist/models/webhook.model.d.ts.map +1 -1
  18. package/dist/services/checkout/checkout.service.d.ts +8 -5
  19. package/dist/services/checkout/checkout.service.d.ts.map +1 -1
  20. package/dist/services/checkout/checkout.service.js +33 -14
  21. package/dist/services/connected-account/connected-account.service.d.ts +2 -1
  22. package/dist/services/connected-account/connected-account.service.d.ts.map +1 -1
  23. package/dist/services/connected-account/connected-account.service.js +4 -3
  24. package/dist/services/customer/customer.service.d.ts +2 -1
  25. package/dist/services/customer/customer.service.d.ts.map +1 -1
  26. package/dist/services/customer/customer.service.js +3 -2
  27. package/dist/services/invoice/invoice.service.d.ts +27 -3
  28. package/dist/services/invoice/invoice.service.d.ts.map +1 -1
  29. package/dist/services/invoice/invoice.service.js +108 -12
  30. package/dist/services/payment-link/payment-link.service.d.ts +2 -2
  31. package/dist/services/payment-link/payment-link.service.d.ts.map +1 -1
  32. package/dist/services/payment-link/payment-link.service.js +5 -4
  33. package/dist/services/payment-method/payment-method.service.d.ts +5 -4
  34. package/dist/services/payment-method/payment-method.service.d.ts.map +1 -1
  35. package/dist/services/payment-method/payment-method.service.js +35 -9
  36. package/dist/services/price/price.service.d.ts +2 -2
  37. package/dist/services/price/price.service.d.ts.map +1 -1
  38. package/dist/services/price/price.service.js +4 -3
  39. package/dist/services/subscription/subscription.service.d.ts +79 -12
  40. package/dist/services/subscription/subscription.service.d.ts.map +1 -1
  41. package/dist/services/subscription/subscription.service.js +337 -49
  42. package/dist/utils/idempotency.d.ts +29 -0
  43. package/dist/utils/idempotency.d.ts.map +1 -0
  44. package/dist/utils/idempotency.js +62 -0
  45. package/dist/webhooks/report-error.d.ts +7 -0
  46. package/dist/webhooks/report-error.d.ts.map +1 -0
  47. package/dist/webhooks/report-error.js +15 -0
  48. package/dist/webhooks/webhook.dispatcher.d.ts +15 -2
  49. package/dist/webhooks/webhook.dispatcher.d.ts.map +1 -1
  50. package/dist/webhooks/webhook.dispatcher.js +52 -9
  51. package/dist/webhooks/webhook.handler.d.ts +20 -1
  52. package/dist/webhooks/webhook.handler.d.ts.map +1 -1
  53. package/dist/webhooks/webhook.handler.js +94 -18
  54. package/package.json +5 -4
  55. package/dist/tests/helpers.d.ts +0 -5
  56. package/dist/tests/helpers.d.ts.map +0 -1
  57. package/dist/tests/helpers.js +0 -96
@@ -1 +1 @@
1
- {"version":3,"file":"apex-stripe.d.ts","sourceRoot":"","sources":["../src/apex-stripe.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8CAA8C,CAAC;AAClF,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAC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Aa,UAAU;gBAGnB,YAAY,EAAE,kBAAkB,EAChC,aAAa,CAAC,EAAE,mBAAmB;IAgBrC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAC1C,SAAgB,SAAS,EAAE,eAAe,CAAC;IAC3C,SAAgB,QAAQ,EAAE,cAAc,CAAC;IACzC,SAAgB,YAAY,EAAE,kBAAkB,CAAC;IACjD,SAAgB,cAAc,EAAE,oBAAoB,CAAC;IACrD,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,iBAAiB,EAAE,uBAAuB,CAAC;IAC3D,SAAgB,aAAa,EAAE,mBAAmB,CAAC;CAEpD"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ApexStripe = void 0;
4
4
  const client_1 = require("./client");
5
+ const stripe_error_status_1 = require("./errors/stripe-error-status");
5
6
  const price_service_1 = require("./services/price/price.service");
6
7
  const invoice_service_1 = require("./services/invoice/invoice.service");
7
8
  const checkout_service_1 = require("./services/checkout/checkout.service");
@@ -28,14 +29,15 @@ class ApexStripe {
28
29
  constructor(clientConfig, serviceConfig) {
29
30
  const config = { ...DEFAULTS, ...serviceConfig };
30
31
  this.client = (0, client_1.createStripeClient)(clientConfig);
31
- this.checkout = new checkout_service_1.CheckoutService(this.client, config);
32
- this.customers = new customer_service_1.CustomerService(this.client);
33
- this.invoices = new invoice_service_1.InvoiceService(this.client, config);
34
- this.paymentLinks = new payment_link_service_1.PaymentLinkService(this.client, config);
35
- this.paymentMethods = new payment_method_service_1.PaymentMethodService(this.client);
36
- this.prices = new price_service_1.PriceService(this.client, config);
37
- this.connectedAccounts = new connected_account_service_1.ConnectedAccountService(this.client, config);
38
- this.subscriptions = new subscription_service_1.SubscriptionService(this.client, config);
32
+ // A declined card thrown through a service carries 402, as the library's own refusals do.
33
+ this.checkout = (0, stripe_error_status_1.withHttpStatusOnErrors)(new checkout_service_1.CheckoutService(this.client, config));
34
+ this.customers = (0, stripe_error_status_1.withHttpStatusOnErrors)(new customer_service_1.CustomerService(this.client));
35
+ this.invoices = (0, stripe_error_status_1.withHttpStatusOnErrors)(new invoice_service_1.InvoiceService(this.client, config));
36
+ this.paymentLinks = (0, stripe_error_status_1.withHttpStatusOnErrors)(new payment_link_service_1.PaymentLinkService(this.client, config));
37
+ this.paymentMethods = (0, stripe_error_status_1.withHttpStatusOnErrors)(new payment_method_service_1.PaymentMethodService(this.client));
38
+ this.prices = (0, stripe_error_status_1.withHttpStatusOnErrors)(new price_service_1.PriceService(this.client, config));
39
+ this.connectedAccounts = (0, stripe_error_status_1.withHttpStatusOnErrors)(new connected_account_service_1.ConnectedAccountService(this.client, config));
40
+ this.subscriptions = (0, stripe_error_status_1.withHttpStatusOnErrors)(new subscription_service_1.SubscriptionService(this.client, config));
39
41
  }
40
42
  }
41
43
  exports.ApexStripe = ApexStripe;
@@ -1,7 +1,8 @@
1
1
  export declare class HttpError extends Error {
2
2
  readonly status: number;
3
3
  readonly message: string;
4
- constructor(status: number, message: string);
4
+ readonly shouldTryLater: boolean;
5
+ constructor(status: number, message: string, shouldTryLater?: boolean);
5
6
  readonly shouldSendEmail?: boolean;
6
7
  }
7
8
  //# sourceMappingURL=http-error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../src/errors/http-error.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;aAGhB,MAAM,EAAE,MAAM;aACd,OAAO,EAAE,MAAM;gBADf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM;IASjC,SAAgB,eAAe,CAAC,EAAE,OAAO,CAAC;CAE3C"}
1
+ {"version":3,"file":"http-error.d.ts","sourceRoot":"","sources":["../../src/errors/http-error.ts"],"names":[],"mappings":"AAAA,qBAAa,SAAU,SAAQ,KAAK;aAIhB,MAAM,EAAE,MAAM;aACd,OAAO,EAAE,MAAM;aACf,cAAc;gBAFd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,cAAc,UAAQ;IASxC,SAAgB,eAAe,CAAC,EAAE,OAAO,CAAC;CAE3C"}
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HttpError = void 0;
4
4
  class HttpError extends Error {
5
- constructor(status, message) {
5
+ // shouldTryLater marks a 4xx that asks for the same request again later, so markRefusalsDone gives its event back.
6
+ constructor(status, message, shouldTryLater = false) {
6
7
  super(message);
7
8
  this.status = status;
8
9
  this.message = message;
10
+ this.shouldTryLater = shouldTryLater;
9
11
  if (status < 500) {
10
12
  this.shouldSendEmail = false;
11
13
  }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Gives a declined card 402 and a webhook that fails Stripe's signature check 400, both with no alert, as HttpError
3
+ * refusals carry. A declined card's message is the bank's reason, written for the customer. Every other error is
4
+ * returned as it is: an app answers it 500 with the alert, and Stripe's own words never reach a member.
5
+ */
6
+ export declare function withHttpStatus(err: unknown): unknown;
7
+ /**
8
+ * True when Stripe answers that the object asked for does not exist, such as an unknown or deleted id.
9
+ */
10
+ export declare function isResourceMissing(err: unknown): boolean;
11
+ /**
12
+ * Wraps a service so every error its methods throw, or their promises reject with, passes through withHttpStatus.
13
+ * The methods run on the service itself, and what they return is passed on unchanged.
14
+ */
15
+ export declare function withHttpStatusOnErrors<T extends object>(service: T): T;
16
+ //# sourceMappingURL=stripe-error-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stripe-error-status.d.ts","sourceRoot":"","sources":["../../src/errors/stripe-error-status.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAcpD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CA0BtE"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.withHttpStatus = withHttpStatus;
7
+ exports.isResourceMissing = isResourceMissing;
8
+ exports.withHttpStatusOnErrors = withHttpStatusOnErrors;
9
+ const stripe_1 = __importDefault(require("stripe"));
10
+ /**
11
+ * Gives a declined card 402 and a webhook that fails Stripe's signature check 400, both with no alert, as HttpError
12
+ * refusals carry. A declined card's message is the bank's reason, written for the customer. Every other error is
13
+ * returned as it is: an app answers it 500 with the alert, and Stripe's own words never reach a member.
14
+ */
15
+ function withHttpStatus(err) {
16
+ if (!(err instanceof stripe_1.default.errors.StripeError) || 'status' in err) {
17
+ return err;
18
+ }
19
+ if (err instanceof stripe_1.default.errors.StripeCardError) {
20
+ return Object.assign(err, { status: 402, shouldSendEmail: false });
21
+ }
22
+ if (err instanceof stripe_1.default.errors.StripeSignatureVerificationError) {
23
+ return Object.assign(err, { status: 400, shouldSendEmail: false });
24
+ }
25
+ return err;
26
+ }
27
+ /**
28
+ * True when Stripe answers that the object asked for does not exist, such as an unknown or deleted id.
29
+ */
30
+ function isResourceMissing(err) {
31
+ return !!err && typeof err === 'object' && 'code' in err && err.code === 'resource_missing';
32
+ }
33
+ /**
34
+ * Wraps a service so every error its methods throw, or their promises reject with, passes through withHttpStatus.
35
+ * The methods run on the service itself, and what they return is passed on unchanged.
36
+ */
37
+ function withHttpStatusOnErrors(service) {
38
+ return new Proxy(service, {
39
+ get(target, key) {
40
+ const value = Reflect.get(target, key);
41
+ if (typeof value !== 'function' || key === 'constructor') {
42
+ return value;
43
+ }
44
+ return (...args) => {
45
+ try {
46
+ const result = value.apply(target, args);
47
+ if (result instanceof Promise) {
48
+ return result.catch(err => {
49
+ throw withHttpStatus(err);
50
+ });
51
+ }
52
+ return result;
53
+ }
54
+ catch (err) {
55
+ throw withHttpStatus(err);
56
+ }
57
+ };
58
+ },
59
+ });
60
+ }
@@ -26,6 +26,8 @@ export interface StripeServiceConfig {
26
26
  export interface WebhookHandlerConfig {
27
27
  webhookSecret: string;
28
28
  connectedWebhookSecret?: string;
29
+ voidUnpaidInvoicesOnEnd?: boolean; /** Defaults to true: an ended subscription's unpaid invoices are voided */
30
+ markRefusalsDone?: boolean; /** Defaults to false. When true, a refusal (a 4xx status but 408, 429 and an error with shouldTryLater) is marked done, not given back: see the README */
29
31
  }
30
32
  export {};
31
33
  //# sourceMappingURL=config.model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.model.d.ts","sourceRoot":"","sources":["../../src/models/config.model.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,KAAK,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,CAAC;AAC/E,KAAK,6BAA6B,GAAG,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,iBAAiB,CAAC;AAEvG,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC,CAAC,4CAA4C;IAC1D,OAAO,EAAE,MAAM,CAAC,CAAC,kDAAkD;CACpE;AAKD,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,qCAAqC;CAC5E;AAED,MAAM,WAAW,mBAAmB;IAElC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC,wBAAwB;IAG3C,mBAAmB,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,wDAAwD;IACnG,0BAA0B,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,8CAA8C;IAChG,yBAAyB,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,2BAA2B;IAG5E,cAAc,CAAC,EAAE,QAAQ,GAAG,U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C,wDAAwD;IACnG,0BAA0B,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,8CAA8C;IAChG,yBAAyB,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,2BAA2B;IAG5E,cAAc,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,CAAC,CAAC,2BAA2B;IAC9E,mBAAmB,CAAC,EAAE,OAAO,CAAC,CAAC,uBAAuB;IACtD,iBAAiB,CAAC,EAAE,OAAO,CAAC,CAAC,uBAAuB;IACpD,oBAAoB,CAAC,EAAE,OAAO,CAAC,CAAC,uBAAuB;IAGvD,uBAAuB,CAAC,EAAE,cAAc,GAAG,sBAAsB,CAAC,CAAC,iCAAiC;IACpG,mBAAmB,CAAC,EAAE,MAAM,CAAC,CAAC,oBAAoB;IAClD,yBAAyB,CAAC,EAAE,6BAA6B,EAAE,CAAC,CAAC,mCAAmC;IAGhG,oBAAoB,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,4BAA4B;CACxF;AAGD,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,uBAAuB,CAAC,EAAE,OAAO,CAAC,CAAC,2EAA2E;IAC9G,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAC,0JAA0J;CACvL"}
@@ -2,10 +2,19 @@ import Stripe from 'stripe';
2
2
  export interface SubscriptionSyncFields {
3
3
  status: Stripe.Subscription.Status;
4
4
  cancelAtPeriodEnd: boolean;
5
+ cancelAt: Date | null;
6
+ isEnding: boolean;
5
7
  currentPeriodStart: Date | null;
6
8
  currentPeriodEnd: Date | null;
7
9
  itemId: string;
8
10
  }
11
+ export interface SubscriptionDiscount {
12
+ code: string | null;
13
+ name: string | null;
14
+ percentOff: number | null;
15
+ amountOff: number | null;
16
+ endsAt: Date | null;
17
+ }
9
18
  export interface AffiliatePaymentParams {
10
19
  accountId: string;
11
20
  amount: number;
@@ -32,6 +41,7 @@ export interface CreateSubscriptionCheckoutSessionParams {
32
41
  returnUrl: string;
33
42
  metadata?: Record<string, string>;
34
43
  affiliate?: AffiliateSubscriptionParams;
44
+ trialPeriodDays?: number;
35
45
  }
36
46
  export type CreateCheckoutSessionParams = CreatePaymentCheckoutSessionParams | CreateSubscriptionCheckoutSessionParams;
37
47
  export interface CreatePaymentLinkParams {
@@ -66,4 +76,7 @@ export interface PendingActivationInvoice {
66
76
  subscriptionId: string;
67
77
  hostedInvoiceUrl: string | null;
68
78
  }
79
+ export interface IdempotencyOptions {
80
+ idempotencyKey?: string;
81
+ }
69
82
  //# sourceMappingURL=stripe.model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.model.d.ts","sourceRoot":"","sources":["../../src/models/stripe.model.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC;IACnC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,kBAAkB,EAAE,IAAI,GAAG,IAAI,CAAC;IAChC,gBAAgB,EAAE,IAAI,GAAG,IAAI,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;IAC/D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,kCAAkC;IACjD,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAA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KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC,eAAe,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,wBAAwB;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAKD,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
@@ -4,6 +4,7 @@ export interface ScheduleDowngradeOptions {
4
4
  transferData?: Stripe.SubscriptionScheduleUpdateParams.Phase['transfer_data'];
5
5
  phaseMetadata?: Record<string, string>;
6
6
  scheduleMetadata?: Record<string, string>;
7
+ discounts?: Stripe.SubscriptionScheduleUpdateParams.Phase.Discount[];
7
8
  }
8
9
  export interface SwitchSubscriptionPlanOptions {
9
10
  quantity?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"subscription.model.d.ts","sourceRoot":"","sources":["../../src/models/subscription.model.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,YAAY,CAAC,EAAE,MAAM,CAAC,gCAAgC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IAE9E,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEvC,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3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AAC,CAAC;CACnE;AAED,MAAM,WAAW,gCAAgC;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,iBAAiB,EAAE,CAAC;IACzF,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,eAAe,CAAC,CAAC;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,+BAA+B;IAC9C,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B"}
@@ -10,6 +10,20 @@ export interface WebhookEventStore {
10
10
  * concurrent webhook deliveries of the same event).
11
11
  */
12
12
  tryInsert(eventId: string, type: string): Promise<boolean>;
13
+ /**
14
+ * Optional. Called when handling an event tryInsert let through throws (a hook, or the package's own Stripe call
15
+ * around it), before the error goes on. Give the event back so Stripe's retry runs it again; every hook must be
16
+ * safe to rerun after failing part way, onSubscriptionDeleted even after it finished. A failure here goes to onError.
17
+ * With markRefusalsDone in the handler config, a refusal (a 4xx status but 408, 429 and an error with
18
+ * shouldTryLater) calls markDone instead, unless the void after onSubscriptionDeleted failed too.
19
+ */
20
+ release?(eventId: string): Promise<void>;
21
+ /**
22
+ * Optional. Called once the hooks for an event tryInsert let through have finished, before the 200, for a store
23
+ * that claims an event before it runs and records it as done after. A failure here goes to onError and the event
24
+ * is still answered 200. With markRefusalsDone, also called for a refusal, before it goes on.
25
+ */
26
+ markDone?(eventId: string): Promise<void>;
13
27
  }
14
28
  export interface CheckoutCompletedPayload {
15
29
  session: Stripe.Checkout.Session;
@@ -38,6 +52,8 @@ export interface WebhookHooks {
38
52
  onInvoicePaymentFailed?(payload: InvoicePaymentFailedPayload): Promise<void>;
39
53
  onSubscriptionDeleted?(payload: SubscriptionDeletedPayload): Promise<void>;
40
54
  onConnectedAccountUpdated?(payload: ConnectedAccountUpdatedPayload): Promise<void>;
55
+ onOtherEvent?(event: Stripe.Event): Promise<void>;
56
+ onRefused?(event: Stripe.Event, error: unknown): void;
41
57
  onError?(context: string, error: unknown): void;
42
58
  }
43
59
  //# sourceMappingURL=webhook.model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhook.model.d.ts","sourceRoot":"","sources":["../../src/models/webhook.model.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;OAQG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5D;AAID,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC3B;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC,gBAAgB,CAAC;IAC/B,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,2BAA2B;IAC1C,KAAK,EAAE,MAAM,CAAC,yBAAyB,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC,gCAAgC,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;CACnC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;CACzB;AAID,MAAM,WAAW,YAAY;IAG3B,UAAU,EAAE,iBAAiB,CAAC;IAI9B,mBAAmB,CAAC,CAAC,OAAO,EAAE,wBAAwB,GA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B,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,CAAC,gCAAgC,CAAC;IAC/C,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;CACnC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;CACzB;AAID,MAAM,WAAW,YAAY;IAG3B,UAAU,EAAE,iBAAiB,CAAC;IAI9B,mBAAmB,CAAC,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAIvE,aAAa,CAAC,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAI3D,sBAAsB,CAAC,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG7E,qBAAqB,CAAC,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAG3E,yBAAyB,CAAC,CAAC,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAInF,YAAY,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAKlD,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IAKtD,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;CACjD"}
@@ -1,20 +1,22 @@
1
1
  import Stripe from 'stripe';
2
2
  import { StripeServiceConfig } from './../../models/config.model';
3
- import { CreateCheckoutSessionParams } from './../../models/stripe.model';
3
+ import { CreateCheckoutSessionParams, IdempotencyOptions } from './../../models/stripe.model';
4
4
  export declare class CheckoutService {
5
5
  private readonly stripe;
6
6
  private readonly config;
7
7
  constructor(stripe: Stripe, config: Required<StripeServiceConfig>);
8
8
  /**
9
- * Creates a Stripe Checkout session and returns the client secret.
9
+ * Creates a Stripe Checkout session and returns its client secret, or the address of the page when checkoutUiMode
10
+ * is 'hosted'.
10
11
  */
11
- createCheckoutSession(params: CreateCheckoutSessionParams): Promise<string | null>;
12
+ createCheckoutSession(params: CreateCheckoutSessionParams, idempotency?: IdempotencyOptions): Promise<string | null>;
12
13
  /**
13
14
  * Creates a SetupIntent session for collecting a payment method without an immediate charge.
14
15
  */
15
- createSetupIntentSession(customerId: string): Promise<string | null>;
16
+ createSetupIntentSession(customerId: string, idempotency?: IdempotencyOptions): Promise<string | null>;
16
17
  /**
17
- * Expires a checkout session. Silently succeeds if the session is already expired.
18
+ * Expires a checkout session. Returns quietly when Stripe has no such session or the session is no longer open:
19
+ * already expired, or complete because it was paid. Any other refusal throws.
18
20
  */
19
21
  expireCheckoutSession(sessionId: string): Promise<void>;
20
22
  /**
@@ -27,5 +29,6 @@ export declare class CheckoutService {
27
29
  getPaymentIntent(paymentIntentId: string, options?: Stripe.PaymentIntentRetrieveParams): Promise<Stripe.PaymentIntent>;
28
30
  private buildPaymentSessionParams;
29
31
  private buildSubscriptionSessionParams;
32
+ private returnUrlParams;
30
33
  }
31
34
  //# sourceMappingURL=checkout.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.service.d.ts","sourceRoot":"","sources":["../../../src/services/checkout/checkout.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,2BAA2B,EAA+E,MAAM,6BAA6B,CAAC;AAEvJ,qBAAa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,MAAM,EACd,MAAM,E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,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAUnH;;;OAGG;IACU,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgBpE;;OAEG;IACU,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;IAM1I;;OAEG;IACU,gBAAgB,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,2BAA2B,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC;IAMnI,OAAO,CAAC,yBAAyB;IAyCjC,OAAO,CAAC,8BAA8B;IAwCtC,OAAO,CAAC,eAAe;CAIxB"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CheckoutService = void 0;
4
+ const stripe_error_status_1 = require("./../../errors/stripe-error-status");
5
+ const idempotency_1 = require("./../../utils/idempotency");
4
6
  class CheckoutService {
5
7
  constructor(stripe, config) {
6
8
  this.stripe = stripe;
@@ -8,34 +10,41 @@ class CheckoutService {
8
10
  }
9
11
  // Checkout sessions
10
12
  /**
11
- * Creates a Stripe Checkout session and returns the client secret.
13
+ * Creates a Stripe Checkout session and returns its client secret, or the address of the page when checkoutUiMode
14
+ * is 'hosted'.
12
15
  */
13
- async createCheckoutSession(params) {
16
+ async createCheckoutSession(params, idempotency) {
14
17
  const sessionParams = params.mode === 'subscription'
15
18
  ? this.buildSubscriptionSessionParams(params)
16
19
  : this.buildPaymentSessionParams(params);
17
- const session = await this.stripe.checkout.sessions.create(sessionParams);
18
- return session.client_secret;
20
+ const session = await (0, idempotency_1.withIdempotencyKey)(idempotency, idempotency_1.IdempotencyStep.Checkout, (...requestOptions) => this.stripe.checkout.sessions.create(sessionParams, ...requestOptions));
21
+ // A session on Stripe's own page has no client secret; the customer is sent to its address instead.
22
+ return this.config.checkoutUiMode === 'hosted' ? session.url : session.client_secret;
19
23
  }
20
24
  /**
21
25
  * Creates a SetupIntent session for collecting a payment method without an immediate charge.
22
26
  */
23
- async createSetupIntentSession(customerId) {
24
- const session = await this.stripe.setupIntents.create({
27
+ async createSetupIntentSession(customerId, idempotency) {
28
+ const session = await (0, idempotency_1.withIdempotencyKey)(idempotency, idempotency_1.IdempotencyStep.SetupIntent, (...requestOptions) => this.stripe.setupIntents.create({
25
29
  customer: customerId,
26
30
  payment_method_types: this.config.setupIntentPaymentMethods,
27
31
  usage: 'off_session',
28
- });
32
+ }, ...requestOptions));
29
33
  return session.client_secret;
30
34
  }
31
35
  /**
32
- * Expires a checkout session. Silently succeeds if the session is already expired.
36
+ * Expires a checkout session. Returns quietly when Stripe has no such session or the session is no longer open:
37
+ * already expired, or complete because it was paid. Any other refusal throws.
33
38
  */
34
39
  async expireCheckoutSession(sessionId) {
35
40
  await this.stripe.checkout.sessions.expire(sessionId)
36
- .catch(err => {
37
- const isAlreadyExpired = err && typeof err === 'object' && 'code' in err && err.code === 'resource_missing';
38
- if (!isAlreadyExpired) {
41
+ .catch(async (err) => {
42
+ if ((0, stripe_error_status_1.isResourceMissing)(err)) {
43
+ return;
44
+ }
45
+ // Stripe refuses a session that is no longer open without an error code, so the session's status decides.
46
+ const after = await this.stripe.checkout.sessions.retrieve(sessionId).catch(() => null);
47
+ if (after?.status !== 'expired' && after?.status !== 'complete') {
39
48
  throw err;
40
49
  }
41
50
  });
@@ -71,7 +80,7 @@ class CheckoutService {
71
80
  },
72
81
  }],
73
82
  metadata: params.metadata,
74
- return_url: returnUrl,
83
+ ...this.returnUrlParams(returnUrl),
75
84
  };
76
85
  if (this.config.savePaymentMethod) {
77
86
  sessionParams.saved_payment_method_options = { payment_method_save: 'enabled' };
@@ -90,7 +99,7 @@ class CheckoutService {
90
99
  return sessionParams;
91
100
  }
92
101
  buildSubscriptionSessionParams(params) {
93
- const { customerId, priceIds, returnUrl, affiliate } = params;
102
+ const { customerId, priceIds, returnUrl, affiliate, trialPeriodDays } = params;
94
103
  const sessionParams = {
95
104
  ui_mode: this.config.checkoutUiMode,
96
105
  mode: 'subscription',
@@ -102,8 +111,14 @@ class CheckoutService {
102
111
  line_items: priceIds.map(priceId => ({ quantity: params.quantity, price: priceId })),
103
112
  customer: customerId,
104
113
  metadata: params.metadata,
105
- return_url: returnUrl,
114
+ ...this.returnUrlParams(returnUrl),
106
115
  };
116
+ if (trialPeriodDays) {
117
+ sessionParams.subscription_data = {
118
+ ...sessionParams.subscription_data,
119
+ trial_period_days: trialPeriodDays,
120
+ };
121
+ }
107
122
  if (this.config.savePaymentMethod) {
108
123
  sessionParams.saved_payment_method_options = { payment_method_save: 'enabled' };
109
124
  }
@@ -116,5 +131,9 @@ class CheckoutService {
116
131
  }
117
132
  return sessionParams;
118
133
  }
134
+ // Stripe sends the customer back from its own page to success_url; return_url is only for a page the app shows.
135
+ returnUrlParams(returnUrl) {
136
+ return this.config.checkoutUiMode === 'hosted' ? { success_url: returnUrl } : { return_url: returnUrl };
137
+ }
119
138
  }
120
139
  exports.CheckoutService = CheckoutService;
@@ -1,4 +1,5 @@
1
1
  import Stripe from 'stripe';
2
+ import { IdempotencyOptions } from './../../models/stripe.model';
2
3
  import { StripeServiceConfig } from './../../models/config.model';
3
4
  export declare class ConnectedAccountService {
4
5
  private readonly stripe;
@@ -7,7 +8,7 @@ export declare class ConnectedAccountService {
7
8
  /**
8
9
  * Creates a new Stripe Connect account and returns its ID.
9
10
  */
10
- createConnectedAccount(metadata?: Record<string, string>): Promise<string>;
11
+ createConnectedAccount(metadata?: Record<string, string>, idempotency?: IdempotencyOptions): Promise<string>;
11
12
  /**
12
13
  * Permanently deletes a connected account.
13
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"connected-account.service.d.ts","sourceRoot":"","sources":["../../../src/services/connected-account/connected-account.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,uBAAuB;IAGhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IAExD;;OAEG;IACU,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IASvF;;OAEG;IACU,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACU,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9K;;OAEG;IACU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMjE"}
1
+ {"version":3,"file":"connected-account.service.d.ts","sourceRoot":"","sources":["../../../src/services/connected-account/connected-account.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElE,qBAAa,uBAAuB;IAGhC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IAExD;;OAEG;IACU,sBAAsB,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IASzH;;OAEG;IACU,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIrE;;;OAGG;IACU,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;IAW9K;;OAEG;IACU,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAMjE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectedAccountService = void 0;
4
+ const idempotency_1 = require("./../../utils/idempotency");
4
5
  class ConnectedAccountService {
5
6
  constructor(stripe, config) {
6
7
  this.stripe = stripe;
@@ -9,11 +10,11 @@ class ConnectedAccountService {
9
10
  /**
10
11
  * Creates a new Stripe Connect account and returns its ID.
11
12
  */
12
- async createConnectedAccount(metadata) {
13
- const account = await this.stripe.accounts.create({
13
+ async createConnectedAccount(metadata, idempotency) {
14
+ const account = await (0, idempotency_1.withIdempotencyKey)(idempotency, idempotency_1.IdempotencyStep.ConnectedAccount, (...requestOptions) => this.stripe.accounts.create({
14
15
  type: this.config.connectedAccountType,
15
16
  metadata,
16
- });
17
+ }, ...requestOptions));
17
18
  return account.id;
18
19
  }
19
20
  /**
@@ -1,11 +1,12 @@
1
1
  import Stripe from 'stripe';
2
+ import { IdempotencyOptions } from './../../models/stripe.model';
2
3
  export declare class CustomerService {
3
4
  private readonly stripe;
4
5
  constructor(stripe: Stripe);
5
6
  /**
6
7
  * Creates a new Stripe customer with the given name and email.
7
8
  */
8
- createCustomer(firstName: string, lastName: string, email: string): Promise<Stripe.Customer>;
9
+ createCustomer(firstName: string, lastName: string, email: string, idempotency?: IdempotencyOptions): Promise<Stripe.Customer>;
9
10
  /**
10
11
  * Sets the default payment method on a customer's invoice settings.
11
12
  */
@@ -1 +1 @@
1
- {"version":3,"file":"customer.service.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customer.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,qBAAa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAEjC;;OAEG;IACU,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIzG;;OAEG;IACU,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5G"}
1
+ {"version":3,"file":"customer.service.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customer.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEjE,qBAAa,eAAe;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAEjC;;OAEG;IACU,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IAI3I;;OAEG;IACU,kCAAkC,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAM5G"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CustomerService = void 0;
4
+ const idempotency_1 = require("./../../utils/idempotency");
4
5
  class CustomerService {
5
6
  constructor(stripe) {
6
7
  this.stripe = stripe;
@@ -8,8 +9,8 @@ class CustomerService {
8
9
  /**
9
10
  * Creates a new Stripe customer with the given name and email.
10
11
  */
11
- async createCustomer(firstName, lastName, email) {
12
- return this.stripe.customers.create({ name: `${firstName} ${lastName}`, email });
12
+ async createCustomer(firstName, lastName, email, idempotency) {
13
+ return (0, idempotency_1.withIdempotencyKey)(idempotency, idempotency_1.IdempotencyStep.Customer, (...requestOptions) => this.stripe.customers.create({ name: `${firstName} ${lastName}`, email }, ...requestOptions));
13
14
  }
14
15
  /**
15
16
  * Sets the default payment method on a customer's invoice settings.
@@ -1,15 +1,33 @@
1
1
  import Stripe from 'stripe';
2
2
  import { StripeServiceConfig } from './../../models/config.model';
3
- import { CreateInvoiceParams, PendingActivationInvoice } from './../../models/stripe.model';
3
+ import { CreateInvoiceParams, IdempotencyOptions, PendingActivationInvoice } from './../../models/stripe.model';
4
4
  export declare class InvoiceService {
5
5
  private readonly stripe;
6
6
  private readonly config;
7
7
  constructor(stripe: Stripe, config: Required<StripeServiceConfig>);
8
8
  /**
9
9
  * Creates, finalizes, and delivers a standalone invoice for a customer.
10
- * Sends the invoice by email if invoiceCollectionMethod is 'send_invoice', otherwise finalizes it for auto-charge.
10
+ * Sends the invoice by email if invoiceCollectionMethod is 'send_invoice'. Otherwise it is finalized with automatic
11
+ * collection on, and Stripe charges the customer's default card about an hour later.
11
12
  */
12
- createInvoice(params: CreateInvoiceParams): Promise<Stripe.Invoice>;
13
+ createInvoice(params: CreateInvoiceParams, idempotency?: IdempotencyOptions): Promise<Stripe.Invoice>;
14
+ /**
15
+ * Voids the invoices an ended subscription left unpaid, so nobody pays for a plan that is over. Stripe keeps
16
+ * them payable after a cancel. Only a canceled subscription is touched: voiding a live subscription's latest
17
+ * invoice changes the subscription's status. An invoice paid or voided in the meantime is left as it is, so a
18
+ * second call changes nothing. Returns how many invoices this call voided.
19
+ */
20
+ voidUnpaidInvoices(subscription: Stripe.Subscription): Promise<number>;
21
+ /**
22
+ * Charges a past due subscription's latest invoice now, with the card the subscription charges. Call it once the
23
+ * customer has saved a new card: Stripe's retries keep their own schedule after a card change. Returns the invoice
24
+ * once it is paid, also when a retry paid it meanwhile (the subscription then reads active), and null when there is
25
+ * nothing to pay (a draft or a void invoice, or an active subscription's open one, is never charged here). Throws 402
26
+ * with the card's reason when the charge is declined, after which Stripe keeps retrying as before, or when it waits
27
+ * for the bank's check, which the customer then confirms on the invoice's page (findConfirmPaymentUrl).
28
+ */
29
+ payPastDueInvoice(subscription: Stripe.Subscription, idempotency?: IdempotencyOptions): Promise<Stripe.Invoice | null>;
30
+ private static isPayable;
13
31
  /**
14
32
  * Lists payment attempts for an invoice.
15
33
  */
@@ -20,5 +38,11 @@ export declare class InvoiceService {
20
38
  * whose subscription has not yet been cancelled or expired.
21
39
  */
22
40
  findPendingActivationInvoice(customerId: string): Promise<PendingActivationInvoice | null>;
41
+ /**
42
+ * Returns Stripe's page for a past due subscription's latest invoice when its payment waits for the customer's bank
43
+ * check (3D Secure), or null. Stripe never retries such a payment, so only the customer's confirmation on that page
44
+ * pays it. A declined card or any other failure gives null.
45
+ */
46
+ findConfirmPaymentUrl(subscription: Stripe.Subscription): Promise<string | null>;
23
47
  }
24
48
  //# sourceMappingURL=invoice.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"invoice.service.d.ts","sourceRoot":"","sources":["../../../src/services/invoice/invoice.service.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAE5F,qBAAa,cAAc;IAGvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ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