@birtalanrobert/commerce 2.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/src/index.ts +16 -5
- package/stripe/package.json +5 -0
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ canTakeMoney('pending'); // false — the provider has not verified them yet
|
|
|
27
27
|
## Using it in a NestJS application
|
|
28
28
|
|
|
29
29
|
```ts
|
|
30
|
-
import { StripeConnect } from '@birtalanrobert/commerce';
|
|
30
|
+
import { StripeConnect } from '@birtalanrobert/commerce/stripe';
|
|
31
31
|
import {
|
|
32
32
|
COMMERCE_PROVIDER,
|
|
33
33
|
CommerceService,
|
|
@@ -55,6 +55,14 @@ export class PaymentsModule {}
|
|
|
55
55
|
Register `commerceEntities` and `commerceMigrations` with the data source, as
|
|
56
56
|
with every other package here.
|
|
57
57
|
|
|
58
|
+
**Three entry points, and the split is deliberate.** The root is pure — what a
|
|
59
|
+
deposit comes to, whether a business may sell yet, whether a payment can still
|
|
60
|
+
be refunded — because a console decides all three while somebody drags a
|
|
61
|
+
slider. `/nestjs` holds the service, the entities and the migrations.
|
|
62
|
+
`/stripe` holds the vendor's client on its own, because importing it pulls in
|
|
63
|
+
the whole SDK, and a barrel that re-exported it once put a payments SDK into a
|
|
64
|
+
booking console's first load.
|
|
65
|
+
|
|
58
66
|
## The parts worth knowing before using it
|
|
59
67
|
|
|
60
68
|
- **A business cannot be charged for until the provider says it may be paid
|
package/dist/index.d.ts
CHANGED
|
@@ -12,13 +12,14 @@
|
|
|
12
12
|
* the mistake that makes both hard to reason about — they differ in who pays
|
|
13
13
|
* whom, in which Stripe account, and in what happens when one fails.
|
|
14
14
|
*
|
|
15
|
-
* **This entry point is pure
|
|
16
|
-
*
|
|
17
|
-
* shows both while somebody drags a
|
|
18
|
-
*
|
|
15
|
+
* **This entry point is pure**, and stays that way by leaving things out. What
|
|
16
|
+
* a deposit comes to and whether a business may sell yet are decided without a
|
|
17
|
+
* database or a provider, because a console shows both while somebody drags a
|
|
18
|
+
* slider. Storage and the container are behind `/nestjs`; the Stripe client is
|
|
19
|
+
* behind `/stripe`, because a barrel that re-exports it puts the vendor's whole
|
|
20
|
+
* SDK into every bundle that wanted to divide a price by three.
|
|
19
21
|
*/
|
|
20
22
|
export { balanceAfter, canTakeMoney, depositFor, payoutBlockReason, type DepositKind, type DepositPolicy, type PayoutStatus, } from './deposits';
|
|
21
23
|
export { isRefundable, refundableAmount, type PaymentKind, type PaymentMethod, type PaymentState, } from './payments';
|
|
22
24
|
export type { ChargeRequest, ChargeResult, OnboardingLink, PaymentProvider, ProviderAccount, ProviderEvent, RefundRequest, SaveCardRequest, SaveCardResult, StoredCard, } from './providers/port';
|
|
23
|
-
export { StripeConnect, type StripeConnectOptions } from './providers/stripe';
|
|
24
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,YAAY,GAClB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,GACX,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.refundableAmount = exports.isRefundable = exports.payoutBlockReason = exports.depositFor = exports.canTakeMoney = exports.balanceAfter = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Taking money on a business's behalf.
|
|
6
6
|
*
|
|
@@ -15,10 +15,12 @@ exports.StripeConnect = exports.refundableAmount = exports.isRefundable = export
|
|
|
15
15
|
* the mistake that makes both hard to reason about — they differ in who pays
|
|
16
16
|
* whom, in which Stripe account, and in what happens when one fails.
|
|
17
17
|
*
|
|
18
|
-
* **This entry point is pure
|
|
19
|
-
*
|
|
20
|
-
* shows both while somebody drags a
|
|
21
|
-
*
|
|
18
|
+
* **This entry point is pure**, and stays that way by leaving things out. What
|
|
19
|
+
* a deposit comes to and whether a business may sell yet are decided without a
|
|
20
|
+
* database or a provider, because a console shows both while somebody drags a
|
|
21
|
+
* slider. Storage and the container are behind `/nestjs`; the Stripe client is
|
|
22
|
+
* behind `/stripe`, because a barrel that re-exports it puts the vendor's whole
|
|
23
|
+
* SDK into every bundle that wanted to divide a price by three.
|
|
22
24
|
*/
|
|
23
25
|
var deposits_1 = require("./deposits");
|
|
24
26
|
Object.defineProperty(exports, "balanceAfter", { enumerable: true, get: function () { return deposits_1.balanceAfter; } });
|
|
@@ -28,6 +30,14 @@ Object.defineProperty(exports, "payoutBlockReason", { enumerable: true, get: fun
|
|
|
28
30
|
var payments_1 = require("./payments");
|
|
29
31
|
Object.defineProperty(exports, "isRefundable", { enumerable: true, get: function () { return payments_1.isRefundable; } });
|
|
30
32
|
Object.defineProperty(exports, "refundableAmount", { enumerable: true, get: function () { return payments_1.refundableAmount; } });
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
/*
|
|
34
|
+
* `StripeConnect` is deliberately NOT re-exported here.
|
|
35
|
+
*
|
|
36
|
+
* It lives at `@birtalanrobert/commerce/stripe`, because importing it pulls in
|
|
37
|
+
* the vendor's whole SDK — and this entry point is imported by browser code
|
|
38
|
+
* that only wants to know what a deposit comes to. Re-exporting it put 30 KB of
|
|
39
|
+
* a payments SDK into a console's first load for a screen that never calls it:
|
|
40
|
+
* a barrel is a bundling decision, and the only way to keep this one pure is to
|
|
41
|
+
* leave the heavy thing out of it.
|
|
42
|
+
*/
|
|
33
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAQoB;AAPlB,wGAAA,YAAY,OAAA;AACZ,wGAAA,YAAY,OAAA;AACZ,sGAAA,UAAU,OAAA;AACV,6GAAA,iBAAiB,OAAA;AAMnB,uCAMoB;AALlB,wGAAA,YAAY,OAAA;AACZ,4GAAA,gBAAgB,OAAA;AAmBlB;;;;;;;;;GASG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@birtalanrobert/commerce",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.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",
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
"types": "./dist/index.d.ts",
|
|
21
21
|
"default": "./dist/index.js"
|
|
22
22
|
},
|
|
23
|
+
"./stripe": {
|
|
24
|
+
"types": "./dist/providers/stripe.d.ts",
|
|
25
|
+
"default": "./dist/providers/stripe.js"
|
|
26
|
+
},
|
|
23
27
|
"./nestjs": {
|
|
24
28
|
"types": "./dist/nestjs/index.d.ts",
|
|
25
29
|
"default": "./dist/nestjs/index.js"
|
|
@@ -34,16 +38,17 @@
|
|
|
34
38
|
"README.md",
|
|
35
39
|
"LICENSE",
|
|
36
40
|
"NOTICE",
|
|
41
|
+
"stripe",
|
|
37
42
|
"nestjs",
|
|
38
43
|
"CHANGELOG.md"
|
|
39
44
|
],
|
|
40
45
|
"dependencies": {
|
|
41
46
|
"stripe": "^22.6.0",
|
|
42
|
-
"@birtalanrobert/database": "^1.0.0",
|
|
43
47
|
"@birtalanrobert/context": "^1.1.0",
|
|
44
48
|
"@birtalanrobert/http": "^2.0.0",
|
|
45
|
-
"@birtalanrobert/
|
|
46
|
-
"@birtalanrobert/
|
|
49
|
+
"@birtalanrobert/money": "^1.0.0",
|
|
50
|
+
"@birtalanrobert/database": "^1.0.0",
|
|
51
|
+
"@birtalanrobert/tenancy": "^1.1.0"
|
|
47
52
|
},
|
|
48
53
|
"peerDependencies": {
|
|
49
54
|
"@nestjs/common": "^11.0.0",
|
package/src/index.ts
CHANGED
|
@@ -12,10 +12,12 @@
|
|
|
12
12
|
* the mistake that makes both hard to reason about — they differ in who pays
|
|
13
13
|
* whom, in which Stripe account, and in what happens when one fails.
|
|
14
14
|
*
|
|
15
|
-
* **This entry point is pure
|
|
16
|
-
*
|
|
17
|
-
* shows both while somebody drags a
|
|
18
|
-
*
|
|
15
|
+
* **This entry point is pure**, and stays that way by leaving things out. What
|
|
16
|
+
* a deposit comes to and whether a business may sell yet are decided without a
|
|
17
|
+
* database or a provider, because a console shows both while somebody drags a
|
|
18
|
+
* slider. Storage and the container are behind `/nestjs`; the Stripe client is
|
|
19
|
+
* behind `/stripe`, because a barrel that re-exports it puts the vendor's whole
|
|
20
|
+
* SDK into every bundle that wanted to divide a price by three.
|
|
19
21
|
*/
|
|
20
22
|
export {
|
|
21
23
|
balanceAfter,
|
|
@@ -48,4 +50,13 @@ export type {
|
|
|
48
50
|
StoredCard,
|
|
49
51
|
} from './providers/port';
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
/*
|
|
54
|
+
* `StripeConnect` is deliberately NOT re-exported here.
|
|
55
|
+
*
|
|
56
|
+
* It lives at `@birtalanrobert/commerce/stripe`, because importing it pulls in
|
|
57
|
+
* the vendor's whole SDK — and this entry point is imported by browser code
|
|
58
|
+
* that only wants to know what a deposit comes to. Re-exporting it put 30 KB of
|
|
59
|
+
* a payments SDK into a console's first load for a screen that never calls it:
|
|
60
|
+
* a barrel is a bundling decision, and the only way to keep this one pure is to
|
|
61
|
+
* leave the heavy thing out of it.
|
|
62
|
+
*/
|