@talosjs/payment 1.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/LICENSE +21 -0
- package/README.md +240 -0
- package/dist/index.d.ts +562 -0
- package/dist/index.js +843 -0
- package/dist/index.js.map +17 -0
- package/package.json +50 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,562 @@
|
|
|
1
|
+
import { Exception } from "@talosjs/exception";
|
|
2
|
+
declare class PaymentException extends Exception {
|
|
3
|
+
constructor(message: string, key: string, data?: Record<string, unknown>);
|
|
4
|
+
}
|
|
5
|
+
import { AppEnv } from "@talosjs/app-env";
|
|
6
|
+
import { CurrencyCodeType } from "@talosjs/currencies";
|
|
7
|
+
import { IBase, ScalarType } from "@talosjs/types";
|
|
8
|
+
declare enum EPriceType {
|
|
9
|
+
FIXED = "fixed",
|
|
10
|
+
CUSTOM = "custom",
|
|
11
|
+
FREE = "free"
|
|
12
|
+
}
|
|
13
|
+
type PriceTypeType = `${EPriceType}`;
|
|
14
|
+
type ProductImageType = {
|
|
15
|
+
id: string;
|
|
16
|
+
url: string;
|
|
17
|
+
};
|
|
18
|
+
type PriceType = {
|
|
19
|
+
type: PriceTypeType;
|
|
20
|
+
priceCurrency?: string;
|
|
21
|
+
priceAmount?: number;
|
|
22
|
+
minimumAmount?: number;
|
|
23
|
+
maximumAmount?: number;
|
|
24
|
+
presetAmount?: number;
|
|
25
|
+
};
|
|
26
|
+
type CustomFieldType = {
|
|
27
|
+
customFieldId: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
};
|
|
30
|
+
declare enum EDiscountType {
|
|
31
|
+
PERCENTAGE = "percentage",
|
|
32
|
+
FIXED = "fixed"
|
|
33
|
+
}
|
|
34
|
+
declare enum EDiscountDuration {
|
|
35
|
+
ONCE = "once",
|
|
36
|
+
REPEATING = "repeating",
|
|
37
|
+
FOREVER = "forever"
|
|
38
|
+
}
|
|
39
|
+
type DiscountDurationType = `${EDiscountDuration}`;
|
|
40
|
+
declare enum ESubscriptionPeriod {
|
|
41
|
+
MONTHLY = "monthly",
|
|
42
|
+
YEARLY = "yearly",
|
|
43
|
+
WEEKLY = "weekly",
|
|
44
|
+
DAILY = "daily"
|
|
45
|
+
}
|
|
46
|
+
type DiscountType = `${EDiscountType}`;
|
|
47
|
+
type SubscriptionPeriodType = `${ESubscriptionPeriod}`;
|
|
48
|
+
declare enum EBenefitType {
|
|
49
|
+
CREDITS = "credits",
|
|
50
|
+
LICENSE_KEYS = "license_keys",
|
|
51
|
+
FILE_DOWNLOADS = "file_downloads",
|
|
52
|
+
GITHUB_REPOSITORY_ACCESS = "github_repository_access",
|
|
53
|
+
DISCORD_ACCESS = "discord_access",
|
|
54
|
+
CUSTOM = "custom"
|
|
55
|
+
}
|
|
56
|
+
type BenefitTypeType = `${EBenefitType}`;
|
|
57
|
+
declare enum EGitHubPermission {
|
|
58
|
+
READ = "read",
|
|
59
|
+
TRIAGE = "triage",
|
|
60
|
+
WRITE = "write",
|
|
61
|
+
MAINTAIN = "maintain",
|
|
62
|
+
ADMIN = "admin"
|
|
63
|
+
}
|
|
64
|
+
type GitHubPermissionType = `${EGitHubPermission}`;
|
|
65
|
+
type BenefitBaseType = {
|
|
66
|
+
type: BenefitTypeType;
|
|
67
|
+
name: string;
|
|
68
|
+
description?: string;
|
|
69
|
+
isSelectable?: boolean;
|
|
70
|
+
isDeletable?: boolean;
|
|
71
|
+
organizationId?: string;
|
|
72
|
+
};
|
|
73
|
+
type CreditsBenefitType = BenefitBaseType & {
|
|
74
|
+
type: typeof EBenefitType.CREDITS;
|
|
75
|
+
amount: number;
|
|
76
|
+
rollover?: boolean;
|
|
77
|
+
};
|
|
78
|
+
type LicenseKeysBenefitType = BenefitBaseType & {
|
|
79
|
+
type: typeof EBenefitType.LICENSE_KEYS;
|
|
80
|
+
prefix?: string;
|
|
81
|
+
expiresInDays?: number;
|
|
82
|
+
expiresInMonths?: number;
|
|
83
|
+
expiresInYears?: number;
|
|
84
|
+
activationLimit?: number;
|
|
85
|
+
usageLimit?: number;
|
|
86
|
+
};
|
|
87
|
+
type FileDownloadsBenefitType = BenefitBaseType & {
|
|
88
|
+
type: typeof EBenefitType.FILE_DOWNLOADS;
|
|
89
|
+
files?: BenefitFileType[];
|
|
90
|
+
};
|
|
91
|
+
type BenefitFileType = {
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
size: number;
|
|
95
|
+
mimeType?: string;
|
|
96
|
+
checksum?: string;
|
|
97
|
+
isEnabled?: boolean;
|
|
98
|
+
};
|
|
99
|
+
type GitHubRepositoryAccessBenefitType = BenefitBaseType & {
|
|
100
|
+
type: typeof EBenefitType.GITHUB_REPOSITORY_ACCESS;
|
|
101
|
+
repositoryOwner: string;
|
|
102
|
+
repositoryName: string;
|
|
103
|
+
permission?: GitHubPermissionType;
|
|
104
|
+
};
|
|
105
|
+
type DiscordAccessBenefitType = BenefitBaseType & {
|
|
106
|
+
type: typeof EBenefitType.DISCORD_ACCESS;
|
|
107
|
+
guildId: string;
|
|
108
|
+
roleId: string;
|
|
109
|
+
};
|
|
110
|
+
type CustomBenefitType = BenefitBaseType & {
|
|
111
|
+
type: typeof EBenefitType.CUSTOM;
|
|
112
|
+
note?: string;
|
|
113
|
+
};
|
|
114
|
+
type BenefitType = CreditsBenefitType | LicenseKeysBenefitType | FileDownloadsBenefitType | GitHubRepositoryAccessBenefitType | DiscordAccessBenefitType | CustomBenefitType;
|
|
115
|
+
interface IProduct extends IBase {
|
|
116
|
+
key?: string;
|
|
117
|
+
name: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
categories?: string[];
|
|
120
|
+
currency?: CurrencyCodeType;
|
|
121
|
+
price?: number;
|
|
122
|
+
barcode?: string;
|
|
123
|
+
images?: ProductImageType[];
|
|
124
|
+
attributes?: Record<string, ScalarType>;
|
|
125
|
+
tags?: string[];
|
|
126
|
+
isRecurring?: boolean;
|
|
127
|
+
isArchived?: boolean;
|
|
128
|
+
organizationId?: string;
|
|
129
|
+
recurringInterval?: SubscriptionPeriodType;
|
|
130
|
+
metadata?: Record<string, string | number | boolean>;
|
|
131
|
+
prices?: PriceType[];
|
|
132
|
+
benefits?: BenefitType[];
|
|
133
|
+
attachedCustomFields?: CustomFieldType[];
|
|
134
|
+
}
|
|
135
|
+
interface IFeature extends IBase {
|
|
136
|
+
name: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
isEnabled?: boolean;
|
|
139
|
+
limit?: number;
|
|
140
|
+
}
|
|
141
|
+
interface IPlan extends IBase {
|
|
142
|
+
name: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
currency: CurrencyCodeType;
|
|
145
|
+
price: number;
|
|
146
|
+
period: ESubscriptionPeriod;
|
|
147
|
+
periodCount?: number;
|
|
148
|
+
features?: IFeature[];
|
|
149
|
+
isActive?: boolean;
|
|
150
|
+
trialDays?: number;
|
|
151
|
+
}
|
|
152
|
+
interface ICredit extends IBase {
|
|
153
|
+
balance: number;
|
|
154
|
+
currency?: CurrencyCodeType;
|
|
155
|
+
expiresAt?: Date;
|
|
156
|
+
description?: string;
|
|
157
|
+
}
|
|
158
|
+
interface ISubscription extends IBase {
|
|
159
|
+
discounts?: IDiscount[];
|
|
160
|
+
plans?: IPlan[];
|
|
161
|
+
credits?: ICredit[];
|
|
162
|
+
startAt: Date;
|
|
163
|
+
endAt?: Date;
|
|
164
|
+
isTrial?: boolean;
|
|
165
|
+
isActive?: boolean;
|
|
166
|
+
}
|
|
167
|
+
interface IDiscount extends IBase {
|
|
168
|
+
key?: string;
|
|
169
|
+
name: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
code?: string;
|
|
172
|
+
type: DiscountType;
|
|
173
|
+
amount: number;
|
|
174
|
+
currency?: CurrencyCodeType;
|
|
175
|
+
duration: DiscountDurationType;
|
|
176
|
+
durationInMonths?: number;
|
|
177
|
+
startAt?: Date;
|
|
178
|
+
endAt?: Date;
|
|
179
|
+
maxUses?: number;
|
|
180
|
+
usedCount?: number;
|
|
181
|
+
maxRedemptions?: number;
|
|
182
|
+
redemptionsCount?: number;
|
|
183
|
+
isActive?: boolean;
|
|
184
|
+
minimumAmount?: number;
|
|
185
|
+
applicableProducts?: IProduct[];
|
|
186
|
+
applicablePlans?: IPlan[];
|
|
187
|
+
organizationId?: string;
|
|
188
|
+
metadata?: Record<string, string | number | boolean>;
|
|
189
|
+
}
|
|
190
|
+
declare enum ECheckoutStatus {
|
|
191
|
+
OPEN = "open",
|
|
192
|
+
EXPIRED = "expired",
|
|
193
|
+
CONFIRMED = "confirmed",
|
|
194
|
+
SUCCEEDED = "succeeded",
|
|
195
|
+
FAILED = "failed"
|
|
196
|
+
}
|
|
197
|
+
type CheckoutStatusType = `${ECheckoutStatus}`;
|
|
198
|
+
type CheckoutCustomerType = {
|
|
199
|
+
id?: string;
|
|
200
|
+
email?: string;
|
|
201
|
+
name?: string;
|
|
202
|
+
externalId?: string;
|
|
203
|
+
billingAddress?: CheckoutAddressType;
|
|
204
|
+
taxId?: string;
|
|
205
|
+
};
|
|
206
|
+
type CheckoutAddressType = {
|
|
207
|
+
line1?: string;
|
|
208
|
+
line2?: string;
|
|
209
|
+
city?: string;
|
|
210
|
+
state?: string;
|
|
211
|
+
postalCode?: string;
|
|
212
|
+
country?: string;
|
|
213
|
+
};
|
|
214
|
+
type CheckoutCreateType = {
|
|
215
|
+
products: string[];
|
|
216
|
+
customerExternalId?: string;
|
|
217
|
+
customerId?: string;
|
|
218
|
+
customerEmail?: string;
|
|
219
|
+
customerName?: string;
|
|
220
|
+
customerBillingAddress?: CheckoutAddressType;
|
|
221
|
+
customerTaxId?: string;
|
|
222
|
+
discountId?: string;
|
|
223
|
+
allowDiscountCodes?: boolean;
|
|
224
|
+
successUrl?: string;
|
|
225
|
+
embedOrigin?: string;
|
|
226
|
+
metadata?: Record<string, string | number | boolean>;
|
|
227
|
+
};
|
|
228
|
+
type CheckoutType = {
|
|
229
|
+
id: string;
|
|
230
|
+
url?: string;
|
|
231
|
+
embedId?: string;
|
|
232
|
+
status: CheckoutStatusType;
|
|
233
|
+
clientSecret: string;
|
|
234
|
+
createdAt?: Date;
|
|
235
|
+
updatedAt?: Date;
|
|
236
|
+
expiresAt?: Date;
|
|
237
|
+
successUrl?: string;
|
|
238
|
+
embedOrigin?: string;
|
|
239
|
+
amount?: number;
|
|
240
|
+
taxAmount?: number;
|
|
241
|
+
currency?: CurrencyCodeType;
|
|
242
|
+
subtotalAmount?: number;
|
|
243
|
+
totalAmount?: number;
|
|
244
|
+
productId?: string;
|
|
245
|
+
productPriceId?: string;
|
|
246
|
+
discountId?: string;
|
|
247
|
+
allowDiscountCodes?: boolean;
|
|
248
|
+
isDiscountApplicable?: boolean;
|
|
249
|
+
isPaymentRequired?: boolean;
|
|
250
|
+
customer?: CheckoutCustomerType;
|
|
251
|
+
metadata?: Record<string, string | number | boolean>;
|
|
252
|
+
};
|
|
253
|
+
type CustomerSessionCreateType = {
|
|
254
|
+
customerId: string;
|
|
255
|
+
};
|
|
256
|
+
type CustomerSessionType = {
|
|
257
|
+
id: string;
|
|
258
|
+
token: string;
|
|
259
|
+
customerPortalUrl: string;
|
|
260
|
+
createdAt?: Date;
|
|
261
|
+
expiresAt?: Date;
|
|
262
|
+
customerId?: string;
|
|
263
|
+
};
|
|
264
|
+
type CustomerAddressType = {
|
|
265
|
+
line1?: string;
|
|
266
|
+
line2?: string;
|
|
267
|
+
city?: string;
|
|
268
|
+
state?: string;
|
|
269
|
+
postalCode?: string;
|
|
270
|
+
country?: string;
|
|
271
|
+
};
|
|
272
|
+
type CustomerCreateType = {
|
|
273
|
+
email: string;
|
|
274
|
+
name?: string;
|
|
275
|
+
externalId?: string;
|
|
276
|
+
billingAddress?: CustomerAddressType;
|
|
277
|
+
taxId?: string;
|
|
278
|
+
organizationId?: string;
|
|
279
|
+
metadata?: Record<string, string | number | boolean>;
|
|
280
|
+
};
|
|
281
|
+
type CustomerUpdateType = {
|
|
282
|
+
email?: string;
|
|
283
|
+
name?: string;
|
|
284
|
+
billingAddress?: CustomerAddressType;
|
|
285
|
+
taxId?: string;
|
|
286
|
+
metadata?: Record<string, string | number | boolean>;
|
|
287
|
+
};
|
|
288
|
+
type CustomerType = {
|
|
289
|
+
id: string;
|
|
290
|
+
email: string;
|
|
291
|
+
emailVerified: boolean;
|
|
292
|
+
name?: string;
|
|
293
|
+
externalId?: string;
|
|
294
|
+
avatarUrl?: string;
|
|
295
|
+
billingAddress?: CustomerAddressType;
|
|
296
|
+
taxId?: string;
|
|
297
|
+
organizationId?: string;
|
|
298
|
+
metadata?: Record<string, string | number | boolean>;
|
|
299
|
+
createdAt?: Date;
|
|
300
|
+
updatedAt?: Date;
|
|
301
|
+
deletedAt?: Date;
|
|
302
|
+
};
|
|
303
|
+
type CustomerListOptionsType = {
|
|
304
|
+
organizationId?: string;
|
|
305
|
+
email?: string;
|
|
306
|
+
query?: string;
|
|
307
|
+
page?: number;
|
|
308
|
+
limit?: number;
|
|
309
|
+
};
|
|
310
|
+
type CustomerListResultType = {
|
|
311
|
+
items: CustomerType[];
|
|
312
|
+
pagination: {
|
|
313
|
+
totalCount: number;
|
|
314
|
+
maxPage: number;
|
|
315
|
+
};
|
|
316
|
+
};
|
|
317
|
+
declare enum EAnalyticsInterval {
|
|
318
|
+
YEAR = "year",
|
|
319
|
+
MONTH = "month",
|
|
320
|
+
WEEK = "week",
|
|
321
|
+
DAY = "day",
|
|
322
|
+
HOUR = "hour"
|
|
323
|
+
}
|
|
324
|
+
type AnalyticsIntervalType = `${EAnalyticsInterval}`;
|
|
325
|
+
declare enum EBillingType {
|
|
326
|
+
ONE_TIME = "one_time",
|
|
327
|
+
RECURRING = "recurring"
|
|
328
|
+
}
|
|
329
|
+
type BillingTypeType = `${EBillingType}`;
|
|
330
|
+
type AnalyticsOptionsType = {
|
|
331
|
+
startDate: Date;
|
|
332
|
+
endDate: Date;
|
|
333
|
+
interval: AnalyticsIntervalType;
|
|
334
|
+
organizationId?: string | string[];
|
|
335
|
+
productId?: string | string[];
|
|
336
|
+
billingType?: BillingTypeType | BillingTypeType[];
|
|
337
|
+
customerId?: string | string[];
|
|
338
|
+
};
|
|
339
|
+
type AnalyticsPeriodType = {
|
|
340
|
+
timestamp: Date;
|
|
341
|
+
orders: number;
|
|
342
|
+
revenue: number;
|
|
343
|
+
cumulativeRevenue: number;
|
|
344
|
+
averageOrderValue: number;
|
|
345
|
+
oneTimeProducts: number;
|
|
346
|
+
oneTimeProductsRevenue: number;
|
|
347
|
+
newSubscriptions: number;
|
|
348
|
+
newSubscriptionsRevenue: number;
|
|
349
|
+
renewedSubscriptions: number;
|
|
350
|
+
renewedSubscriptionsRevenue: number;
|
|
351
|
+
activeSubscriptions: number;
|
|
352
|
+
monthlyRecurringRevenue: number;
|
|
353
|
+
};
|
|
354
|
+
type AnalyticsMetricInfoType = {
|
|
355
|
+
slug: string;
|
|
356
|
+
displayName: string;
|
|
357
|
+
type: string;
|
|
358
|
+
};
|
|
359
|
+
type AnalyticsMetricsType = {
|
|
360
|
+
orders: AnalyticsMetricInfoType;
|
|
361
|
+
revenue: AnalyticsMetricInfoType;
|
|
362
|
+
cumulativeRevenue: AnalyticsMetricInfoType;
|
|
363
|
+
averageOrderValue: AnalyticsMetricInfoType;
|
|
364
|
+
oneTimeProducts: AnalyticsMetricInfoType;
|
|
365
|
+
oneTimeProductsRevenue: AnalyticsMetricInfoType;
|
|
366
|
+
newSubscriptions: AnalyticsMetricInfoType;
|
|
367
|
+
newSubscriptionsRevenue: AnalyticsMetricInfoType;
|
|
368
|
+
renewedSubscriptions: AnalyticsMetricInfoType;
|
|
369
|
+
renewedSubscriptionsRevenue: AnalyticsMetricInfoType;
|
|
370
|
+
activeSubscriptions: AnalyticsMetricInfoType;
|
|
371
|
+
monthlyRecurringRevenue: AnalyticsMetricInfoType;
|
|
372
|
+
};
|
|
373
|
+
type AnalyticsResponseType = {
|
|
374
|
+
periods: AnalyticsPeriodType[];
|
|
375
|
+
metrics: AnalyticsMetricsType;
|
|
376
|
+
};
|
|
377
|
+
type AnalyticsIntervalLimitType = {
|
|
378
|
+
maxDays: number;
|
|
379
|
+
};
|
|
380
|
+
type AnalyticsIntervalsLimitsType = {
|
|
381
|
+
hour: AnalyticsIntervalLimitType;
|
|
382
|
+
day: AnalyticsIntervalLimitType;
|
|
383
|
+
week: AnalyticsIntervalLimitType;
|
|
384
|
+
month: AnalyticsIntervalLimitType;
|
|
385
|
+
year: AnalyticsIntervalLimitType;
|
|
386
|
+
};
|
|
387
|
+
type AnalyticsLimitsType = {
|
|
388
|
+
minDate: Date;
|
|
389
|
+
intervals: AnalyticsIntervalsLimitsType;
|
|
390
|
+
};
|
|
391
|
+
type CustomerSessionResponseType = {
|
|
392
|
+
id: string;
|
|
393
|
+
token: string;
|
|
394
|
+
customerPortalUrl: string;
|
|
395
|
+
createdAt?: Date;
|
|
396
|
+
expiresAt?: Date;
|
|
397
|
+
customerId?: string;
|
|
398
|
+
};
|
|
399
|
+
type DiscountResponseType = {
|
|
400
|
+
id: string;
|
|
401
|
+
createdAt?: Date;
|
|
402
|
+
modifiedAt?: Date;
|
|
403
|
+
name: string;
|
|
404
|
+
code?: string;
|
|
405
|
+
type: string;
|
|
406
|
+
basisPoints?: number;
|
|
407
|
+
amount?: number;
|
|
408
|
+
currency?: string;
|
|
409
|
+
duration: string;
|
|
410
|
+
durationInMonths?: number;
|
|
411
|
+
startsAt?: Date;
|
|
412
|
+
endsAt?: Date;
|
|
413
|
+
maxRedemptions?: number;
|
|
414
|
+
redemptionsCount: number;
|
|
415
|
+
organizationId?: string;
|
|
416
|
+
metadata: Record<string, string | number | boolean>;
|
|
417
|
+
products?: {
|
|
418
|
+
id: string;
|
|
419
|
+
name: string;
|
|
420
|
+
}[];
|
|
421
|
+
};
|
|
422
|
+
type CheckoutResponseType = {
|
|
423
|
+
id: string;
|
|
424
|
+
createdAt?: Date;
|
|
425
|
+
modifiedAt?: Date;
|
|
426
|
+
url?: string;
|
|
427
|
+
embedId?: string;
|
|
428
|
+
status: string;
|
|
429
|
+
clientSecret: string;
|
|
430
|
+
expiresAt?: Date;
|
|
431
|
+
successUrl?: string;
|
|
432
|
+
embedOrigin?: string;
|
|
433
|
+
amount?: number;
|
|
434
|
+
taxAmount?: number;
|
|
435
|
+
currency?: string;
|
|
436
|
+
subtotalAmount?: number;
|
|
437
|
+
totalAmount?: number;
|
|
438
|
+
productId?: string;
|
|
439
|
+
productPriceId?: string;
|
|
440
|
+
discountId?: string;
|
|
441
|
+
allowDiscountCodes?: boolean;
|
|
442
|
+
isDiscountApplicable?: boolean;
|
|
443
|
+
isPaymentRequired?: boolean;
|
|
444
|
+
customer?: {
|
|
445
|
+
id?: string;
|
|
446
|
+
email?: string;
|
|
447
|
+
name?: string;
|
|
448
|
+
externalId?: string;
|
|
449
|
+
billingAddress?: {
|
|
450
|
+
line1?: string;
|
|
451
|
+
line2?: string;
|
|
452
|
+
city?: string;
|
|
453
|
+
state?: string;
|
|
454
|
+
postalCode?: string;
|
|
455
|
+
country?: string;
|
|
456
|
+
};
|
|
457
|
+
taxId?: string;
|
|
458
|
+
};
|
|
459
|
+
metadata: Record<string, string | number | boolean>;
|
|
460
|
+
};
|
|
461
|
+
type CustomerResponseType = {
|
|
462
|
+
id: string;
|
|
463
|
+
createdAt?: Date;
|
|
464
|
+
modifiedAt?: Date;
|
|
465
|
+
deletedAt?: Date;
|
|
466
|
+
email: string;
|
|
467
|
+
emailVerified?: boolean;
|
|
468
|
+
name?: string;
|
|
469
|
+
externalId?: string;
|
|
470
|
+
avatarUrl?: string;
|
|
471
|
+
billingAddress?: {
|
|
472
|
+
line1?: string;
|
|
473
|
+
line2?: string;
|
|
474
|
+
city?: string;
|
|
475
|
+
state?: string;
|
|
476
|
+
postalCode?: string;
|
|
477
|
+
country?: string;
|
|
478
|
+
};
|
|
479
|
+
taxId?: string | [string, string];
|
|
480
|
+
organizationId?: string;
|
|
481
|
+
metadata?: Record<string, string | number | boolean>;
|
|
482
|
+
};
|
|
483
|
+
type CustomerListResponseType = {
|
|
484
|
+
result: {
|
|
485
|
+
items: CustomerResponseType[];
|
|
486
|
+
pagination: {
|
|
487
|
+
totalCount: number;
|
|
488
|
+
maxPage: number;
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
declare class PolarAnalytics {
|
|
493
|
+
private readonly env;
|
|
494
|
+
private client;
|
|
495
|
+
constructor(env: AppEnv);
|
|
496
|
+
get(options: AnalyticsOptionsType): Promise<AnalyticsResponseType>;
|
|
497
|
+
getLimits(): Promise<AnalyticsLimitsType>;
|
|
498
|
+
private toRFCDate;
|
|
499
|
+
private mapPeriod;
|
|
500
|
+
private mapMetricInfo;
|
|
501
|
+
private mapMetrics;
|
|
502
|
+
private mapIntervalsLimits;
|
|
503
|
+
}
|
|
504
|
+
import { AppEnv as AppEnv2 } from "@talosjs/app-env";
|
|
505
|
+
declare class PolarCheckout {
|
|
506
|
+
private readonly env;
|
|
507
|
+
private client;
|
|
508
|
+
constructor(env: AppEnv2);
|
|
509
|
+
create(data: CheckoutCreateType): Promise<CheckoutType>;
|
|
510
|
+
get(id: string): Promise<CheckoutType>;
|
|
511
|
+
private mapResponse;
|
|
512
|
+
}
|
|
513
|
+
import { AppEnv as AppEnv3 } from "@talosjs/app-env";
|
|
514
|
+
declare class PolarCustomer {
|
|
515
|
+
private readonly env;
|
|
516
|
+
private client;
|
|
517
|
+
constructor(env: AppEnv3);
|
|
518
|
+
create(data: CustomerCreateType): Promise<CustomerType>;
|
|
519
|
+
update(id: string, data: CustomerUpdateType): Promise<CustomerType>;
|
|
520
|
+
remove(id: string): Promise<void>;
|
|
521
|
+
get(id: string): Promise<CustomerType>;
|
|
522
|
+
list(options?: CustomerListOptionsType): Promise<CustomerListResultType>;
|
|
523
|
+
getByExternalId(externalId: string): Promise<CustomerType>;
|
|
524
|
+
updateByExternalId(externalId: string, data: CustomerUpdateType): Promise<CustomerType>;
|
|
525
|
+
removeByExternalId(externalId: string): Promise<void>;
|
|
526
|
+
private toBillingAddress;
|
|
527
|
+
private mapResponse;
|
|
528
|
+
}
|
|
529
|
+
import { AppEnv as AppEnv4 } from "@talosjs/app-env";
|
|
530
|
+
declare class PolarCustomerPortal {
|
|
531
|
+
private readonly env;
|
|
532
|
+
private client;
|
|
533
|
+
constructor(env: AppEnv4);
|
|
534
|
+
create(data: CustomerSessionCreateType): Promise<CustomerSessionType>;
|
|
535
|
+
getPortalUrl(organizationSlug: string): string;
|
|
536
|
+
private mapResponse;
|
|
537
|
+
}
|
|
538
|
+
import { AppEnv as AppEnv5 } from "@talosjs/app-env";
|
|
539
|
+
declare class PolarDiscount {
|
|
540
|
+
private readonly env;
|
|
541
|
+
private client;
|
|
542
|
+
constructor(env: AppEnv5);
|
|
543
|
+
private toDiscountType;
|
|
544
|
+
private toDiscountDuration;
|
|
545
|
+
create(data: IDiscount): Promise<IDiscount>;
|
|
546
|
+
update(id: string, data: Partial<IDiscount>): Promise<IDiscount>;
|
|
547
|
+
remove(id: string): Promise<void>;
|
|
548
|
+
get(id: string): Promise<IDiscount>;
|
|
549
|
+
private mapResponse;
|
|
550
|
+
}
|
|
551
|
+
import { AppEnv as AppEnv6 } from "@talosjs/app-env";
|
|
552
|
+
declare class PolarProduct {
|
|
553
|
+
private readonly env;
|
|
554
|
+
private client;
|
|
555
|
+
constructor(env: AppEnv6);
|
|
556
|
+
private toRecurringInterval;
|
|
557
|
+
create(data: IProduct): Promise<Omit<IProduct, "id">>;
|
|
558
|
+
update(id: string, data: Partial<IProduct>): Promise<Omit<IProduct, "id">>;
|
|
559
|
+
remove(id: string): Promise<void>;
|
|
560
|
+
private mapResponse;
|
|
561
|
+
}
|
|
562
|
+
export { SubscriptionPeriodType, ProductImageType, PriceTypeType, PriceType, PolarProduct, PolarDiscount, PolarCustomerPortal, PolarCustomer, PolarCheckout, PolarAnalytics, PaymentException, LicenseKeysBenefitType, ISubscription, IProduct, IPlan, IFeature, IDiscount, ICredit, GitHubRepositoryAccessBenefitType, GitHubPermissionType, FileDownloadsBenefitType, ESubscriptionPeriod, EPriceType, EGitHubPermission, EDiscountType, EDiscountDuration, ECheckoutStatus, EBillingType, EBenefitType, EAnalyticsInterval, DiscountType, DiscountResponseType, DiscountDurationType, DiscordAccessBenefitType, CustomerUpdateType, CustomerType, CustomerSessionType, CustomerSessionResponseType, CustomerSessionCreateType, CustomerResponseType, CustomerListResultType, CustomerListResponseType, CustomerListOptionsType, CustomerCreateType, CustomerAddressType, CustomFieldType, CustomBenefitType, CreditsBenefitType, CheckoutType, CheckoutStatusType, CheckoutResponseType, CheckoutCustomerType, CheckoutCreateType, CheckoutAddressType, BillingTypeType, BenefitTypeType, BenefitType, BenefitFileType, BenefitBaseType, AnalyticsResponseType, AnalyticsPeriodType, AnalyticsOptionsType, AnalyticsMetricsType, AnalyticsMetricInfoType, AnalyticsLimitsType, AnalyticsIntervalsLimitsType, AnalyticsIntervalType, AnalyticsIntervalLimitType };
|