run402 2.44.0 → 2.45.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 +1 -1
- package/lib/allowance.mjs +7 -3
- package/lib/billing.mjs +79 -81
- package/package.json +1 -1
- package/sdk/dist/namespaces/billing.d.ts +22 -12
- package/sdk/dist/namespaces/billing.d.ts.map +1 -1
- package/sdk/dist/namespaces/billing.js +38 -48
- package/sdk/dist/namespaces/billing.js.map +1 -1
package/README.md
CHANGED
|
@@ -188,7 +188,7 @@ Private keys never leave AWS KMS. $0.04/day rental + $0.000005/call.
|
|
|
188
188
|
```bash
|
|
189
189
|
run402 tier set prototype # free on testnet
|
|
190
190
|
run402 tier set hobby # $5 / 30 days
|
|
191
|
-
run402 billing
|
|
191
|
+
run402 billing checkout <org_id> --product tier --tier hobby # Stripe alternative
|
|
192
192
|
```
|
|
193
193
|
|
|
194
194
|
## State
|
package/lib/allowance.mjs
CHANGED
|
@@ -14,7 +14,7 @@ Subcommands:
|
|
|
14
14
|
fund Request test funds from the faucet (Base Sepolia or Tempo)
|
|
15
15
|
balance Show on-chain balances and Run402 billing balance
|
|
16
16
|
export Print the allowance address (useful for scripting)
|
|
17
|
-
checkout Create
|
|
17
|
+
checkout Create an org balance checkout session (--amount <usd_micros>)
|
|
18
18
|
history View billing transaction history (--limit <n>)
|
|
19
19
|
|
|
20
20
|
Notes:
|
|
@@ -33,7 +33,7 @@ Examples:
|
|
|
33
33
|
`;
|
|
34
34
|
|
|
35
35
|
const SUB_HELP = {
|
|
36
|
-
checkout: `run402 allowance checkout — Create
|
|
36
|
+
checkout: `run402 allowance checkout — Create an org balance checkout session
|
|
37
37
|
|
|
38
38
|
Usage:
|
|
39
39
|
run402 allowance checkout --amount <usd_micros>
|
|
@@ -280,7 +280,11 @@ async function checkout(args) {
|
|
|
280
280
|
}
|
|
281
281
|
const amount = parseIntegerFlag("--amount", amountRaw, { min: 1 });
|
|
282
282
|
try {
|
|
283
|
-
const
|
|
283
|
+
const org = await getSdk().billing.lookupOrganization(w.address);
|
|
284
|
+
const data = await getSdk().billing.createCheckout(org.organization_id, {
|
|
285
|
+
product: "balance_topup",
|
|
286
|
+
amountUsdMicros: amount,
|
|
287
|
+
});
|
|
284
288
|
console.log(JSON.stringify(data, null, 2));
|
|
285
289
|
} catch (err) {
|
|
286
290
|
reportSdkError(err);
|
package/lib/billing.mjs
CHANGED
|
@@ -2,57 +2,47 @@ import { getSdk } from "./sdk.mjs";
|
|
|
2
2
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
3
3
|
import { assertKnownFlags, flagValue, normalizeArgv, parseIntegerFlag, positionalArgs } from "./argparse.mjs";
|
|
4
4
|
|
|
5
|
-
const HELP = `run402 billing — Email organizations
|
|
5
|
+
const HELP = `run402 billing — Email organizations and org checkouts
|
|
6
6
|
|
|
7
7
|
Usage:
|
|
8
8
|
run402 billing <subcommand> [args...]
|
|
9
9
|
|
|
10
10
|
Subcommands:
|
|
11
11
|
create-email <email> Create an email organization
|
|
12
|
-
link-wallet <org_id> <wallet>
|
|
13
|
-
|
|
14
|
-
buy-email-pack [--email <e> | --wallet <w>] Buy \$5 email pack (10,000 emails)
|
|
12
|
+
link-wallet <org_id> <wallet> Link a wallet to an email organization
|
|
13
|
+
checkout <identifier> --product <p> Create an org checkout
|
|
15
14
|
auto-recharge <org_id> <on|off> [--threshold <n>]
|
|
16
15
|
balance <identifier> Balance by organization id (UUID), wallet (0x...), or email
|
|
17
16
|
history <identifier> [--limit <n>] Ledger history by organization id (UUID), wallet, or email
|
|
18
17
|
|
|
19
18
|
Examples:
|
|
20
19
|
run402 billing create-email user@example.com
|
|
21
|
-
run402 billing
|
|
22
|
-
run402 billing
|
|
20
|
+
run402 billing checkout 00000000-0000-4000-8000-000000000001 --product tier --tier hobby
|
|
21
|
+
run402 billing checkout 0x1234... --product email-pack
|
|
22
|
+
run402 billing checkout 0x1234... --product balance-topup --amount 5000000
|
|
23
23
|
run402 billing auto-recharge org_abc on --threshold 2000
|
|
24
24
|
run402 billing balance user@example.com
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
const SUB_HELP = {
|
|
28
|
-
|
|
28
|
+
checkout: `run402 billing checkout — Create an org checkout
|
|
29
29
|
|
|
30
30
|
Usage:
|
|
31
|
-
run402 billing
|
|
31
|
+
run402 billing checkout <identifier> --product <tier|email-pack|balance-topup> [options]
|
|
32
32
|
|
|
33
33
|
Arguments:
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
Options:
|
|
37
|
-
--email <e> Email organization to charge
|
|
38
|
-
--wallet <w> Wallet address (0x...) to associate with the checkout
|
|
39
|
-
|
|
40
|
-
Examples:
|
|
41
|
-
run402 billing tier-checkout hobby --email user@example.com
|
|
42
|
-
run402 billing tier-checkout pro --wallet 0x1234...
|
|
43
|
-
`,
|
|
44
|
-
"buy-email-pack": `run402 billing buy-email-pack — Buy a $5 email pack (10,000 emails)
|
|
45
|
-
|
|
46
|
-
Usage:
|
|
47
|
-
run402 billing buy-email-pack [--email <e> | --wallet <w>]
|
|
34
|
+
<identifier> Organization id (UUID), wallet (0x...), or email.
|
|
35
|
+
Wallet/email are resolved to the organization id first.
|
|
48
36
|
|
|
49
37
|
Options:
|
|
50
|
-
--
|
|
51
|
-
--
|
|
38
|
+
--product <p> tier, email-pack, or balance-topup
|
|
39
|
+
--tier <tier> Tier name for --product tier
|
|
40
|
+
--amount <n> USD micros for --product balance-topup
|
|
52
41
|
|
|
53
42
|
Examples:
|
|
54
|
-
run402 billing
|
|
55
|
-
run402 billing
|
|
43
|
+
run402 billing checkout 00000000-0000-4000-8000-000000000001 --product tier --tier hobby
|
|
44
|
+
run402 billing checkout 0x1234... --product email-pack
|
|
45
|
+
run402 billing checkout 0x1234... --product balance-topup --amount 5000000
|
|
56
46
|
`,
|
|
57
47
|
"auto-recharge": `run402 billing auto-recharge — Toggle email-pack auto-recharge
|
|
58
48
|
|
|
@@ -144,21 +134,76 @@ Examples:
|
|
|
144
134
|
`,
|
|
145
135
|
};
|
|
146
136
|
|
|
147
|
-
function
|
|
148
|
-
if (
|
|
137
|
+
function normalizeCheckoutProduct(raw) {
|
|
138
|
+
if (!raw) {
|
|
149
139
|
fail({
|
|
150
140
|
code: "BAD_USAGE",
|
|
151
|
-
message: "
|
|
152
|
-
hint: "
|
|
141
|
+
message: "Missing --product.",
|
|
142
|
+
hint: "Use --product tier, --product email-pack, or --product balance-topup.",
|
|
153
143
|
});
|
|
154
144
|
}
|
|
155
|
-
|
|
145
|
+
const product = String(raw).replace(/-/g, "_");
|
|
146
|
+
if (product === "tier" || product === "email_pack" || product === "balance_topup") {
|
|
147
|
+
return product;
|
|
148
|
+
}
|
|
149
|
+
fail({
|
|
150
|
+
code: "BAD_USAGE",
|
|
151
|
+
message: `Unknown checkout product: ${raw}`,
|
|
152
|
+
hint: "Use tier, email-pack, or balance-topup.",
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
async function checkout(args) {
|
|
157
|
+
const parsedArgs = normalizeArgv(args);
|
|
158
|
+
const valueFlags = ["--product", "--tier", "--amount"];
|
|
159
|
+
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
160
|
+
const positionals = positionalArgs(parsedArgs, valueFlags);
|
|
161
|
+
const identifier = positionals[0];
|
|
162
|
+
if (positionals.length > 1) {
|
|
163
|
+
fail({ code: "BAD_USAGE", message: `Unexpected argument for billing checkout: ${positionals[1]}` });
|
|
164
|
+
}
|
|
165
|
+
if (!identifier) {
|
|
156
166
|
fail({
|
|
157
167
|
code: "BAD_USAGE",
|
|
158
|
-
message: "
|
|
159
|
-
hint: "
|
|
168
|
+
message: "Missing <identifier>.",
|
|
169
|
+
hint: "run402 billing checkout <identifier> --product <tier|email-pack|balance-topup>",
|
|
160
170
|
});
|
|
161
171
|
}
|
|
172
|
+
const product = normalizeCheckoutProduct(flagValue(parsedArgs, "--product"));
|
|
173
|
+
let checkoutRequest;
|
|
174
|
+
if (product === "tier") {
|
|
175
|
+
const tier = flagValue(parsedArgs, "--tier");
|
|
176
|
+
if (!tier) {
|
|
177
|
+
fail({
|
|
178
|
+
code: "BAD_USAGE",
|
|
179
|
+
message: "Missing --tier for tier checkout.",
|
|
180
|
+
hint: "run402 billing checkout <identifier> --product tier --tier hobby",
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
checkoutRequest = { product: "tier", tier };
|
|
184
|
+
} else if (product === "email_pack") {
|
|
185
|
+
checkoutRequest = { product: "email_pack" };
|
|
186
|
+
} else {
|
|
187
|
+
const amountRaw = flagValue(parsedArgs, "--amount");
|
|
188
|
+
if (amountRaw === null) {
|
|
189
|
+
fail({
|
|
190
|
+
code: "BAD_USAGE",
|
|
191
|
+
message: "Missing --amount for balance-topup checkout.",
|
|
192
|
+
hint: "run402 billing checkout <identifier> --product balance-topup --amount 5000000",
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
checkoutRequest = {
|
|
196
|
+
product: "balance_topup",
|
|
197
|
+
amountUsdMicros: parseIntegerFlag("--amount", amountRaw, { min: 1 }),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
const org = await getSdk().billing.lookupOrganization(identifier);
|
|
202
|
+
const data = await getSdk().billing.createCheckout(org.organization_id, checkoutRequest);
|
|
203
|
+
console.log(JSON.stringify(data, null, 2));
|
|
204
|
+
} catch (err) {
|
|
205
|
+
reportSdkError(err);
|
|
206
|
+
}
|
|
162
207
|
}
|
|
163
208
|
|
|
164
209
|
async function createEmail(args) {
|
|
@@ -214,52 +259,6 @@ async function linkWallet(args) {
|
|
|
214
259
|
}
|
|
215
260
|
}
|
|
216
261
|
|
|
217
|
-
async function tierCheckout(args) {
|
|
218
|
-
const parsedArgs = normalizeArgv(args);
|
|
219
|
-
const valueFlags = ["--email", "--wallet"];
|
|
220
|
-
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
221
|
-
const positionals = positionalArgs(parsedArgs, valueFlags);
|
|
222
|
-
const tier = positionals[0];
|
|
223
|
-
if (positionals.length > 1) {
|
|
224
|
-
fail({ code: "BAD_USAGE", message: `Unexpected argument for billing tier-checkout: ${positionals[1]}` });
|
|
225
|
-
}
|
|
226
|
-
if (!tier) {
|
|
227
|
-
fail({
|
|
228
|
-
code: "BAD_USAGE",
|
|
229
|
-
message: "Missing <tier>.",
|
|
230
|
-
hint: "run402 billing tier-checkout <tier> [--email <e> | --wallet <w>]",
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
const email = flagValue(parsedArgs, "--email");
|
|
234
|
-
const wallet = flagValue(parsedArgs, "--wallet");
|
|
235
|
-
requireSingleBillingIdentifier(email, wallet);
|
|
236
|
-
try {
|
|
237
|
-
const data = await getSdk().billing.tierCheckout(tier, { email: email ?? undefined, wallet: wallet ?? undefined });
|
|
238
|
-
console.log(JSON.stringify(data, null, 2));
|
|
239
|
-
} catch (err) {
|
|
240
|
-
reportSdkError(err);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
async function buyPack(args) {
|
|
245
|
-
const parsedArgs = normalizeArgv(args);
|
|
246
|
-
const valueFlags = ["--email", "--wallet"];
|
|
247
|
-
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
248
|
-
const extra = positionalArgs(parsedArgs, valueFlags);
|
|
249
|
-
if (extra.length > 0) {
|
|
250
|
-
fail({ code: "BAD_USAGE", message: `Unexpected argument for billing buy-email-pack: ${extra[0]}` });
|
|
251
|
-
}
|
|
252
|
-
const email = flagValue(parsedArgs, "--email");
|
|
253
|
-
const wallet = flagValue(parsedArgs, "--wallet");
|
|
254
|
-
requireSingleBillingIdentifier(email, wallet);
|
|
255
|
-
try {
|
|
256
|
-
const data = await getSdk().billing.buyEmailPack({ email: email ?? undefined, wallet: wallet ?? undefined });
|
|
257
|
-
console.log(JSON.stringify(data, null, 2));
|
|
258
|
-
} catch (err) {
|
|
259
|
-
reportSdkError(err);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
262
|
async function autoRecharge(args) {
|
|
264
263
|
const parsedArgs = normalizeArgv(args);
|
|
265
264
|
const valueFlags = ["--threshold"];
|
|
@@ -349,8 +348,7 @@ export async function run(sub, args) {
|
|
|
349
348
|
switch (sub) {
|
|
350
349
|
case "create-email": await createEmail(args); break;
|
|
351
350
|
case "link-wallet": await linkWallet(args); break;
|
|
352
|
-
case "
|
|
353
|
-
case "buy-email-pack": await buyPack(args); break;
|
|
351
|
+
case "checkout": await checkout(args); break;
|
|
354
352
|
case "auto-recharge": await autoRecharge(args); break;
|
|
355
353
|
case "balance": await balance(args); break;
|
|
356
354
|
case "history": await history(args); break;
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* accept any of the three identifier forms and resolve internally. Organization
|
|
8
8
|
* reads require SIWX from a wallet linked to the organization (or matching the
|
|
9
9
|
* looked-up `?wallet`), or an admin key; email lookups are admin-only.
|
|
10
|
-
* Mutations such as link-wallet
|
|
11
|
-
*
|
|
10
|
+
* Mutations such as link-wallet, checkout creation, and auto-recharge require
|
|
11
|
+
* an org credential (or admin).
|
|
12
12
|
*/
|
|
13
13
|
import type { Client } from "../kernel.js";
|
|
14
14
|
import type { ProjectTier } from "./projects.types.js";
|
|
@@ -42,6 +42,8 @@ export interface BillingHistoryResult {
|
|
|
42
42
|
entries: BillingHistoryEntry[];
|
|
43
43
|
}
|
|
44
44
|
export interface CreateCheckoutResult {
|
|
45
|
+
organization_id: string;
|
|
46
|
+
product: CheckoutProduct;
|
|
45
47
|
checkout_url: string;
|
|
46
48
|
topup_id: string;
|
|
47
49
|
}
|
|
@@ -74,11 +76,23 @@ export interface LinkWalletResult {
|
|
|
74
76
|
/** Present on v1.46+ gateways; undefined when the gateway predates the field. */
|
|
75
77
|
pool_implications?: LinkWalletPoolImplications;
|
|
76
78
|
}
|
|
77
|
-
export interface OrganizationCheckoutIdentifier {
|
|
78
|
-
email?: string;
|
|
79
|
-
wallet?: string;
|
|
80
|
-
}
|
|
81
79
|
export type OrganizationIdentifier = string;
|
|
80
|
+
export type CheckoutProduct = "balance_topup" | "tier" | "email_pack";
|
|
81
|
+
export type CreateCheckoutOptions = {
|
|
82
|
+
product: "balance_topup";
|
|
83
|
+
amountUsdMicros: number;
|
|
84
|
+
successUrl?: string;
|
|
85
|
+
cancelUrl?: string;
|
|
86
|
+
} | {
|
|
87
|
+
product: "tier";
|
|
88
|
+
tier: ProjectTier;
|
|
89
|
+
successUrl?: string;
|
|
90
|
+
cancelUrl?: string;
|
|
91
|
+
} | {
|
|
92
|
+
product: "email_pack";
|
|
93
|
+
successUrl?: string;
|
|
94
|
+
cancelUrl?: string;
|
|
95
|
+
};
|
|
82
96
|
export interface AutoRechargeOptions {
|
|
83
97
|
organizationId: string;
|
|
84
98
|
enabled: boolean;
|
|
@@ -117,8 +131,8 @@ export declare class Billing {
|
|
|
117
131
|
* Requires SIWX from a wallet linked to the organization, or an admin key.
|
|
118
132
|
*/
|
|
119
133
|
getHistory(identifier: OrganizationIdentifier, limit?: number): Promise<BillingHistoryResult>;
|
|
120
|
-
/** Create a Stripe checkout URL
|
|
121
|
-
createCheckout(
|
|
134
|
+
/** Create a Stripe checkout URL for an organization. */
|
|
135
|
+
createCheckout(organizationId: string, checkout: CreateCheckoutOptions): Promise<CreateCheckoutResult>;
|
|
122
136
|
/** Create an email-only (no-wallet) organization. Sends a verification email. */
|
|
123
137
|
createEmailOrganization(email: string): Promise<EmailOrganization>;
|
|
124
138
|
/**
|
|
@@ -132,10 +146,6 @@ export declare class Billing {
|
|
|
132
146
|
* so callers can warn before the merge pushes usage `over_limit`.
|
|
133
147
|
*/
|
|
134
148
|
linkWallet(organizationId: string, wallet: string): Promise<LinkWalletResult>;
|
|
135
|
-
/** Create a Stripe checkout for a tier subscription/renewal/upgrade. */
|
|
136
|
-
tierCheckout(tier: string, identifier: OrganizationCheckoutIdentifier): Promise<CreateCheckoutResult>;
|
|
137
|
-
/** Buy a $5 email pack (10,000 emails). */
|
|
138
|
-
buyEmailPack(identifier: OrganizationCheckoutIdentifier): Promise<CreateCheckoutResult>;
|
|
139
149
|
/** Enable/disable email-pack auto-recharge. */
|
|
140
150
|
setAutoRecharge(opts: AutoRechargeOptions): Promise<void>;
|
|
141
151
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/namespaces/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAS3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,kBAAkB;IACjC,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;IAChC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,oB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,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;gBAEvC,MAAM,EAAE,MAAM;IAM3C,wEAAwE;IAClE,YAAY,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAInF;;;;;;;OAOG;IACG,eAAe,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAItF;;;;;OAKG;IACG,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIzF,yEAAyE;IACnE,OAAO,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAIhG;;;;;OAKG;IACG,UAAU,CAAC,UAAU,EAAE,sBAAsB,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAkBnG,wDAAwD;IAClD,cAAc,CAClB,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAUhC,iFAAiF;IAC3E,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAUxE;;;;;;;;;OASG;IACG,UAAU,CACd,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,gBAAgB,CAAC;IAa5B,+CAA+C;IACzC,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBhE"}
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* accept any of the three identifier forms and resolve internally. Organization
|
|
8
8
|
* reads require SIWX from a wallet linked to the organization (or matching the
|
|
9
9
|
* looked-up `?wallet`), or an admin key; email lookups are admin-only.
|
|
10
|
-
* Mutations such as link-wallet
|
|
11
|
-
*
|
|
10
|
+
* Mutations such as link-wallet, checkout creation, and auto-recharge require
|
|
11
|
+
* an org credential (or admin).
|
|
12
12
|
*/
|
|
13
13
|
import { LocalError } from "../errors.js";
|
|
14
14
|
import { assertEmailAddress, assertEvmAddress, assertNonEmptyString, assertPositiveSafeInteger, assertStringInSet, } from "../validation.js";
|
|
@@ -64,24 +64,36 @@ function assertUsdMicrosAmount(value, name, context) {
|
|
|
64
64
|
throw new LocalError(`${name} must be a safe integer USD-micros amount of at least 500000 and whole-cent aligned.`, context);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
68
|
-
if (!
|
|
69
|
-
throw new LocalError("
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
function checkoutRequestBody(request, context) {
|
|
68
|
+
if (!request || typeof request !== "object" || Array.isArray(request)) {
|
|
69
|
+
throw new LocalError("checkout must be an object with a product.", context);
|
|
70
|
+
}
|
|
71
|
+
if (request.product === "balance_topup") {
|
|
72
|
+
assertUsdMicrosAmount(request.amountUsdMicros, "amountUsdMicros", context);
|
|
73
|
+
return {
|
|
74
|
+
product: "balance_topup",
|
|
75
|
+
amount_usd_micros: request.amountUsdMicros,
|
|
76
|
+
...(request.successUrl !== undefined ? { success_url: request.successUrl } : {}),
|
|
77
|
+
...(request.cancelUrl !== undefined ? { cancel_url: request.cancelUrl } : {}),
|
|
78
|
+
};
|
|
75
79
|
}
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
return {
|
|
80
|
+
if (request.product === "tier") {
|
|
81
|
+
assertStringInSet(request.tier, BILLING_TIERS, "tier", context);
|
|
82
|
+
return {
|
|
83
|
+
product: "tier",
|
|
84
|
+
tier: request.tier,
|
|
85
|
+
...(request.successUrl !== undefined ? { success_url: request.successUrl } : {}),
|
|
86
|
+
...(request.cancelUrl !== undefined ? { cancel_url: request.cancelUrl } : {}),
|
|
87
|
+
};
|
|
79
88
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
82
|
-
|
|
89
|
+
if (request.product === "email_pack") {
|
|
90
|
+
return {
|
|
91
|
+
product: "email_pack",
|
|
92
|
+
...(request.successUrl !== undefined ? { success_url: request.successUrl } : {}),
|
|
93
|
+
...(request.cancelUrl !== undefined ? { cancel_url: request.cancelUrl } : {}),
|
|
94
|
+
};
|
|
83
95
|
}
|
|
84
|
-
throw new LocalError("
|
|
96
|
+
throw new LocalError("product must be one of: balance_topup, tier, email_pack.", context);
|
|
85
97
|
}
|
|
86
98
|
export class Billing {
|
|
87
99
|
client;
|
|
@@ -145,15 +157,14 @@ export class Billing {
|
|
|
145
157
|
context: "fetching billing history",
|
|
146
158
|
});
|
|
147
159
|
}
|
|
148
|
-
/** Create a Stripe checkout URL
|
|
149
|
-
async createCheckout(
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return this.client.request(
|
|
160
|
+
/** Create a Stripe checkout URL for an organization. */
|
|
161
|
+
async createCheckout(organizationId, checkout) {
|
|
162
|
+
assertNonEmptyString(organizationId, "organizationId", "creating checkout");
|
|
163
|
+
const body = checkoutRequestBody(checkout, "creating checkout");
|
|
164
|
+
return this.client.request(`/orgs/v1/${encodeURIComponent(organizationId)}/checkouts`, {
|
|
153
165
|
method: "POST",
|
|
154
|
-
body
|
|
166
|
+
body,
|
|
155
167
|
context: "creating checkout",
|
|
156
|
-
withAuth: false,
|
|
157
168
|
});
|
|
158
169
|
}
|
|
159
170
|
/** Create an email-only (no-wallet) organization. Sends a verification email. */
|
|
@@ -185,39 +196,18 @@ export class Billing {
|
|
|
185
196
|
context: "linking wallet",
|
|
186
197
|
});
|
|
187
198
|
}
|
|
188
|
-
/** Create a Stripe checkout for a tier subscription/renewal/upgrade. */
|
|
189
|
-
async tierCheckout(tier, identifier) {
|
|
190
|
-
assertStringInSet(tier, BILLING_TIERS, "tier", "creating tier checkout");
|
|
191
|
-
const body = checkoutIdentifierBody(identifier, "creating tier checkout");
|
|
192
|
-
return this.client.request(`/billing/v1/tiers/${encodeURIComponent(tier)}/checkout`, {
|
|
193
|
-
method: "POST",
|
|
194
|
-
body,
|
|
195
|
-
context: "creating tier checkout",
|
|
196
|
-
withAuth: false,
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
/** Buy a $5 email pack (10,000 emails). */
|
|
200
|
-
async buyEmailPack(identifier) {
|
|
201
|
-
const body = checkoutIdentifierBody(identifier, "creating email pack checkout");
|
|
202
|
-
return this.client.request("/billing/v1/email-packs/checkout", {
|
|
203
|
-
method: "POST",
|
|
204
|
-
body,
|
|
205
|
-
context: "creating email pack checkout",
|
|
206
|
-
withAuth: false,
|
|
207
|
-
});
|
|
208
|
-
}
|
|
209
199
|
/** Enable/disable email-pack auto-recharge. */
|
|
210
200
|
async setAutoRecharge(opts) {
|
|
201
|
+
assertNonEmptyString(opts.organizationId, "organizationId", "setting auto-recharge");
|
|
211
202
|
const body = {
|
|
212
|
-
organization_id: opts.organizationId,
|
|
213
203
|
enabled: opts.enabled,
|
|
214
204
|
};
|
|
215
205
|
if (opts.threshold !== undefined) {
|
|
216
206
|
assertNonNegativeSafeInteger(opts.threshold, "threshold", "setting auto-recharge");
|
|
217
207
|
body.threshold = opts.threshold;
|
|
218
208
|
}
|
|
219
|
-
await this.client.request(
|
|
220
|
-
method: "
|
|
209
|
+
await this.client.request(`/orgs/v1/${encodeURIComponent(opts.organizationId)}/billing/auto-recharge`, {
|
|
210
|
+
method: "PATCH",
|
|
221
211
|
body,
|
|
222
212
|
context: "setting auto-recharge",
|
|
223
213
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/namespaces/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/namespaces/billing.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