@unify-payment/node 0.0.5 → 0.0.7
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/package.json +20 -12
- package/dist/index.d.mts +0 -345
- package/dist/index.d.ts +0 -345
- package/dist/index.js +0 -1
- package/dist/index.mjs +0 -1
- package/src/index.ts +0 -15
- package/src/lib/bkash.ts +0 -73
- package/src/lib/lemonsqueezy.ts +0 -83
- package/src/lib/paypal.ts +0 -73
- package/src/lib/sslcommerz.ts +0 -72
- package/src/lib/stripe.ts +0 -43
- package/src/types/bkash.ts +0 -49
- package/src/types/lemonsqueezy.ts +0 -163
- package/src/types/paypal.ts +0 -57
- package/src/types/sslcommerz.ts +0 -116
- package/src/types/stripe.ts +0 -5
- package/src/utils/fetch.ts +0 -19
package/package.json
CHANGED
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unify-payment/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"keywords": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
8
|
+
"UnifyPayment",
|
|
9
|
+
"typescript",
|
|
10
|
+
"payment",
|
|
11
|
+
"unified-payment",
|
|
12
|
+
"payment-integration",
|
|
13
|
+
"stripe",
|
|
14
|
+
"lemonsqueezy",
|
|
15
|
+
"payment-gateway",
|
|
16
|
+
"multi-provider",
|
|
17
|
+
"payment-switching",
|
|
18
|
+
"unify-payment",
|
|
19
|
+
"typescript-payment",
|
|
20
|
+
"payment-api",
|
|
21
|
+
"payment-sdk",
|
|
22
|
+
"payment-processor",
|
|
23
|
+
"payment-library",
|
|
24
|
+
"SSLCommerz",
|
|
25
|
+
"Bkash",
|
|
26
|
+
"Nagad"
|
|
19
27
|
],
|
|
20
28
|
"homepage": "https://github.com/shakibhasan09/unify-payment",
|
|
21
29
|
"repository": {
|
package/dist/index.d.mts
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import Stripe$1, { Stripe as Stripe$2 } from 'stripe';
|
|
2
|
-
|
|
3
|
-
interface IBkashCheckoutOptions {
|
|
4
|
-
code: "0011";
|
|
5
|
-
payerReference: string;
|
|
6
|
-
callbackURL: string;
|
|
7
|
-
amount: string;
|
|
8
|
-
currency: "BDT";
|
|
9
|
-
intent: "sale";
|
|
10
|
-
merchantInvoiceNumber: string;
|
|
11
|
-
merchantAssociationInfo?: string;
|
|
12
|
-
}
|
|
13
|
-
interface IBkashPayloadProps {
|
|
14
|
-
apiUrl: string;
|
|
15
|
-
username: string;
|
|
16
|
-
password: string;
|
|
17
|
-
app_key: string;
|
|
18
|
-
app_secret: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type TFetchOptions = {
|
|
22
|
-
method?: string;
|
|
23
|
-
headers?: HeadersInit;
|
|
24
|
-
body?: BodyInit;
|
|
25
|
-
};
|
|
26
|
-
declare class UnifyFetch {
|
|
27
|
-
jsonFetch<T>(url: string, options?: TFetchOptions): Promise<[T, Response]>;
|
|
28
|
-
axios<T>(url: string, options?: TFetchOptions): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
declare class Bkash extends UnifyFetch {
|
|
32
|
-
private options;
|
|
33
|
-
constructor(options: IBkashPayloadProps);
|
|
34
|
-
private getAppKey;
|
|
35
|
-
private getApiBaseUrl;
|
|
36
|
-
private getApiRequestHeaders;
|
|
37
|
-
getAccessToken(): Promise<string>;
|
|
38
|
-
getCheckoutUrl(options: IBkashCheckoutOptions): Promise<string>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
type TLemonSqueezyWebhookEvents = "order_created" | "order_refunded" | "subscription_created" | "subscription_updated" | "subscription_cancelled" | "subscription_resumed" | "subscription_expired" | "subscription_paused" | "subscription_unpaused" | "subscription_payment_success" | "subscription_payment_failed" | "subscription_payment_recovered" | "subscription_payment_refunded" | "license_key_created" | "license_key_updated";
|
|
42
|
-
type TWebhookEventResponse = {
|
|
43
|
-
error: Error;
|
|
44
|
-
} | {
|
|
45
|
-
event: ILemonSqueezyWebhookEeventResponse;
|
|
46
|
-
type: TLemonSqueezyWebhookEvents;
|
|
47
|
-
};
|
|
48
|
-
interface ILemonSqueezyWebhookEeventResponse {
|
|
49
|
-
meta: {
|
|
50
|
-
event_name: string;
|
|
51
|
-
custom_data: {
|
|
52
|
-
customer_id: number;
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
data: {
|
|
56
|
-
type: "orders" | "subscriptions";
|
|
57
|
-
id: string;
|
|
58
|
-
attributes: {
|
|
59
|
-
store_id: number;
|
|
60
|
-
customer_id: number;
|
|
61
|
-
identifier: string;
|
|
62
|
-
order_number: number;
|
|
63
|
-
user_name: string;
|
|
64
|
-
user_email: string;
|
|
65
|
-
currency: string;
|
|
66
|
-
currency_rate: string;
|
|
67
|
-
subtotal: number;
|
|
68
|
-
discount_total: number;
|
|
69
|
-
tax: number;
|
|
70
|
-
total: number;
|
|
71
|
-
subtotal_usd: number;
|
|
72
|
-
discount_total_usd: number;
|
|
73
|
-
tax_usd: number;
|
|
74
|
-
total_usd: number;
|
|
75
|
-
tax_name: string;
|
|
76
|
-
tax_rate: string;
|
|
77
|
-
status: string;
|
|
78
|
-
status_formatted: string;
|
|
79
|
-
refunded: boolean;
|
|
80
|
-
refunded_at: any;
|
|
81
|
-
subtotal_formatted: string;
|
|
82
|
-
discount_total_formatted: string;
|
|
83
|
-
tax_formatted: string;
|
|
84
|
-
total_formatted: string;
|
|
85
|
-
first_order_item: {
|
|
86
|
-
id: number;
|
|
87
|
-
order_id: number;
|
|
88
|
-
product_id: number;
|
|
89
|
-
variant_id: number;
|
|
90
|
-
product_name: string;
|
|
91
|
-
variant_name: string;
|
|
92
|
-
price: number;
|
|
93
|
-
created_at: string;
|
|
94
|
-
updated_at: string;
|
|
95
|
-
deleted_at: any;
|
|
96
|
-
test_mode: boolean;
|
|
97
|
-
};
|
|
98
|
-
urls: {
|
|
99
|
-
receipt: string;
|
|
100
|
-
};
|
|
101
|
-
created_at: string;
|
|
102
|
-
updated_at: string;
|
|
103
|
-
};
|
|
104
|
-
relationships: {
|
|
105
|
-
store: {
|
|
106
|
-
links: {
|
|
107
|
-
related: string;
|
|
108
|
-
self: string;
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
customer: {
|
|
112
|
-
links: {
|
|
113
|
-
related: string;
|
|
114
|
-
self: string;
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
"order-items": {
|
|
118
|
-
links: {
|
|
119
|
-
related: string;
|
|
120
|
-
self: string;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
subscriptions: {
|
|
124
|
-
links: {
|
|
125
|
-
related: string;
|
|
126
|
-
self: string;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
"license-keys": {
|
|
130
|
-
links: {
|
|
131
|
-
related: string;
|
|
132
|
-
self: string;
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
"discount-redemptions": {
|
|
136
|
-
links: {
|
|
137
|
-
related: string;
|
|
138
|
-
self: string;
|
|
139
|
-
};
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
links: {
|
|
143
|
-
self: string;
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
interface ILemonSqueezyCheckoutOptions {
|
|
148
|
-
type: "checkouts";
|
|
149
|
-
attributes?: {
|
|
150
|
-
custom_price?: number;
|
|
151
|
-
product_options?: {
|
|
152
|
-
redirect_url?: string;
|
|
153
|
-
enabled_variants?: number[];
|
|
154
|
-
};
|
|
155
|
-
checkout_options?: {
|
|
156
|
-
button_color: string;
|
|
157
|
-
};
|
|
158
|
-
checkout_data?: {
|
|
159
|
-
discount_code?: string;
|
|
160
|
-
custom?: {
|
|
161
|
-
user_id: number;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
expires_at?: string;
|
|
165
|
-
preview?: boolean;
|
|
166
|
-
};
|
|
167
|
-
relationships: {
|
|
168
|
-
store: {
|
|
169
|
-
data: {
|
|
170
|
-
type: string;
|
|
171
|
-
id: string;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
variant: {
|
|
175
|
-
data: {
|
|
176
|
-
type: string;
|
|
177
|
-
id: string;
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
declare class LemonSqueezy extends UnifyFetch {
|
|
184
|
-
private apiKey;
|
|
185
|
-
constructor(apiKey: string);
|
|
186
|
-
private getApiBaseUrl;
|
|
187
|
-
private getApiRequestHeaders;
|
|
188
|
-
getCheckoutUrl(options: ILemonSqueezyCheckoutOptions): Promise<string>;
|
|
189
|
-
verifySignature(payload: {
|
|
190
|
-
signature: string;
|
|
191
|
-
secret: string;
|
|
192
|
-
body: string;
|
|
193
|
-
x_event: string;
|
|
194
|
-
}): Promise<TWebhookEventResponse>;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
interface IPaypalOptions {
|
|
198
|
-
clientId: string;
|
|
199
|
-
clientSecret: string;
|
|
200
|
-
sandbox?: boolean;
|
|
201
|
-
}
|
|
202
|
-
interface IPaypalPayload {
|
|
203
|
-
intent: "CAPTURE";
|
|
204
|
-
purchase_units: {
|
|
205
|
-
items: {
|
|
206
|
-
name: string;
|
|
207
|
-
description: string;
|
|
208
|
-
quantity: number;
|
|
209
|
-
unit_amount: {
|
|
210
|
-
currency_code: "USD" | "EUR";
|
|
211
|
-
value: string;
|
|
212
|
-
};
|
|
213
|
-
}[];
|
|
214
|
-
amount: {
|
|
215
|
-
currency_code: "USD" | "EUR";
|
|
216
|
-
value: string;
|
|
217
|
-
breakdown: {
|
|
218
|
-
item_total: {
|
|
219
|
-
currency_code: "USD" | "EUR";
|
|
220
|
-
value: string;
|
|
221
|
-
};
|
|
222
|
-
};
|
|
223
|
-
};
|
|
224
|
-
}[];
|
|
225
|
-
application_context: {
|
|
226
|
-
return_url: string;
|
|
227
|
-
cancel_url: string;
|
|
228
|
-
shipping_preference?: "NO_SHIPPING";
|
|
229
|
-
user_action?: "PAY_NOW";
|
|
230
|
-
brand_name?: string;
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
declare class Paypal extends UnifyFetch {
|
|
235
|
-
private options;
|
|
236
|
-
constructor(options: IPaypalOptions);
|
|
237
|
-
private getApiBaseUrl;
|
|
238
|
-
private getClientId;
|
|
239
|
-
private getClientSecret;
|
|
240
|
-
private getApiCheckoutUrl;
|
|
241
|
-
getAccessToken(): Promise<string>;
|
|
242
|
-
getCheckoutUrl(payload: IPaypalPayload): Promise<string>;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
type ISSLCommerzCreateCheckoutPayload = {
|
|
246
|
-
tran_id: string;
|
|
247
|
-
store_id: string;
|
|
248
|
-
store_passwd: string;
|
|
249
|
-
total_amount: number;
|
|
250
|
-
currency: "USD" | "EUR";
|
|
251
|
-
success_url?: string;
|
|
252
|
-
cancel_url?: string;
|
|
253
|
-
cus_name: string;
|
|
254
|
-
cus_email: string;
|
|
255
|
-
cus_add1: string;
|
|
256
|
-
cus_add2?: string;
|
|
257
|
-
cus_city: string;
|
|
258
|
-
cus_state: string;
|
|
259
|
-
cus_postcode: string;
|
|
260
|
-
cus_country: string;
|
|
261
|
-
cus_phone: string;
|
|
262
|
-
cus_fax?: string;
|
|
263
|
-
shipping_method: "NO";
|
|
264
|
-
product_name: string;
|
|
265
|
-
product_category: string;
|
|
266
|
-
product_profile: "general" | "physical-goods" | "non-physical-goods" | "airline-tickets" | "travel-vertical" | "telecom-vertical";
|
|
267
|
-
} | {
|
|
268
|
-
tran_id: string;
|
|
269
|
-
store_id: string;
|
|
270
|
-
store_passwd: string;
|
|
271
|
-
total_amount: number;
|
|
272
|
-
currency: "USD" | "EUR";
|
|
273
|
-
success_url?: string;
|
|
274
|
-
cancel_url?: string;
|
|
275
|
-
cus_name: string;
|
|
276
|
-
cus_email: string;
|
|
277
|
-
cus_add1: string;
|
|
278
|
-
cus_add2?: string;
|
|
279
|
-
cus_city: string;
|
|
280
|
-
cus_state: string;
|
|
281
|
-
cus_postcode: string;
|
|
282
|
-
cus_country: string;
|
|
283
|
-
cus_phone: string;
|
|
284
|
-
cus_fax?: string;
|
|
285
|
-
shipping_method: "YES";
|
|
286
|
-
ship_name: string;
|
|
287
|
-
ship_add1: string;
|
|
288
|
-
ship_add2?: string;
|
|
289
|
-
ship_city: string;
|
|
290
|
-
ship_state: string;
|
|
291
|
-
ship_postcode: string;
|
|
292
|
-
ship_country: string;
|
|
293
|
-
product_name: string;
|
|
294
|
-
product_category: string;
|
|
295
|
-
product_profile: "general" | "physical-goods" | "non-physical-goods" | "airline-tickets" | "travel-vertical" | "telecom-vertical";
|
|
296
|
-
};
|
|
297
|
-
type ISSLCommerzOptions = {
|
|
298
|
-
apiUrl: string;
|
|
299
|
-
store_id: string;
|
|
300
|
-
store_url?: string;
|
|
301
|
-
store_passwd: string;
|
|
302
|
-
};
|
|
303
|
-
|
|
304
|
-
declare class SSLCommerz extends UnifyFetch {
|
|
305
|
-
private options;
|
|
306
|
-
constructor(options: ISSLCommerzOptions);
|
|
307
|
-
private getApiBaseUrl;
|
|
308
|
-
private getApiCheckoutUrl;
|
|
309
|
-
private getApiValidationUrl;
|
|
310
|
-
private getApiRefundUrl;
|
|
311
|
-
private getApiRefundQueryUrl;
|
|
312
|
-
private getApiTransactionQueryBySessionIdUrl;
|
|
313
|
-
private getApiTransactionQueryByTransactionIdUrl;
|
|
314
|
-
private getApiHeaders;
|
|
315
|
-
private urlFormEncode;
|
|
316
|
-
getCheckoutUrl(payload: ISSLCommerzCreateCheckoutPayload): Promise<string>;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
type TStripeWebhookEventResponse = {
|
|
320
|
-
error: Error;
|
|
321
|
-
} | {
|
|
322
|
-
event: Stripe$1.Event;
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
declare class Stripe {
|
|
326
|
-
private apiKey;
|
|
327
|
-
private stripe;
|
|
328
|
-
constructor(apiKey: string, config?: Stripe$2.StripeConfig);
|
|
329
|
-
getCheckoutUrl(params: Stripe$2.Checkout.SessionCreateParams): Promise<string>;
|
|
330
|
-
verifySignature(payload: {
|
|
331
|
-
signature: string;
|
|
332
|
-
secret: string;
|
|
333
|
-
body: string;
|
|
334
|
-
}): Promise<TStripeWebhookEventResponse>;
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
declare const UnifyPayment: {
|
|
338
|
-
LemonSqueezy: typeof LemonSqueezy;
|
|
339
|
-
Bkash: typeof Bkash;
|
|
340
|
-
Paypal: typeof Paypal;
|
|
341
|
-
SSLCommerz: typeof SSLCommerz;
|
|
342
|
-
Stripe: typeof Stripe;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
export { UnifyPayment };
|