@birtalanrobert/commerce 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +4 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/migrations/1790000000000-AddSavedCardsAndKind.d.ts +30 -0
  6. package/dist/migrations/1790000000000-AddSavedCardsAndKind.d.ts.map +1 -0
  7. package/dist/migrations/1790000000000-AddSavedCardsAndKind.js +89 -0
  8. package/dist/migrations/1790000000000-AddSavedCardsAndKind.js.map +1 -0
  9. package/dist/nestjs/commerce.service.d.ts +65 -1
  10. package/dist/nestjs/commerce.service.d.ts.map +1 -1
  11. package/dist/nestjs/commerce.service.js +98 -2
  12. package/dist/nestjs/commerce.service.js.map +1 -1
  13. package/dist/nestjs/index.d.ts +6 -3
  14. package/dist/nestjs/index.d.ts.map +1 -1
  15. package/dist/nestjs/index.js +9 -3
  16. package/dist/nestjs/index.js.map +1 -1
  17. package/dist/nestjs/payment.entity.d.ts +11 -19
  18. package/dist/nestjs/payment.entity.d.ts.map +1 -1
  19. package/dist/nestjs/payment.entity.js +13 -0
  20. package/dist/nestjs/payment.entity.js.map +1 -1
  21. package/dist/nestjs/saved-card.entity.d.ts +42 -0
  22. package/dist/nestjs/saved-card.entity.d.ts.map +1 -0
  23. package/dist/nestjs/saved-card.entity.js +109 -0
  24. package/dist/nestjs/saved-card.entity.js.map +1 -0
  25. package/dist/payments.d.ts +54 -0
  26. package/dist/payments.d.ts.map +1 -0
  27. package/dist/payments.js +30 -0
  28. package/dist/payments.js.map +1 -0
  29. package/dist/providers/port.d.ts +68 -0
  30. package/dist/providers/port.d.ts.map +1 -1
  31. package/dist/providers/stripe.d.ts +12 -1
  32. package/dist/providers/stripe.d.ts.map +1 -1
  33. package/dist/providers/stripe.js +71 -1
  34. package/dist/providers/stripe.js.map +1 -1
  35. package/package.json +12 -4
  36. package/src/index.ts +11 -0
  37. package/src/migrations/1790000000000-AddSavedCardsAndKind.ts +92 -0
  38. package/src/nestjs/commerce.service.ts +170 -3
  39. package/src/nestjs/index.ts +15 -3
  40. package/src/nestjs/payment.entity.ts +17 -25
  41. package/src/nestjs/saved-card.entity.ts +69 -0
  42. package/src/payments.ts +67 -0
  43. package/src/providers/port.ts +74 -0
  44. package/src/providers/stripe.ts +90 -1
@@ -30,6 +30,15 @@ let Payment = class Payment extends database_1.BaseEntity {
30
30
  /** What it was for, as the owning product names it: `booking:<id>`. */
31
31
  subject;
32
32
  method;
33
+ /**
34
+ * What it was for.
35
+ *
36
+ * A tip belongs to the person who earned it and a product to neither the
37
+ * service nor the diary — a report counting all three as service income tells
38
+ * a business its haircuts are more profitable than they are, and no amount of
39
+ * arithmetic afterwards can separate them again.
40
+ */
41
+ kind;
33
42
  state;
34
43
  /** Minor units, and the currency it was taken in. Never a float. */
35
44
  amount;
@@ -75,6 +84,10 @@ __decorate([
75
84
  (0, typeorm_1.Column)('varchar', { length: 16 }),
76
85
  __metadata("design:type", String)
77
86
  ], Payment.prototype, "method", void 0);
87
+ __decorate([
88
+ (0, typeorm_1.Column)('varchar', { length: 16, default: 'sale' }),
89
+ __metadata("design:type", String)
90
+ ], Payment.prototype, "kind", void 0);
78
91
  __decorate([
79
92
  (0, typeorm_1.Column)('varchar', { length: 24, default: 'pending' }),
80
93
  __metadata("design:type", String)
@@ -1 +1 @@
1
- {"version":3,"file":"payment.entity.js","sourceRoot":"","sources":["../../src/nestjs/payment.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwD;AACxD,uDAA2E;AA8B3E;;;;;;;;;;;;GAYG;AAMI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,qBAAU;IAErC,QAAQ,CAAU;IAElB,uEAAuE;IAEvE,OAAO,CAAU;IAGjB,MAAM,CAAiB;IAGvB,KAAK,CAAgB;IAErB,oEAAoE;IAEpE,MAAM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+ import { BaseEntity } from '@birtalanrobert/database';
2
+ /**
3
+ * A card kept for later, with the words the customer agreed to.
4
+ *
5
+ * **The strongest thing a business can do about people not turning up, short of
6
+ * taking their money.** Nothing leaves the customer's account when they book;
7
+ * the card is simply there if a fee is later decided on — and the decision is
8
+ * still a human one made days afterwards, which is exactly when asking somebody
9
+ * to enter a card is a conversation that does not happen.
10
+ *
11
+ * A hold is not a substitute and must not be sold as one: providers expire an
12
+ * authorisation within days, and an appointment is usually further away.
13
+ *
14
+ * **The consent is stored as text, not as a flag.** A boolean records that
15
+ * somebody clicked; the sentence records what they were told they were agreeing
16
+ * to, which is the only thing worth anything when they say they were not.
17
+ */
18
+ export declare class SavedCard extends BaseEntity {
19
+ tenantId: string;
20
+ /**
21
+ * Whose card it is, as the owning product names it: `customer:<id>`.
22
+ *
23
+ * No foreign key, for the same reason a payment has none — one product hangs
24
+ * a card off a salon's client, another off a tenant's guest.
25
+ */
26
+ subject: string;
27
+ provider: string;
28
+ /** The customer on *our* account, which is where a saved card can be used. */
29
+ customerRef: string;
30
+ paymentMethodRef: string;
31
+ /** Enough to recognise it — "Visa ending 4242" — and nothing more. */
32
+ brand: string | null;
33
+ last4: string | null;
34
+ expiryMonth: number | null;
35
+ expiryYear: number | null;
36
+ /** What they were told they were agreeing to, in the language they read it. */
37
+ consentText: string;
38
+ consentedAt: Date;
39
+ /** Who stored it, where a member of staff did it on somebody's behalf. */
40
+ storedBy: string | null;
41
+ }
42
+ //# sourceMappingURL=saved-card.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saved-card.entity.d.ts","sourceRoot":"","sources":["../../src/nestjs/saved-card.entity.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,qBAGa,SAAU,SAAQ,UAAU;IAEvC,QAAQ,EAAG,MAAM,CAAC;IAElB;;;;;OAKG;IAEH,OAAO,EAAG,MAAM,CAAC;IAGjB,QAAQ,EAAG,MAAM,CAAC;IAElB,8EAA8E;IAE9E,WAAW,EAAG,MAAM,CAAC;IAGrB,gBAAgB,EAAG,MAAM,CAAC;IAE1B,sEAAsE;IAEtE,KAAK,EAAG,MAAM,GAAG,IAAI,CAAC;IAGtB,KAAK,EAAG,MAAM,GAAG,IAAI,CAAC;IAGtB,WAAW,EAAG,MAAM,GAAG,IAAI,CAAC;IAG5B,UAAU,EAAG,MAAM,GAAG,IAAI,CAAC;IAE3B,+EAA+E;IAE/E,WAAW,EAAG,MAAM,CAAC;IAGrB,WAAW,EAAG,IAAI,CAAC;IAEnB,0EAA0E;IAE1E,QAAQ,EAAG,MAAM,GAAG,IAAI,CAAC;CAC1B"}
@@ -0,0 +1,109 @@
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.SavedCard = void 0;
13
+ const typeorm_1 = require("typeorm");
14
+ const database_1 = require("@birtalanrobert/database");
15
+ /**
16
+ * A card kept for later, with the words the customer agreed to.
17
+ *
18
+ * **The strongest thing a business can do about people not turning up, short of
19
+ * taking their money.** Nothing leaves the customer's account when they book;
20
+ * the card is simply there if a fee is later decided on — and the decision is
21
+ * still a human one made days afterwards, which is exactly when asking somebody
22
+ * to enter a card is a conversation that does not happen.
23
+ *
24
+ * A hold is not a substitute and must not be sold as one: providers expire an
25
+ * authorisation within days, and an appointment is usually further away.
26
+ *
27
+ * **The consent is stored as text, not as a flag.** A boolean records that
28
+ * somebody clicked; the sentence records what they were told they were agreeing
29
+ * to, which is the only thing worth anything when they say they were not.
30
+ */
31
+ let SavedCard = class SavedCard extends database_1.BaseEntity {
32
+ tenantId;
33
+ /**
34
+ * Whose card it is, as the owning product names it: `customer:<id>`.
35
+ *
36
+ * No foreign key, for the same reason a payment has none — one product hangs
37
+ * a card off a salon's client, another off a tenant's guest.
38
+ */
39
+ subject;
40
+ provider;
41
+ /** The customer on *our* account, which is where a saved card can be used. */
42
+ customerRef;
43
+ paymentMethodRef;
44
+ /** Enough to recognise it — "Visa ending 4242" — and nothing more. */
45
+ brand;
46
+ last4;
47
+ expiryMonth;
48
+ expiryYear;
49
+ /** What they were told they were agreeing to, in the language they read it. */
50
+ consentText;
51
+ consentedAt;
52
+ /** Who stored it, where a member of staff did it on somebody's behalf. */
53
+ storedBy;
54
+ };
55
+ exports.SavedCard = SavedCard;
56
+ __decorate([
57
+ (0, typeorm_1.Column)('uuid'),
58
+ __metadata("design:type", String)
59
+ ], SavedCard.prototype, "tenantId", void 0);
60
+ __decorate([
61
+ (0, typeorm_1.Column)('varchar', { length: 160 }),
62
+ __metadata("design:type", String)
63
+ ], SavedCard.prototype, "subject", void 0);
64
+ __decorate([
65
+ (0, typeorm_1.Column)('varchar', { length: 32 }),
66
+ __metadata("design:type", String)
67
+ ], SavedCard.prototype, "provider", void 0);
68
+ __decorate([
69
+ (0, typeorm_1.Column)('varchar', { length: 128 }),
70
+ __metadata("design:type", String)
71
+ ], SavedCard.prototype, "customerRef", void 0);
72
+ __decorate([
73
+ (0, typeorm_1.Column)('varchar', { length: 128 }),
74
+ __metadata("design:type", String)
75
+ ], SavedCard.prototype, "paymentMethodRef", void 0);
76
+ __decorate([
77
+ (0, typeorm_1.Column)('varchar', { length: 24, nullable: true }),
78
+ __metadata("design:type", Object)
79
+ ], SavedCard.prototype, "brand", void 0);
80
+ __decorate([
81
+ (0, typeorm_1.Column)('varchar', { length: 4, nullable: true }),
82
+ __metadata("design:type", Object)
83
+ ], SavedCard.prototype, "last4", void 0);
84
+ __decorate([
85
+ (0, typeorm_1.Column)('int', { name: 'expiry_month', nullable: true }),
86
+ __metadata("design:type", Object)
87
+ ], SavedCard.prototype, "expiryMonth", void 0);
88
+ __decorate([
89
+ (0, typeorm_1.Column)('int', { name: 'expiry_year', nullable: true }),
90
+ __metadata("design:type", Object)
91
+ ], SavedCard.prototype, "expiryYear", void 0);
92
+ __decorate([
93
+ (0, typeorm_1.Column)('varchar', { length: 1000 }),
94
+ __metadata("design:type", String)
95
+ ], SavedCard.prototype, "consentText", void 0);
96
+ __decorate([
97
+ (0, typeorm_1.Column)('timestamptz'),
98
+ __metadata("design:type", Date)
99
+ ], SavedCard.prototype, "consentedAt", void 0);
100
+ __decorate([
101
+ (0, typeorm_1.Column)('uuid', { nullable: true }),
102
+ __metadata("design:type", Object)
103
+ ], SavedCard.prototype, "storedBy", void 0);
104
+ exports.SavedCard = SavedCard = __decorate([
105
+ (0, typeorm_1.Entity)('mortar_saved_cards'),
106
+ (0, typeorm_1.Unique)('uq_saved_cards_tenant_id', ['tenantId', 'id']),
107
+ (0, typeorm_1.Index)('ix_saved_cards_subject', ['tenantId', 'subject'])
108
+ ], SavedCard);
109
+ //# sourceMappingURL=saved-card.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saved-card.entity.js","sourceRoot":"","sources":["../../src/nestjs/saved-card.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAAwD;AACxD,uDAAsD;AAEtD;;;;;;;;;;;;;;;GAeG;AAII,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,qBAAU;IAEvC,QAAQ,CAAU;IAElB;;;;;OAKG;IAEH,OAAO,CAAU;IAGjB,QAAQ,CAAU;IAElB,8EAA8E;IAE9E,WAAW,CAAU;IAGrB,gBAAgB,CAAU;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,IAAA,gBAAM,EAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACV;oBA7Cd,SAAS;IAHrB,IAAA,gBAAM,EAAC,oBAAoB,CAAC;IAC5B,IAAA,gBAAM,EAAC,0BAA0B,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;IACtD,IAAA,eAAK,EAAC,wBAAwB,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;GAC5C,SAAS,CA8CrB"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Where a payment is, and what may still be done to it.
3
+ *
4
+ * Pure and dependency-free, because a console renders a refund button from
5
+ * exactly the rule the server enforces — and a screen that offers a refund the
6
+ * server will refuse is a screen that teaches its user not to trust it.
7
+ */
8
+ /**
9
+ * How the money arrived.
10
+ *
11
+ * `card` is the only one this package processes. The rest are **recorded, not
12
+ * taken** — and recording them is not a lesser feature: a salon is mostly cash
13
+ * at the counter, a restaurant's till takes meal vouchers, and a box office
14
+ * takes notes. A report that only counts what a provider processed tells a
15
+ * business a fraction of its own takings, which is worse than telling it
16
+ * nothing because it looks complete.
17
+ */
18
+ export type PaymentMethod = 'card' | 'cash' | 'terminal' | 'voucher' | 'transfer';
19
+ /**
20
+ * Where a payment is.
21
+ *
22
+ * `authorized` is separate from `captured` on purpose: a card held against a
23
+ * no-show fee is authorised and never captured unless the fee is applied, and
24
+ * that decision is a human one.
25
+ */
26
+ export type PaymentState = 'pending' | 'authorized' | 'captured' | 'failed' | 'refunded' | 'partially_refunded' | 'cancelled';
27
+ /**
28
+ * What a payment was for.
29
+ *
30
+ * Not decoration: a tip belongs to the person who earned it and a product to
31
+ * neither the service nor the diary, so a revenue report that counts all three
32
+ * as service income tells a business its haircuts are more profitable than they
33
+ * are. The distinction has to survive into the row, because it cannot be
34
+ * recovered from an amount afterwards.
35
+ */
36
+ export type PaymentKind = 'sale' | 'deposit' | 'fee' | 'tip' | 'product';
37
+ /**
38
+ * Whether money actually moved, and so can be given back.
39
+ *
40
+ * A held card has taken nothing yet — releasing it is a different operation
41
+ * with a different name — and a failed charge never will. Both look refundable
42
+ * to anyone reasoning from "there is a payment row here", which is why this is
43
+ * one function and not a condition written twice.
44
+ */
45
+ export declare const isRefundable: (state: PaymentState) => boolean;
46
+ /**
47
+ * What is left to give back, in minor units.
48
+ *
49
+ * Takes the two amounts rather than a row, because they arrive as strings from
50
+ * a `bigint` column in one caller and as numbers in another, and the subtraction
51
+ * should not be where that difference is discovered.
52
+ */
53
+ export declare const refundableAmount: (amount: number, refunded: number) => number;
54
+ //# sourceMappingURL=payments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC;AAElF;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,YAAY,GACZ,UAAU,GACV,QAAQ,GACR,UAAU,GACV,oBAAoB,GACpB,WAAW,CAAC;AAEhB;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,YAAY,KAAG,OACK,CAAC;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,KAAG,MACpC,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ /**
3
+ * Where a payment is, and what may still be done to it.
4
+ *
5
+ * Pure and dependency-free, because a console renders a refund button from
6
+ * exactly the rule the server enforces — and a screen that offers a refund the
7
+ * server will refuse is a screen that teaches its user not to trust it.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.refundableAmount = exports.isRefundable = void 0;
11
+ /**
12
+ * Whether money actually moved, and so can be given back.
13
+ *
14
+ * A held card has taken nothing yet — releasing it is a different operation
15
+ * with a different name — and a failed charge never will. Both look refundable
16
+ * to anyone reasoning from "there is a payment row here", which is why this is
17
+ * one function and not a condition written twice.
18
+ */
19
+ const isRefundable = (state) => state === 'captured' || state === 'partially_refunded';
20
+ exports.isRefundable = isRefundable;
21
+ /**
22
+ * What is left to give back, in minor units.
23
+ *
24
+ * Takes the two amounts rather than a row, because they arrive as strings from
25
+ * a `bigint` column in one caller and as numbers in another, and the subtraction
26
+ * should not be where that difference is discovered.
27
+ */
28
+ const refundableAmount = (amount, refunded) => Math.max(0, amount - refunded);
29
+ exports.refundableAmount = refundableAmount;
30
+ //# sourceMappingURL=payments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payments.js","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAyCH;;;;;;;GAOG;AACI,MAAM,YAAY,GAAG,CAAC,KAAmB,EAAW,EAAE,CAC3D,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,oBAAoB,CAAC;AAD5C,QAAA,YAAY,gBACgC;AAEzD;;;;;;GAMG;AACI,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAE,QAAgB,EAAU,EAAE,CAC3E,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC;AADpB,QAAA,gBAAgB,oBACI"}
@@ -25,6 +25,20 @@ export interface OnboardingLink {
25
25
  export interface ChargeRequest {
26
26
  /** The business being paid, as the provider knows it. */
27
27
  readonly account: string;
28
+ /**
29
+ * The customer, where one is being charged again rather than for the first
30
+ * time. Held on *our* account rather than the business's, because that is
31
+ * where a saved card lives under a destination charge.
32
+ */
33
+ readonly customer?: string;
34
+ /**
35
+ * A card already saved, to charge without anybody present.
36
+ *
37
+ * The whole point of storing one: a no-show fee is decided days later, and
38
+ * asking somebody who did not turn up to enter a card is a conversation that
39
+ * does not happen.
40
+ */
41
+ readonly paymentMethod?: string;
28
42
  readonly amount: number;
29
43
  readonly currency: string;
30
44
  /** Our cut, taken on top rather than out of the business's money. */
@@ -53,9 +67,44 @@ export interface ChargeResult {
53
67
  * failure and must not be handled as one.
54
68
  */
55
69
  readonly redirectUrl?: string;
70
+ /**
71
+ * What the browser needs to finish paying, when the customer is present.
72
+ *
73
+ * A charge created on the server has no card attached to it yet — the card is
74
+ * entered in a browser, against the provider's own script, so that the number
75
+ * never reaches us. Without this the payment can be created and never paid,
76
+ * which is the state a customer reads as "it took my booking and lost my
77
+ * money".
78
+ */
79
+ readonly clientSecret?: string;
56
80
  readonly instrument?: string;
57
81
  readonly detail?: string;
58
82
  }
83
+ /** A card being stored for later, rather than charged now. */
84
+ export interface SaveCardRequest {
85
+ /** An existing customer to attach it to, where the person already has one. */
86
+ readonly customer?: string;
87
+ /** What it is being saved for, carried through for matching a webhook back. */
88
+ readonly subject: string;
89
+ readonly reference: string;
90
+ }
91
+ export interface SaveCardResult {
92
+ /** The customer the card will hang off, created here if there was none. */
93
+ readonly customer: string;
94
+ /** The provider's handle on this attempt, to read the result back from. */
95
+ readonly externalId: string;
96
+ /** What the browser confirms against. */
97
+ readonly clientSecret: string;
98
+ }
99
+ /** A card that was actually stored, read back after the browser confirmed it. */
100
+ export interface StoredCard {
101
+ readonly customer: string;
102
+ readonly paymentMethod: string;
103
+ readonly brand?: string;
104
+ readonly last4?: string;
105
+ readonly expiryMonth?: number;
106
+ readonly expiryYear?: number;
107
+ }
59
108
  export interface RefundRequest {
60
109
  readonly externalId: string;
61
110
  readonly amount: number;
@@ -82,6 +131,25 @@ export interface PaymentProvider {
82
131
  capture(externalId: string, amount?: number): Promise<ChargeResult>;
83
132
  /** Releases a hold without taking anything. */
84
133
  release(externalId: string): Promise<void>;
134
+ /**
135
+ * Starts storing a card without charging it.
136
+ *
137
+ * The strongest thing a business can do about no-shows short of taking money:
138
+ * nothing leaves the customer's account, and the card is there if a fee is
139
+ * later decided on. A hold is not a substitute — providers expire one within
140
+ * days, and an appointment is usually further away than that.
141
+ */
142
+ saveCard(request: SaveCardRequest): Promise<SaveCardResult>;
143
+ /**
144
+ * What was actually stored, once the browser says it finished.
145
+ *
146
+ * Read back from the provider rather than believed from the browser: what a
147
+ * page reports is what a page was told to report, and a saved card is
148
+ * something a business will later charge money against.
149
+ */
150
+ storedCard(externalId: string): Promise<StoredCard | undefined>;
151
+ /** Forgets a stored card, at the customer's request or the business's. */
152
+ forgetCard(paymentMethod: string): Promise<void>;
85
153
  refund(request: RefundRequest): Promise<{
86
154
  externalId: string;
87
155
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"port.d.ts","sourceRoot":"","sources":["../../src/providers/port.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;IACpD,uDAAuD;IACvD,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,wEAAwE;IACxE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,W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AAC,UAAU,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9F,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAEtD,wEAAwE;IACxE,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IAEpE,+CAA+C;IAC/C,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3C;;;;;;;OAOG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAE5D;;;;;;OAMG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAEhE,0EAA0E;IAC1E,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAEhE;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAAC;CAC5F"}
@@ -1,5 +1,5 @@
1
1
  import Stripe from 'stripe';
2
- import type { ChargeRequest, ChargeResult, OnboardingLink, PaymentProvider, ProviderAccount, ProviderEvent, RefundRequest } from './port';
2
+ import type { ChargeRequest, ChargeResult, OnboardingLink, PaymentProvider, ProviderAccount, ProviderEvent, RefundRequest, SaveCardRequest, SaveCardResult, StoredCard } from './port';
3
3
  export interface StripeConnectOptions {
4
4
  secretKey: string;
5
5
  /** The endpoint's signing secret, as the dashboard gives it: `whsec_…`. */
@@ -31,6 +31,17 @@ export declare class StripeConnect implements PaymentProvider {
31
31
  charge(request: ChargeRequest): Promise<ChargeResult>;
32
32
  capture(externalId: string, amount?: number): Promise<ChargeResult>;
33
33
  release(externalId: string): Promise<void>;
34
+ /**
35
+ * Starts storing a card without charging it.
36
+ *
37
+ * The customer is created on **our** account rather than the business's. That
38
+ * is not a preference: under a destination charge the money lands on the
39
+ * business's account while the card is ours to charge, and a customer created
40
+ * on the business's account cannot be used from here at all.
41
+ */
42
+ saveCard(request: SaveCardRequest): Promise<SaveCardResult>;
43
+ storedCard(externalId: string): Promise<StoredCard | undefined>;
44
+ forgetCard(paymentMethod: string): Promise<void>;
34
45
  refund(request: RefundRequest): Promise<{
35
46
  externalId: string;
36
47
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.d.ts","sourceRoot":"","sources":["../../src/providers/stripe.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,KAAK,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,QAAQ,CAAC;AAEhB,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,aAAc,YAAW,eAAe;IAIvC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAHpC,QAAQ,CAAC,IAAI,YAAY;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEH,OAAO,EAAE,oBAAoB;IAIpD,OAAO,CACX,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC;IAarB,OAAO,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B,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,CAAC;IAarB,OAAO,CACX,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,cAAc,CAAC;IAkBpB,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAsDrD,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IAanE,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;;;;OAOG;IACG,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;IA4B3D,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC;IAwB/D,UAAU,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIhD,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAarE,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS;CAoB3F"}
@@ -70,10 +70,31 @@ class StripeConnect {
70
70
  ...(request.applicationFee > 0 ? { application_fee_amount: request.applicationFee } : {}),
71
71
  capture_method: request.capture ? 'automatic' : 'manual',
72
72
  ...(request.description ? { description: request.description } : {}),
73
+ ...(request.customer ? { customer: request.customer } : {}),
74
+ /*
75
+ * A stored card is confirmed here and now, with nobody present.
76
+ *
77
+ * `off_session` is what tells the network the customer is not sitting
78
+ * there — it is also what makes the bank decline rather than ask for
79
+ * a code it has nobody to ask, which is the honest outcome for a fee
80
+ * charged three days after an appointment.
81
+ */
82
+ ...(request.paymentMethod
83
+ ? {
84
+ payment_method: request.paymentMethod,
85
+ confirm: true,
86
+ off_session: true,
87
+ }
88
+ : {}),
73
89
  // Carried through so a webhook can be matched back to what it paid
74
90
  // for without a lookup table of our own.
75
91
  metadata: { subject: request.subject },
76
- automatic_payment_methods: { enabled: true },
92
+ /*
93
+ * Only where a card still has to be entered. Offering a redirect
94
+ * method to a charge that is already confirmed against a stored card
95
+ * is a contradiction the provider rejects.
96
+ */
97
+ ...(request.paymentMethod ? {} : { automatic_payment_methods: { enabled: true } }),
77
98
  },
78
99
  // The provider's own idempotency, so a retried request — a timeout, a
79
100
  // double submit — does not charge somebody twice.
@@ -96,6 +117,54 @@ class StripeConnect {
96
117
  async release(externalId) {
97
118
  await this.stripe.paymentIntents.cancel(externalId);
98
119
  }
120
+ /**
121
+ * Starts storing a card without charging it.
122
+ *
123
+ * The customer is created on **our** account rather than the business's. That
124
+ * is not a preference: under a destination charge the money lands on the
125
+ * business's account while the card is ours to charge, and a customer created
126
+ * on the business's account cannot be used from here at all.
127
+ */
128
+ async saveCard(request) {
129
+ const customer = request.customer ??
130
+ (await this.stripe.customers.create({ metadata: { subject: request.subject } }, { idempotencyKey: `customer-${request.reference}` })).id;
131
+ const intent = await this.stripe.setupIntents.create({
132
+ customer,
133
+ usage: 'off_session',
134
+ payment_method_types: ['card'],
135
+ metadata: { subject: request.subject },
136
+ }, { idempotencyKey: request.reference });
137
+ return {
138
+ customer,
139
+ externalId: intent.id,
140
+ // Non-null because a setup intent is created precisely to be confirmed.
141
+ clientSecret: intent.client_secret ?? '',
142
+ };
143
+ }
144
+ async storedCard(externalId) {
145
+ const intent = await this.stripe.setupIntents.retrieve(externalId, {
146
+ expand: ['payment_method'],
147
+ });
148
+ const method = intent.payment_method;
149
+ if (!method || typeof method === 'string' || !intent.customer)
150
+ return undefined;
151
+ const customer = typeof intent.customer === 'string' ? intent.customer : intent.customer.id;
152
+ return {
153
+ customer,
154
+ paymentMethod: method.id,
155
+ ...(method.card
156
+ ? {
157
+ brand: method.card.brand,
158
+ last4: method.card.last4,
159
+ expiryMonth: method.card.exp_month,
160
+ expiryYear: method.card.exp_year,
161
+ }
162
+ : {}),
163
+ };
164
+ }
165
+ async forgetCard(paymentMethod) {
166
+ await this.stripe.paymentMethods.detach(paymentMethod);
167
+ }
99
168
  async refund(request) {
100
169
  const refund = await this.stripe.refunds.create({
101
170
  payment_intent: request.externalId,
@@ -160,6 +229,7 @@ function interpretIntent(intent) {
160
229
  return {
161
230
  externalId: intent.id,
162
231
  state,
232
+ ...(intent.client_secret ? { clientSecret: intent.client_secret } : {}),
163
233
  ...(intent.next_action?.redirect_to_url?.url
164
234
  ? { redirectUrl: intent.next_action.redirect_to_url.url }
165
235
  : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.js","sourceRoot":"","sources":["../../src/providers/stripe.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAmB5B;;;;;;;;;;;;;GAaG;AACH,MAAa,aAAa;IAIK;IAHpB,IAAI,GAAG,QAAQ,CAAC;IACR,MAAM,CAAS;IAEhC,YAA6B,OAA6B;QAA7B,YAAO,GAAP,OAAO,CAAsB;QACxD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,gBAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAO,CACX,UAAyB,EACzB,OAAe,EACf,KAAc;QAEd,MAAM,OAAO,GAAG,UAAU;YACxB,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC;YACjD,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBAChC,IAAI,EAAE,SAAS;gBACf,OAAO;gBACP,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3B,YAAY,EAAE,EAA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EAAkE;AAClE,SAAS,OAAO,CAAC,KAAc;IAC7B,MAAM,OAAO,GACX,KAAK,YAAY,gBAAM,CAAC,MAAM,CAAC,WAAW;QACxC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,0BAA0B,CAAC;QAC/C,CAAC,CAAC,KAAK,YAAY,KAAK;YACtB,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,0BAA0B,CAAC;IAEnC,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC9D,CAAC"}
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "@birtalanrobert/commerce",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "description": "Taking money on a business's behalf: payout onboarding, payments, refunds and the record of both",
5
5
  "license": "AGPL-3.0-only",
6
6
  "author": "Robert Birtalan",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/birtalanrobert/mortar.git",
10
+ "directory": "packages/commerce"
11
+ },
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
7
15
  "type": "commonjs",
8
16
  "main": "./dist/index.js",
9
17
  "types": "./dist/index.d.ts",
@@ -31,11 +39,11 @@
31
39
  ],
32
40
  "dependencies": {
33
41
  "stripe": "^22.6.0",
34
- "@birtalanrobert/context": "^1.1.0",
35
- "@birtalanrobert/money": "^1.0.0",
36
42
  "@birtalanrobert/database": "^1.0.0",
43
+ "@birtalanrobert/context": "^1.1.0",
44
+ "@birtalanrobert/http": "^2.0.0",
37
45
  "@birtalanrobert/tenancy": "^1.1.0",
38
- "@birtalanrobert/http": "^2.0.0"
46
+ "@birtalanrobert/money": "^1.0.0"
39
47
  },
40
48
  "peerDependencies": {
41
49
  "@nestjs/common": "^11.0.0",
package/src/index.ts CHANGED
@@ -27,6 +27,14 @@ export {
27
27
  type PayoutStatus,
28
28
  } from './deposits';
29
29
 
30
+ export {
31
+ isRefundable,
32
+ refundableAmount,
33
+ type PaymentKind,
34
+ type PaymentMethod,
35
+ type PaymentState,
36
+ } from './payments';
37
+
30
38
  export type {
31
39
  ChargeRequest,
32
40
  ChargeResult,
@@ -35,6 +43,9 @@ export type {
35
43
  ProviderAccount,
36
44
  ProviderEvent,
37
45
  RefundRequest,
46
+ SaveCardRequest,
47
+ SaveCardResult,
48
+ StoredCard,
38
49
  } from './providers/port';
39
50
 
40
51
  export { StripeConnect, type StripeConnectOptions } from './providers/stripe';