@blocklet/payment-js 1.13.107
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 +19 -0
- package/lib/index.d.ts +246 -0
- package/lib/index.js +58 -0
- package/lib/resource.d.ts +14 -0
- package/lib/resource.js +60 -0
- package/lib/resources/checkout-session.d.ts +22 -0
- package/lib/resources/checkout-session.js +21 -0
- package/lib/resources/customer.d.ts +22 -0
- package/lib/resources/customer.js +24 -0
- package/lib/resources/payment-currency.d.ts +19 -0
- package/lib/resources/payment-currency.js +21 -0
- package/lib/resources/payment-intent.d.ts +22 -0
- package/lib/resources/payment-intent.js +25 -0
- package/lib/resources/payment-link.d.ts +19 -0
- package/lib/resources/payment-link.js +25 -0
- package/lib/resources/payment-method.d.ts +16 -0
- package/lib/resources/payment-method.js +21 -0
- package/lib/resources/price.d.ts +24 -0
- package/lib/resources/price.js +24 -0
- package/lib/resources/product.d.ts +25 -0
- package/lib/resources/product.js +24 -0
- package/lib/resources/subscription-item.d.ts +32 -0
- package/lib/resources/subscription-item.js +37 -0
- package/lib/resources/subscription.d.ts +34 -0
- package/lib/resources/subscription.js +45 -0
- package/lib/resources/webhook-endpoint.d.ts +19 -0
- package/lib/resources/webhook-endpoint.js +25 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# PaymentKit Node.js SDK
|
|
2
|
+
|
|
3
|
+
A Node.js SDK for the PaymentKit API, can be used to manage resources in PaymentKit.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @payment-kit/client
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```js
|
|
14
|
+
// TODO
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Resources
|
|
18
|
+
|
|
19
|
+
## Configuration
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
checkout: {
|
|
3
|
+
sessions: {
|
|
4
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
5
|
+
omit: never;
|
|
6
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
7
|
+
omit: never;
|
|
8
|
+
}>>;
|
|
9
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TCheckoutSessionExpanded>;
|
|
10
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
11
|
+
status?: string;
|
|
12
|
+
payment_status?: string;
|
|
13
|
+
nft_mint_status?: string;
|
|
14
|
+
customer_id?: string;
|
|
15
|
+
customer_did?: string;
|
|
16
|
+
payment_intent_id?: string;
|
|
17
|
+
subscription_id?: string;
|
|
18
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TCheckoutSessionExpanded>>;
|
|
19
|
+
expire: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
20
|
+
omit: never;
|
|
21
|
+
}>>;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
customers: {
|
|
25
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
26
|
+
omit: never;
|
|
27
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
28
|
+
omit: never;
|
|
29
|
+
}>>;
|
|
30
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TCustomerExpanded>;
|
|
31
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
32
|
+
omit: never;
|
|
33
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
34
|
+
omit: never;
|
|
35
|
+
}>>;
|
|
36
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
37
|
+
did?: string;
|
|
38
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TCustomerExpanded>>;
|
|
39
|
+
search: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TCustomerExpanded>>;
|
|
40
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
41
|
+
omit: never;
|
|
42
|
+
}>>;
|
|
43
|
+
};
|
|
44
|
+
products: {
|
|
45
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
46
|
+
omit: never;
|
|
47
|
+
}> & {
|
|
48
|
+
prices: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
49
|
+
omit: never;
|
|
50
|
+
}>>[];
|
|
51
|
+
}>, params?: never) => Promise<import("@did-pay/types").TProductExpanded>;
|
|
52
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TProductExpanded>;
|
|
53
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
54
|
+
omit: never;
|
|
55
|
+
}>>) => Promise<import("@did-pay/types").TProductExpanded>;
|
|
56
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
57
|
+
active?: boolean;
|
|
58
|
+
name?: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TProductExpanded>>;
|
|
61
|
+
search: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TProductExpanded>>;
|
|
62
|
+
archive: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
63
|
+
omit: never;
|
|
64
|
+
}>>;
|
|
65
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
66
|
+
omit: never;
|
|
67
|
+
}>>;
|
|
68
|
+
};
|
|
69
|
+
paymentIntents: {
|
|
70
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
71
|
+
omit: never;
|
|
72
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
73
|
+
omit: never;
|
|
74
|
+
}>>;
|
|
75
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TPaymentIntentExpanded>;
|
|
76
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
77
|
+
omit: never;
|
|
78
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
79
|
+
omit: never;
|
|
80
|
+
}>>;
|
|
81
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
82
|
+
status?: string;
|
|
83
|
+
invoice_id?: string;
|
|
84
|
+
customer_id?: string;
|
|
85
|
+
customer_did?: string;
|
|
86
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TPaymentIntentExpanded>>;
|
|
87
|
+
search: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TPaymentIntentExpanded>>;
|
|
88
|
+
};
|
|
89
|
+
paymentCurrencies: {
|
|
90
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
91
|
+
omit: never;
|
|
92
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
93
|
+
omit: never;
|
|
94
|
+
}>>;
|
|
95
|
+
retrieve: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
96
|
+
omit: never;
|
|
97
|
+
}>>;
|
|
98
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
99
|
+
omit: never;
|
|
100
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
101
|
+
omit: never;
|
|
102
|
+
}>>;
|
|
103
|
+
list: (_params: any, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
104
|
+
omit: never;
|
|
105
|
+
}>[]>;
|
|
106
|
+
};
|
|
107
|
+
paymentMethods: {
|
|
108
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
109
|
+
omit: never;
|
|
110
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
111
|
+
omit: never;
|
|
112
|
+
}>>;
|
|
113
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TPaymentMethodExpanded>;
|
|
114
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
115
|
+
omit: never;
|
|
116
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
117
|
+
omit: never;
|
|
118
|
+
}>>;
|
|
119
|
+
list: (_params: any, data?: never) => Promise<import("@did-pay/types").TPaymentMethodExpanded[]>;
|
|
120
|
+
};
|
|
121
|
+
paymentLinks: {
|
|
122
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
123
|
+
omit: never;
|
|
124
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
125
|
+
omit: never;
|
|
126
|
+
}>>;
|
|
127
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TPaymentLinkExpanded>;
|
|
128
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
129
|
+
omit: never;
|
|
130
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
131
|
+
omit: never;
|
|
132
|
+
}>>;
|
|
133
|
+
archive: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
134
|
+
omit: never;
|
|
135
|
+
}>>;
|
|
136
|
+
list: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TPaymentLinkExpanded>>;
|
|
137
|
+
};
|
|
138
|
+
prices: {
|
|
139
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
140
|
+
omit: never;
|
|
141
|
+
}>>, params?: never) => Promise<import("@did-pay/types").TPriceExpanded>;
|
|
142
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TPriceExpanded>;
|
|
143
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
144
|
+
omit: never;
|
|
145
|
+
}>>) => Promise<import("@did-pay/types").TPriceExpanded>;
|
|
146
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
147
|
+
active?: boolean;
|
|
148
|
+
type?: string;
|
|
149
|
+
currency_id?: string;
|
|
150
|
+
product_id?: string;
|
|
151
|
+
lookup_key?: string;
|
|
152
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TPriceExpanded>>;
|
|
153
|
+
search: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TPriceExpanded>>;
|
|
154
|
+
archive: (_params: string, data?: never) => Promise<import("@did-pay/types").TPriceExpanded>;
|
|
155
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
156
|
+
omit: never;
|
|
157
|
+
}>>;
|
|
158
|
+
};
|
|
159
|
+
subscriptions: {
|
|
160
|
+
create: (data: Partial<import("@did-pay/types").TSubscriptionExpanded>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
161
|
+
omit: never;
|
|
162
|
+
}>>;
|
|
163
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TSubscriptionExpanded>;
|
|
164
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
165
|
+
omit: never;
|
|
166
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
167
|
+
omit: never;
|
|
168
|
+
}>>;
|
|
169
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
170
|
+
status?: string;
|
|
171
|
+
customer_id?: string;
|
|
172
|
+
customer_did?: string;
|
|
173
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TSubscriptionExpanded>>;
|
|
174
|
+
search: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TSubscriptionExpanded>>;
|
|
175
|
+
cancel: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
176
|
+
omit: never;
|
|
177
|
+
}>>;
|
|
178
|
+
recover: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
179
|
+
omit: never;
|
|
180
|
+
}>>;
|
|
181
|
+
pause: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
182
|
+
omit: never;
|
|
183
|
+
}>>;
|
|
184
|
+
resume: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
185
|
+
omit: never;
|
|
186
|
+
}>>;
|
|
187
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
188
|
+
omit: never;
|
|
189
|
+
}>>;
|
|
190
|
+
};
|
|
191
|
+
subscriptionItems: {
|
|
192
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
193
|
+
omit: never;
|
|
194
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
195
|
+
omit: never;
|
|
196
|
+
}>>;
|
|
197
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TSubscriptionItemExpanded>;
|
|
198
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
199
|
+
omit: never;
|
|
200
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
201
|
+
omit: never;
|
|
202
|
+
}>>;
|
|
203
|
+
list: (_params: import("@did-pay/types").Pagination<{
|
|
204
|
+
subscription_id: string;
|
|
205
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TSubscriptionItemExpanded>>;
|
|
206
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
207
|
+
omit: never;
|
|
208
|
+
}>>;
|
|
209
|
+
createUsageRecord: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").UsageRecord, {
|
|
210
|
+
omit: never;
|
|
211
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").UsageRecord, {
|
|
212
|
+
omit: never;
|
|
213
|
+
}>>;
|
|
214
|
+
listUsageRecordSummaries: (_params: import("@did-pay/types").Pagination<{
|
|
215
|
+
subscription_item_id: string;
|
|
216
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TUsageRecordSummary>>;
|
|
217
|
+
listUsageRecords: (_params: import("@did-pay/types").Pagination<{
|
|
218
|
+
subscription_item_id: string;
|
|
219
|
+
}>, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TUsageRecordSummary>>;
|
|
220
|
+
};
|
|
221
|
+
webhookEndpoints: {
|
|
222
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
223
|
+
omit: never;
|
|
224
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
225
|
+
omit: never;
|
|
226
|
+
}>>;
|
|
227
|
+
retrieve: (_params: string, data?: never) => Promise<import("@did-pay/types").TWebhookEndpointExpanded>;
|
|
228
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
229
|
+
omit: never;
|
|
230
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
231
|
+
omit: never;
|
|
232
|
+
}>>;
|
|
233
|
+
list: (_params: any, data?: never) => Promise<import("@did-pay/types").Paginated<import("@did-pay/types").TWebhookEndpointExpanded>>;
|
|
234
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
235
|
+
omit: never;
|
|
236
|
+
}>>;
|
|
237
|
+
};
|
|
238
|
+
environments: {
|
|
239
|
+
getLivemode: () => boolean;
|
|
240
|
+
setLivemode: (value: boolean) => void;
|
|
241
|
+
getTestMode: () => boolean;
|
|
242
|
+
setTestMode: (value: boolean) => void;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
export default _default;
|
|
246
|
+
export * from '@did-pay/types';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const resource_1 = require("./resource");
|
|
21
|
+
const checkout_session_1 = __importDefault(require("./resources/checkout-session"));
|
|
22
|
+
const customer_1 = __importDefault(require("./resources/customer"));
|
|
23
|
+
const payment_currency_1 = __importDefault(require("./resources/payment-currency"));
|
|
24
|
+
const payment_intent_1 = __importDefault(require("./resources/payment-intent"));
|
|
25
|
+
const payment_link_1 = __importDefault(require("./resources/payment-link"));
|
|
26
|
+
const payment_method_1 = __importDefault(require("./resources/payment-method"));
|
|
27
|
+
const price_1 = __importDefault(require("./resources/price"));
|
|
28
|
+
const product_1 = __importDefault(require("./resources/product"));
|
|
29
|
+
const subscription_1 = __importDefault(require("./resources/subscription"));
|
|
30
|
+
const subscription_item_1 = __importDefault(require("./resources/subscription-item"));
|
|
31
|
+
const webhook_endpoint_1 = __importDefault(require("./resources/webhook-endpoint"));
|
|
32
|
+
// auto detect livemode
|
|
33
|
+
if (process.env.PAYMENT_LIVEMODE) {
|
|
34
|
+
resource_1.environments.setLivemode(process.env.PAYMENT_LIVEMODE === 'true');
|
|
35
|
+
}
|
|
36
|
+
else if (process.env.PAYMENT_LIVE_MODE) {
|
|
37
|
+
resource_1.environments.setLivemode(process.env.PAYMENT_LIVE_MODE === 'true');
|
|
38
|
+
}
|
|
39
|
+
else if (process.env.PAYMENT_TEST_MODE) {
|
|
40
|
+
resource_1.environments.setTestMode(process.env.PAYMENT_TEST_MODE === 'true');
|
|
41
|
+
}
|
|
42
|
+
exports.default = {
|
|
43
|
+
checkout: {
|
|
44
|
+
sessions: checkout_session_1.default,
|
|
45
|
+
},
|
|
46
|
+
customers: customer_1.default,
|
|
47
|
+
products: product_1.default,
|
|
48
|
+
paymentIntents: payment_intent_1.default,
|
|
49
|
+
paymentCurrencies: payment_currency_1.default,
|
|
50
|
+
paymentMethods: payment_method_1.default,
|
|
51
|
+
paymentLinks: payment_link_1.default,
|
|
52
|
+
prices: price_1.default,
|
|
53
|
+
subscriptions: subscription_1.default,
|
|
54
|
+
subscriptionItems: subscription_item_1.default,
|
|
55
|
+
webhookEndpoints: webhook_endpoint_1.default,
|
|
56
|
+
environments: resource_1.environments,
|
|
57
|
+
};
|
|
58
|
+
__exportStar(require("@did-pay/types"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type MethodSpec = {
|
|
2
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
3
|
+
path: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const environments: {
|
|
6
|
+
getLivemode: () => boolean;
|
|
7
|
+
setLivemode: (value: boolean) => void;
|
|
8
|
+
getTestMode: () => boolean;
|
|
9
|
+
setTestMode: (value: boolean) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function ensureComponentRunning(): Promise<void>;
|
|
12
|
+
export declare function createResourceMethod<ResponseType = any, DataType = any, ParamType = any>(spec: MethodSpec): (_params: ParamType, data?: DataType) => Promise<ResponseType>;
|
|
13
|
+
export declare function createResourceCreateMethod<ResponseType = any, DataType = any, ParamType = any>(spec: MethodSpec): (data: DataType, params?: ParamType) => Promise<ResponseType>;
|
|
14
|
+
export {};
|
package/lib/resource.js
ADDED
|
@@ -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.createResourceCreateMethod = exports.createResourceMethod = exports.ensureComponentRunning = exports.environments = void 0;
|
|
7
|
+
/* eslint-disable import/prefer-default-export */
|
|
8
|
+
const component_1 = __importDefault(require("@blocklet/sdk/lib/component"));
|
|
9
|
+
const PAYMENT_KIT_DID = 'z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk';
|
|
10
|
+
// global config
|
|
11
|
+
let livemode = true;
|
|
12
|
+
exports.environments = {
|
|
13
|
+
getLivemode: () => livemode,
|
|
14
|
+
setLivemode: (value) => {
|
|
15
|
+
livemode = value;
|
|
16
|
+
},
|
|
17
|
+
getTestMode: () => !livemode,
|
|
18
|
+
setTestMode: (value) => {
|
|
19
|
+
livemode = !value;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
let running = false;
|
|
23
|
+
async function ensureComponentRunning() {
|
|
24
|
+
if (running) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
await component_1.default.waitForComponentRunning(PAYMENT_KIT_DID);
|
|
28
|
+
running = true;
|
|
29
|
+
}
|
|
30
|
+
exports.ensureComponentRunning = ensureComponentRunning;
|
|
31
|
+
function createResourceMethod(spec) {
|
|
32
|
+
return async (_params, data) => {
|
|
33
|
+
await ensureComponentRunning();
|
|
34
|
+
const path = typeof _params === 'string' ? spec.path.replace('{id}', _params) : spec.path;
|
|
35
|
+
const params = typeof _params === 'string' ? {} : _params;
|
|
36
|
+
const result = await component_1.default.call({
|
|
37
|
+
name: PAYMENT_KIT_DID,
|
|
38
|
+
method: spec.method,
|
|
39
|
+
params: Object.assign((params || {}), { livemode: exports.environments.getLivemode() }),
|
|
40
|
+
path,
|
|
41
|
+
data,
|
|
42
|
+
});
|
|
43
|
+
return result.data;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
exports.createResourceMethod = createResourceMethod;
|
|
47
|
+
function createResourceCreateMethod(spec) {
|
|
48
|
+
return async (data, params) => {
|
|
49
|
+
await ensureComponentRunning();
|
|
50
|
+
const result = await component_1.default.call({
|
|
51
|
+
name: PAYMENT_KIT_DID,
|
|
52
|
+
method: spec.method,
|
|
53
|
+
params: Object.assign(params || {}, { livemode: exports.environments.getLivemode() }),
|
|
54
|
+
path: spec.path,
|
|
55
|
+
data,
|
|
56
|
+
});
|
|
57
|
+
return result.data;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.createResourceCreateMethod = createResourceCreateMethod;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TCheckoutSessionExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TCheckoutSessionExpanded>;
|
|
9
|
+
list: (_params: Pagination<{
|
|
10
|
+
status?: string;
|
|
11
|
+
payment_status?: string;
|
|
12
|
+
nft_mint_status?: string;
|
|
13
|
+
customer_id?: string;
|
|
14
|
+
customer_did?: string;
|
|
15
|
+
payment_intent_id?: string;
|
|
16
|
+
subscription_id?: string;
|
|
17
|
+
}>, data?: never) => Promise<Paginated<TCheckoutSessionExpanded>>;
|
|
18
|
+
expire: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").CheckoutSession, {
|
|
19
|
+
omit: never;
|
|
20
|
+
}>>;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/checkout-sessions',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/checkout-sessions/{id}',
|
|
12
|
+
}),
|
|
13
|
+
list: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'GET',
|
|
15
|
+
path: '/api/checkout-sessions',
|
|
16
|
+
}),
|
|
17
|
+
expire: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'PUT',
|
|
19
|
+
path: '/api/checkout-sessions/{id}/expire',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TCustomerExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TCustomerExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
list: (_params: Pagination<{
|
|
15
|
+
did?: string;
|
|
16
|
+
}>, data?: never) => Promise<Paginated<TCustomerExpanded>>;
|
|
17
|
+
search: (_params: any, data?: never) => Promise<Paginated<TCustomerExpanded>>;
|
|
18
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Customer, {
|
|
19
|
+
omit: never;
|
|
20
|
+
}>>;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/customers',
|
|
8
|
+
}),
|
|
9
|
+
// get customer by id or did
|
|
10
|
+
retrieve: (0, resource_1.createResourceMethod)({ method: 'GET', path: '/api/customers/{id}' }),
|
|
11
|
+
update: (0, resource_1.createResourceMethod)({
|
|
12
|
+
method: 'PUT',
|
|
13
|
+
path: '/api/customers/{id}',
|
|
14
|
+
}),
|
|
15
|
+
list: (0, resource_1.createResourceMethod)({
|
|
16
|
+
method: 'GET',
|
|
17
|
+
path: '/api/customers',
|
|
18
|
+
}),
|
|
19
|
+
search: (0, resource_1.createResourceMethod)({
|
|
20
|
+
method: 'GET',
|
|
21
|
+
path: '/api/customers/search',
|
|
22
|
+
}),
|
|
23
|
+
del: (0, resource_1.createResourceMethod)({ method: 'DELETE', path: '/api/customers/{id}' }),
|
|
24
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
3
|
+
omit: never;
|
|
4
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
5
|
+
omit: never;
|
|
6
|
+
}>>;
|
|
7
|
+
retrieve: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
8
|
+
omit: never;
|
|
9
|
+
}>>;
|
|
10
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
11
|
+
omit: never;
|
|
12
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
13
|
+
omit: never;
|
|
14
|
+
}>>;
|
|
15
|
+
list: (_params: any, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentCurrency, {
|
|
16
|
+
omit: never;
|
|
17
|
+
}>[]>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/payment-currencies',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/payment-currencies/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/payment-currencies/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/payment-currencies',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TPaymentIntentExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TPaymentIntentExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentIntent, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
list: (_params: Pagination<{
|
|
15
|
+
status?: string;
|
|
16
|
+
invoice_id?: string;
|
|
17
|
+
customer_id?: string;
|
|
18
|
+
customer_did?: string;
|
|
19
|
+
}>, data?: never) => Promise<Paginated<TPaymentIntentExpanded>>;
|
|
20
|
+
search: (_params: any, data?: never) => Promise<Paginated<TPaymentIntentExpanded>>;
|
|
21
|
+
};
|
|
22
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/payment-intents',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/payment-intents/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/payment-intents/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/payment-intents',
|
|
20
|
+
}),
|
|
21
|
+
search: (0, resource_1.createResourceMethod)({
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/api/payment-intents/search',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Paginated, TPaymentLinkExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TPaymentLinkExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
archive: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentLink, {
|
|
15
|
+
omit: never;
|
|
16
|
+
}>>;
|
|
17
|
+
list: (_params: any, data?: never) => Promise<Paginated<TPaymentLinkExpanded>>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/payment-links',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/payment-links/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/payment-links/{id}',
|
|
16
|
+
}),
|
|
17
|
+
archive: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'PUT',
|
|
19
|
+
path: '/api/payment-links/{id}/archive',
|
|
20
|
+
}),
|
|
21
|
+
list: (0, resource_1.createResourceMethod)({
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/api/payment-links',
|
|
24
|
+
}),
|
|
25
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { TPaymentMethodExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TPaymentMethodExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").PaymentMethod, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
list: (_params: any, data?: never) => Promise<TPaymentMethodExpanded[]>;
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/payment-methods',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/payment-methods/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/payment-methods/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/payment-methods',
|
|
20
|
+
}),
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TPriceExpanded } from '@did-pay/types';
|
|
2
|
+
type ListParams = {
|
|
3
|
+
active?: boolean;
|
|
4
|
+
type?: string;
|
|
5
|
+
currency_id?: string;
|
|
6
|
+
product_id?: string;
|
|
7
|
+
lookup_key?: string;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: {
|
|
10
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
11
|
+
omit: never;
|
|
12
|
+
}>>, params?: never) => Promise<TPriceExpanded>;
|
|
13
|
+
retrieve: (_params: string, data?: never) => Promise<TPriceExpanded>;
|
|
14
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
15
|
+
omit: never;
|
|
16
|
+
}>>) => Promise<TPriceExpanded>;
|
|
17
|
+
list: (_params: Pagination<ListParams>, data?: never) => Promise<Paginated<TPriceExpanded>>;
|
|
18
|
+
search: (_params: any, data?: never) => Promise<Paginated<TPriceExpanded>>;
|
|
19
|
+
archive: (_params: string, data?: never) => Promise<TPriceExpanded>;
|
|
20
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Price, {
|
|
21
|
+
omit: never;
|
|
22
|
+
}>>;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/prices',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({ method: 'GET', path: '/api/prices/{id}' }),
|
|
10
|
+
update: (0, resource_1.createResourceMethod)({
|
|
11
|
+
method: 'PUT',
|
|
12
|
+
path: '/api/prices/{id}',
|
|
13
|
+
}),
|
|
14
|
+
list: (0, resource_1.createResourceMethod)({
|
|
15
|
+
method: 'GET',
|
|
16
|
+
path: '/api/prices',
|
|
17
|
+
}),
|
|
18
|
+
search: (0, resource_1.createResourceMethod)({
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '/api/prices/search',
|
|
21
|
+
}),
|
|
22
|
+
archive: (0, resource_1.createResourceMethod)({ method: 'PUT', path: '/api/prices/{id}/archive' }),
|
|
23
|
+
del: (0, resource_1.createResourceMethod)({ method: 'DELETE', path: '/api/prices/{id}' }),
|
|
24
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TPrice, TProductExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}> & {
|
|
6
|
+
prices: Partial<TPrice>[];
|
|
7
|
+
}>, params?: never) => Promise<TProductExpanded>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TProductExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<TProductExpanded>;
|
|
12
|
+
list: (_params: Pagination<{
|
|
13
|
+
active?: boolean;
|
|
14
|
+
name?: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
}>, data?: never) => Promise<Paginated<TProductExpanded>>;
|
|
17
|
+
search: (_params: any, data?: never) => Promise<Paginated<TProductExpanded>>;
|
|
18
|
+
archive: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
19
|
+
omit: never;
|
|
20
|
+
}>>;
|
|
21
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Product, {
|
|
22
|
+
omit: never;
|
|
23
|
+
}>>;
|
|
24
|
+
};
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/products',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({ method: 'GET', path: '/api/products/{id}' }),
|
|
10
|
+
update: (0, resource_1.createResourceMethod)({
|
|
11
|
+
method: 'PUT',
|
|
12
|
+
path: '/api/products/{id}',
|
|
13
|
+
}),
|
|
14
|
+
list: (0, resource_1.createResourceMethod)({
|
|
15
|
+
method: 'GET',
|
|
16
|
+
path: '/api/products',
|
|
17
|
+
}),
|
|
18
|
+
search: (0, resource_1.createResourceMethod)({
|
|
19
|
+
method: 'GET',
|
|
20
|
+
path: '/api/products/search',
|
|
21
|
+
}),
|
|
22
|
+
archive: (0, resource_1.createResourceMethod)({ method: 'PUT', path: '/api/products/{id}/archive' }),
|
|
23
|
+
del: (0, resource_1.createResourceMethod)({ method: 'DELETE', path: '/api/products/{id}' }),
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TSubscriptionItemExpanded, TUsageRecordSummary } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TSubscriptionItemExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
list: (_params: Pagination<{
|
|
15
|
+
subscription_id: string;
|
|
16
|
+
}>, data?: never) => Promise<Paginated<TSubscriptionItemExpanded>>;
|
|
17
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").SubscriptionItem, {
|
|
18
|
+
omit: never;
|
|
19
|
+
}>>;
|
|
20
|
+
createUsageRecord: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").UsageRecord, {
|
|
21
|
+
omit: never;
|
|
22
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").UsageRecord, {
|
|
23
|
+
omit: never;
|
|
24
|
+
}>>;
|
|
25
|
+
listUsageRecordSummaries: (_params: Pagination<{
|
|
26
|
+
subscription_item_id: string;
|
|
27
|
+
}>, data?: never) => Promise<Paginated<TUsageRecordSummary>>;
|
|
28
|
+
listUsageRecords: (_params: Pagination<{
|
|
29
|
+
subscription_item_id: string;
|
|
30
|
+
}>, data?: never) => Promise<Paginated<TUsageRecordSummary>>;
|
|
31
|
+
};
|
|
32
|
+
export default _default;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/subscription-items',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/subscription-items/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/subscription-items/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/subscription-items',
|
|
20
|
+
}),
|
|
21
|
+
del: (0, resource_1.createResourceMethod)({
|
|
22
|
+
method: 'DELETE',
|
|
23
|
+
path: '/api/subscription-items/{id}',
|
|
24
|
+
}),
|
|
25
|
+
createUsageRecord: (0, resource_1.createResourceCreateMethod)({
|
|
26
|
+
method: 'POST',
|
|
27
|
+
path: '/api/usage-records',
|
|
28
|
+
}),
|
|
29
|
+
listUsageRecordSummaries: (0, resource_1.createResourceMethod)({
|
|
30
|
+
method: 'GET',
|
|
31
|
+
path: '/api/usage-records/summary',
|
|
32
|
+
}),
|
|
33
|
+
listUsageRecords: (0, resource_1.createResourceMethod)({
|
|
34
|
+
method: 'GET',
|
|
35
|
+
path: '/api/usage-records',
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Paginated, Pagination, TSubscriptionExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<TSubscriptionExpanded>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>;
|
|
6
|
+
retrieve: (_params: string, data?: never) => Promise<TSubscriptionExpanded>;
|
|
7
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
8
|
+
omit: never;
|
|
9
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>;
|
|
12
|
+
list: (_params: Pagination<{
|
|
13
|
+
status?: string;
|
|
14
|
+
customer_id?: string;
|
|
15
|
+
customer_did?: string;
|
|
16
|
+
}>, data?: never) => Promise<Paginated<TSubscriptionExpanded>>;
|
|
17
|
+
search: (_params: any, data?: never) => Promise<Paginated<TSubscriptionExpanded>>;
|
|
18
|
+
cancel: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
19
|
+
omit: never;
|
|
20
|
+
}>>;
|
|
21
|
+
recover: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
22
|
+
omit: never;
|
|
23
|
+
}>>;
|
|
24
|
+
pause: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
25
|
+
omit: never;
|
|
26
|
+
}>>;
|
|
27
|
+
resume: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
28
|
+
omit: never;
|
|
29
|
+
}>>;
|
|
30
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").Subscription, {
|
|
31
|
+
omit: never;
|
|
32
|
+
}>>;
|
|
33
|
+
};
|
|
34
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/subscriptions',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/subscriptions/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/subscriptions/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/subscriptions',
|
|
20
|
+
}),
|
|
21
|
+
search: (0, resource_1.createResourceMethod)({
|
|
22
|
+
method: 'GET',
|
|
23
|
+
path: '/api/subscriptions/search',
|
|
24
|
+
}),
|
|
25
|
+
cancel: (0, resource_1.createResourceMethod)({
|
|
26
|
+
method: 'PUT',
|
|
27
|
+
path: '/api/subscriptions/{id}/cancel',
|
|
28
|
+
}),
|
|
29
|
+
recover: (0, resource_1.createResourceMethod)({
|
|
30
|
+
method: 'PUT',
|
|
31
|
+
path: '/api/subscriptions/{id}/recover',
|
|
32
|
+
}),
|
|
33
|
+
pause: (0, resource_1.createResourceMethod)({
|
|
34
|
+
method: 'PUT',
|
|
35
|
+
path: '/api/subscriptions/{id}/pause',
|
|
36
|
+
}),
|
|
37
|
+
resume: (0, resource_1.createResourceMethod)({
|
|
38
|
+
method: 'PUT',
|
|
39
|
+
path: '/api/subscriptions/{id}/resume',
|
|
40
|
+
}),
|
|
41
|
+
del: (0, resource_1.createResourceMethod)({
|
|
42
|
+
method: 'DELETE',
|
|
43
|
+
path: '/api/subscriptions/{id}',
|
|
44
|
+
}),
|
|
45
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Paginated, TWebhookEndpointExpanded } from '@did-pay/types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
create: (data: Partial<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
4
|
+
omit: never;
|
|
5
|
+
}>>, params?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
6
|
+
omit: never;
|
|
7
|
+
}>>;
|
|
8
|
+
retrieve: (_params: string, data?: never) => Promise<TWebhookEndpointExpanded>;
|
|
9
|
+
update: (_params: string, data?: Partial<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
10
|
+
omit: never;
|
|
11
|
+
}>>) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
12
|
+
omit: never;
|
|
13
|
+
}>>;
|
|
14
|
+
list: (_params: any, data?: never) => Promise<Paginated<TWebhookEndpointExpanded>>;
|
|
15
|
+
del: (_params: string, data?: never) => Promise<import("sequelize").InferAttributes<import("@did-pay/types").WebhookEndpoint, {
|
|
16
|
+
omit: never;
|
|
17
|
+
}>>;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const resource_1 = require("../resource");
|
|
4
|
+
exports.default = {
|
|
5
|
+
create: (0, resource_1.createResourceCreateMethod)({
|
|
6
|
+
method: 'POST',
|
|
7
|
+
path: '/api/webhook-endpoints',
|
|
8
|
+
}),
|
|
9
|
+
retrieve: (0, resource_1.createResourceMethod)({
|
|
10
|
+
method: 'GET',
|
|
11
|
+
path: '/api/webhook-endpoints/{id}',
|
|
12
|
+
}),
|
|
13
|
+
update: (0, resource_1.createResourceMethod)({
|
|
14
|
+
method: 'PUT',
|
|
15
|
+
path: '/api/webhook-endpoints/{id}',
|
|
16
|
+
}),
|
|
17
|
+
list: (0, resource_1.createResourceMethod)({
|
|
18
|
+
method: 'GET',
|
|
19
|
+
path: '/api/webhook-endpoints',
|
|
20
|
+
}),
|
|
21
|
+
del: (0, resource_1.createResourceMethod)({
|
|
22
|
+
method: 'DELETE',
|
|
23
|
+
path: '/api/webhook-endpoints/{id}',
|
|
24
|
+
}),
|
|
25
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blocklet/payment-js",
|
|
3
|
+
"version": "1.13.107",
|
|
4
|
+
"description": "Node.js client for Payment Kit",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"types",
|
|
7
|
+
"stripe"
|
|
8
|
+
],
|
|
9
|
+
"author": "wangshijun <wangshijun2010@gmail.com>",
|
|
10
|
+
"homepage": "https://github.com/blocklet/payment-kit#readme",
|
|
11
|
+
"license": "Apache-2.0",
|
|
12
|
+
"main": "lib/index.js",
|
|
13
|
+
"typings": "lib/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"lib",
|
|
16
|
+
"LICENSE",
|
|
17
|
+
"package.json",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/blocklet/payment-kit.git"
|
|
26
|
+
},
|
|
27
|
+
"scripts": {
|
|
28
|
+
"lint": "eslint src",
|
|
29
|
+
"lint:fix": "npm run lint -- --fix",
|
|
30
|
+
"clean": "rm -fr lib",
|
|
31
|
+
"prebuild": "npm run clean",
|
|
32
|
+
"build": "tsc",
|
|
33
|
+
"build:watch": "npm run build -- -w"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/blocklet/payment-kit/issues"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@blocklet/sdk": "1.16.22",
|
|
40
|
+
"@did-pay/types": "1.13.107"
|
|
41
|
+
},
|
|
42
|
+
"importSort": {
|
|
43
|
+
".js, .jsx, .mjs": {
|
|
44
|
+
"parser": "babylon",
|
|
45
|
+
"style": "module"
|
|
46
|
+
},
|
|
47
|
+
".ts, .tsx": {
|
|
48
|
+
"style": "module",
|
|
49
|
+
"parser": "typescript"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@arcblock/eslint-config": "^0.2.4",
|
|
54
|
+
"@arcblock/eslint-config-ts": "^0.2.4",
|
|
55
|
+
"@types/lodash": "^4.14.202",
|
|
56
|
+
"@types/node": "^18.19.2",
|
|
57
|
+
"eslint": "^8.55.0",
|
|
58
|
+
"import-sort-style-module": "^6.0.0",
|
|
59
|
+
"prettier": "^2.8.8",
|
|
60
|
+
"prettier-plugin-import-sort": "^0.0.7",
|
|
61
|
+
"ts-node": "^10.9.1",
|
|
62
|
+
"type-fest": "^4.8.3",
|
|
63
|
+
"typescript": "^5.3.3"
|
|
64
|
+
},
|
|
65
|
+
"gitHead": "40d9eb4c215af29dc727fafab29b9ab7776f6e3a"
|
|
66
|
+
}
|