shopeasy-sdk 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.
Files changed (47) hide show
  1. package/README.md +383 -0
  2. package/dist/functions/api/config.cjs +81 -0
  3. package/dist/functions/api/config.mjs +71 -0
  4. package/dist/functions/api/index.cjs +35 -0
  5. package/dist/functions/api/index.mjs +33 -0
  6. package/dist/functions/api/services/carts.service.cjs +64 -0
  7. package/dist/functions/api/services/carts.service.mjs +62 -0
  8. package/dist/functions/api/services/catalog.service.cjs +60 -0
  9. package/dist/functions/api/services/catalog.service.mjs +58 -0
  10. package/dist/functions/api/services/configs.service.cjs +46 -0
  11. package/dist/functions/api/services/configs.service.mjs +44 -0
  12. package/dist/functions/api/services/coupons.service.cjs +54 -0
  13. package/dist/functions/api/services/coupons.service.mjs +52 -0
  14. package/dist/functions/api/services/customer.service.cjs +65 -0
  15. package/dist/functions/api/services/customer.service.mjs +63 -0
  16. package/dist/functions/api/services/images.service.cjs +17 -0
  17. package/dist/functions/api/services/images.service.mjs +15 -0
  18. package/dist/functions/api/services/orders.service.cjs +36 -0
  19. package/dist/functions/api/services/orders.service.mjs +34 -0
  20. package/dist/functions/api/services/payment.service.cjs +26 -0
  21. package/dist/functions/api/services/payment.service.mjs +24 -0
  22. package/dist/functions/api/services/plans.service.cjs +67 -0
  23. package/dist/functions/api/services/plans.service.mjs +65 -0
  24. package/dist/functions/api/services/products.service.cjs +104 -0
  25. package/dist/functions/api/services/products.service.mjs +102 -0
  26. package/dist/functions/api/services/sales.service.cjs +29 -0
  27. package/dist/functions/api/services/sales.service.mjs +27 -0
  28. package/dist/functions/api/services/token.service.cjs +17 -0
  29. package/dist/functions/api/services/token.service.mjs +15 -0
  30. package/dist/functions/api/services/users.service.cjs +13 -0
  31. package/dist/functions/api/services/users.service.mjs +11 -0
  32. package/dist/functions/api/services/wallet.service.cjs +33 -0
  33. package/dist/functions/api/services/wallet.service.mjs +31 -0
  34. package/dist/functions/utils/cart.cjs +53 -0
  35. package/dist/functions/utils/cart.mjs +47 -0
  36. package/dist/functions/utils/formarts.cjs +30 -0
  37. package/dist/functions/utils/formarts.mjs +25 -0
  38. package/dist/functions/utils/permission.cjs +31 -0
  39. package/dist/functions/utils/permission.mjs +29 -0
  40. package/dist/index.cjs +45 -0
  41. package/dist/index.d.cts +766 -0
  42. package/dist/index.d.mts +766 -0
  43. package/dist/index.d.ts +766 -0
  44. package/dist/index.mjs +32 -0
  45. package/dist/tools/pix.cjs +108 -0
  46. package/dist/tools/pix.mjs +101 -0
  47. package/package.json +47 -0
@@ -0,0 +1,766 @@
1
+ import { Decimal as Decimal$1 } from 'decimal.js';
2
+ import { Guild as Guild$1, GuildMember } from 'discord.js';
3
+ import { createStaticPix, PixStaticObject } from 'pix-utils';
4
+
5
+ type GatewayProvider = "atos" | "fluxopay";
6
+ interface WalletBalance {
7
+ pending: number;
8
+ available: number;
9
+ locked: number;
10
+ }
11
+ interface Wallet {
12
+ id: string;
13
+ userId: string;
14
+ apiKey?: string | null;
15
+ balance?: WalletBalance;
16
+ gatewayProvider?: GatewayProvider | null;
17
+ gatewayConfig?: Record<string, unknown> | null;
18
+ isActive?: boolean | null;
19
+ createdAt: Date;
20
+ updatedAt: Date;
21
+ }
22
+ interface UpdateWalletArgs {
23
+ userId: string;
24
+ data: {
25
+ apiKey?: string | null;
26
+ gatewayProvider?: GatewayProvider | null;
27
+ gatewayConfig?: Record<string, unknown> | null;
28
+ isActive?: boolean | null;
29
+ };
30
+ }
31
+
32
+ interface User {
33
+ id: string;
34
+ develop?: boolean;
35
+ }
36
+
37
+ interface Token {
38
+ id: string;
39
+ botId: string;
40
+ used: boolean;
41
+ token: string;
42
+ }
43
+ interface TokenUpdateArgs {
44
+ id: string;
45
+ data: Partial<Omit<Token, "id" | "botId">>;
46
+ }
47
+
48
+ type JsonValue<T = unknown> = T | null;
49
+ type Decimal = {
50
+ valueOf(): string;
51
+ };
52
+
53
+ interface ConfigDraftGetArgs {
54
+ userId: string;
55
+ guildId: string;
56
+ }
57
+ interface ConfigDraftSetArgs {
58
+ userId: string;
59
+ guildId: string;
60
+ data: ConfigUpdateArgs["data"];
61
+ }
62
+ type ActionPermission = "manage_products" | "manage_carts" | "manage_config" | "view_orders" | "process_payments" | "manager_payments" | "manage_roles" | "manager_bot" | "full_access";
63
+ type RolePermissionsMap = Record<string, ActionPermission[]>;
64
+ interface Config {
65
+ guildId: string;
66
+ antiFake: boolean | null;
67
+ antiFakeDays: number | null;
68
+ notifys: string[];
69
+ antiFakeRequiredRoleIds: string[] | null;
70
+ antiFakeVerify: boolean | null;
71
+ antiFakeVerifyMessage: string | null;
72
+ colorHex: string;
73
+ channelPublic: string | null;
74
+ channelPrivate: string | null;
75
+ channelCall: string | null;
76
+ channelFeds: string | null;
77
+ categoryCarts: string | null;
78
+ categoryChats: string | null;
79
+ staffRoles: RolePermissionsMap | null;
80
+ staffUsers: JsonValue | null;
81
+ clientRole: string | null;
82
+ clientRolePremium: string | null;
83
+ timeCart: number | null;
84
+ timePayment: number | null;
85
+ usersBanned: JsonValue<Array<string | null>> | null;
86
+ terms: string | null;
87
+ updatedAt: Date;
88
+ guild?: Guild$1;
89
+ }
90
+ interface ConfigUpdateArgs {
91
+ guildId: string;
92
+ data: Omit<Partial<Config>, "id" | "guildId">;
93
+ }
94
+
95
+ type PlanType = "essential" | "complete" | "desactive";
96
+ interface Plan {
97
+ guildId: string;
98
+ type: PlanType;
99
+ expired: boolean;
100
+ userId: string;
101
+ createdAt: Date | null;
102
+ expireAt: Date | null;
103
+ }
104
+ interface ExpiringPlan extends Plan {
105
+ daysUntilExpire: number;
106
+ effectiveExpireAt: Date;
107
+ shouldAlert: boolean;
108
+ }
109
+ interface PlanNeedingAlert extends Plan {
110
+ daysUntilExpire: number;
111
+ effectiveExpireAt: Date;
112
+ }
113
+ interface ExpiredPlansResponse {
114
+ count: number;
115
+ plans: Array<{
116
+ guildId: string;
117
+ userId: string;
118
+ type: PlanType;
119
+ expiredAt: Date | null;
120
+ createdAt: Date | null;
121
+ }>;
122
+ }
123
+ interface PlansNeedingAlertResponse {
124
+ count: number;
125
+ plans: PlanNeedingAlert[];
126
+ }
127
+ interface CheckExpirationsResponse {
128
+ expired: {
129
+ count: number;
130
+ plans: Array<{
131
+ guildId: string;
132
+ userId: string;
133
+ type: PlanType;
134
+ expiredAt: Date | null;
135
+ createdAt: Date | null;
136
+ }>;
137
+ };
138
+ expiring: {
139
+ count: number;
140
+ plans: Array<{
141
+ guildId: string;
142
+ userId: string;
143
+ type: PlanType;
144
+ daysUntilExpire: number;
145
+ effectiveExpireAt: Date;
146
+ createdAt: Date | null;
147
+ }>;
148
+ };
149
+ }
150
+ interface PlanStatus {
151
+ active: boolean;
152
+ expired: boolean;
153
+ expireAt?: Date;
154
+ daysUntilExpire?: number;
155
+ }
156
+ interface MarkAlertResponse {
157
+ success: boolean;
158
+ message: string;
159
+ }
160
+ interface PlanSubscriptionCreateArgs {
161
+ guildId: string;
162
+ userId: string;
163
+ months: number;
164
+ plan: "essential" | "complete";
165
+ }
166
+
167
+ interface ProductStockPushArgs {
168
+ product: Product;
169
+ amount: number;
170
+ }
171
+ interface ProductGetByReference {
172
+ reference: string;
173
+ guildId: string;
174
+ }
175
+ interface SaleProduct$1 {
176
+ id: string;
177
+ saleId: string;
178
+ productid: string;
179
+ guildId: string;
180
+ valueTotal: number;
181
+ quantiy: number;
182
+ product?: Product;
183
+ }
184
+ type ProductMode = "TEXT" | "LINES";
185
+ type ProductStatus = "ACTIVED" | "DEACTIVATED" | "BANNED";
186
+ type StockMode = "AUTOMATIC" | "MANUAL";
187
+ interface Product {
188
+ id: string;
189
+ reference: string;
190
+ guildId: string;
191
+ createdBy: string;
192
+ status: ProductStatus;
193
+ title?: string | null;
194
+ banned: boolean | null;
195
+ usersNotifyStock: JsonValue<Array<string>> | null;
196
+ description: string | null;
197
+ price: Decimal;
198
+ discount: Decimal | null;
199
+ banners: JsonValue<Array<string>> | null;
200
+ messages: JsonValue<Array<string>> | null;
201
+ stockMode: StockMode;
202
+ stockItems: JsonValue<Array<string>> | null;
203
+ stockText: string | null;
204
+ stockProductMode: ProductMode | null;
205
+ stockRepeat: number | null;
206
+ stockCount: number | null;
207
+ instructions: string | null;
208
+ stockMin: number;
209
+ stockMax: number;
210
+ chat?: boolean | null;
211
+ private?: boolean | null;
212
+ deshighlight?: boolean | null;
213
+ sell?: boolean | null;
214
+ coupon?: boolean;
215
+ colorHex?: string | null;
216
+ guild?: Guild | null;
217
+ sales?: SaleProduct$1[];
218
+ catalogs?: string[];
219
+ }
220
+ interface ProduductDraftSetArgs {
221
+ id: string;
222
+ userId: string;
223
+ data: ProductUpdateArgs["data"] & {
224
+ catalogs?: string[];
225
+ };
226
+ }
227
+ interface ProduductDraftGetArgs {
228
+ id: string;
229
+ userId: string;
230
+ }
231
+ interface ProductCreateArgs {
232
+ createdBy: string;
233
+ reference: string;
234
+ guildId: string;
235
+ }
236
+ interface ProductUpdateArgs {
237
+ id: string;
238
+ data: Omit<Partial<Product>, "id" | "reference">;
239
+ }
240
+
241
+ interface Guild {
242
+ id: string;
243
+ banned: boolean;
244
+ createdAt: Date;
245
+ configs?: Config | null;
246
+ products?: Product[];
247
+ sales?: Sale[];
248
+ Plan?: Plan | null;
249
+ }
250
+
251
+ interface Customer {
252
+ id: string;
253
+ userId: string;
254
+ guildId: string;
255
+ balance: Decimal;
256
+ notify: boolean;
257
+ sales?: Sale[];
258
+ guild?: Guild | null;
259
+ createdAt?: Date;
260
+ }
261
+ interface CustomerDraftSetArgs {
262
+ id: string;
263
+ userId: string;
264
+ data: CustomerUpdateArgs["data"];
265
+ }
266
+ interface CustomerDraftGetArgs {
267
+ id: string;
268
+ userId: string;
269
+ }
270
+ interface CustomerCreateArgs {
271
+ userId: string;
272
+ guildId: string;
273
+ balance?: Decimal;
274
+ notify?: boolean;
275
+ }
276
+ interface CustomerUpdateArgs {
277
+ id: string;
278
+ data: Omit<Partial<Customer>, "id" | "userId" | "guildId">;
279
+ }
280
+
281
+ interface SaleCreateArgs {
282
+ userId: string;
283
+ guildId: string;
284
+ totalValue: Decimal$1;
285
+ products: SaleProductCreateArgs[];
286
+ }
287
+ interface SaleProductCreateArgs {
288
+ productId: string;
289
+ valueTotal: Decimal$1;
290
+ quantity: number;
291
+ deliveryStock?: JsonValue<Array<string>> | null;
292
+ deliveryPedding?: boolean | null;
293
+ deliveryPeddingAmount?: number | null;
294
+ }
295
+ interface Sale {
296
+ id: string;
297
+ userId: string;
298
+ guildId: string;
299
+ totalValue: Decimal$1;
300
+ createdAt: Date | null;
301
+ guild?: Guild$1;
302
+ customer?: Customer;
303
+ saleProducts?: SaleProduct[];
304
+ }
305
+ interface SaleProduct {
306
+ id: string;
307
+ saleId: string;
308
+ productId: string;
309
+ valueTotal: Decimal$1;
310
+ quantity: number;
311
+ product?: Product;
312
+ sale?: Sale;
313
+ deliveryStock?: JsonValue<Array<string>> | null;
314
+ deliveryPedding?: boolean | null;
315
+ deliveryPeddingAmount?: number | null;
316
+ }
317
+
318
+ interface EfiPixCreateResponse {
319
+ calendario: {
320
+ criacao: string;
321
+ expiracao: number;
322
+ };
323
+ txid: string;
324
+ revisao: number;
325
+ loc: {
326
+ id: number;
327
+ location: string;
328
+ tipoCob: "cob" | "cobv";
329
+ };
330
+ location: string;
331
+ status: "ATIVA" | "CONCLUIDA" | "REMOVIDA_PELO_USUARIO_RECEBEDOR" | "REMOVIDA_PELO_PSP";
332
+ devedor?: {
333
+ cpf?: string;
334
+ cnpj?: string;
335
+ nome: string;
336
+ };
337
+ valor: {
338
+ original: string;
339
+ };
340
+ chave: string;
341
+ solicitacaoPagador?: string;
342
+ pixCopiaECola?: string;
343
+ }
344
+
345
+ type PaymentProvider = "mercadoPago" | "pixsemiauto" | "efibank" | "atos" | "fluxoPay" | "wallet";
346
+ interface PaymentConfig {
347
+ guildId: string;
348
+ provider?: PaymentProvider | null;
349
+ mercadoPagoToken?: string | null;
350
+ efiBankToken?: string | null;
351
+ chavePix?: string | null;
352
+ chavePixType?: "CPF" | "EMAIL" | "ALEATORIA" | "NUMERO";
353
+ chavePixName?: string;
354
+ chavePixCity?: string;
355
+ walletApiKey?: string;
356
+ chavePixchavePixStaticQrCode: boolean;
357
+ }
358
+ interface UpdatePaymentConfigArgs {
359
+ guildId: string;
360
+ data: {
361
+ provider?: PaymentProvider | null;
362
+ mercadoPagoToken?: string | null;
363
+ walletApiKey?: string | null;
364
+ efiBankToken?: string | null;
365
+ chavePix?: string | null;
366
+ chavePixType?: "CPF" | "EMAIL" | "ALEATORIA" | "NUMERO";
367
+ chavePixName?: string;
368
+ chavePixCity?: string;
369
+ chavePixchavePixStaticQrCode?: boolean;
370
+ };
371
+ }
372
+
373
+ interface OrderPayment {
374
+ id: string;
375
+ aproved: boolean;
376
+ }
377
+ interface Order {
378
+ id: string;
379
+ aproved: boolean;
380
+ released: boolean;
381
+ cartId?: string;
382
+ planId?: string;
383
+ paymentId?: string;
384
+ guildId: string;
385
+ customerId?: string;
386
+ botClient?: string;
387
+ paymentProvider?: PaymentProvider;
388
+ automatic?: boolean;
389
+ pixKey: string;
390
+ expireAt?: Date;
391
+ createdAt: Date;
392
+ updatedAt: Date;
393
+ }
394
+ interface OrderCustomer {
395
+ id: string;
396
+ name: string;
397
+ }
398
+ interface OrderProduct {
399
+ id: string;
400
+ name: string;
401
+ quantity: number;
402
+ }
403
+ interface OrderCreate {
404
+ guildId: string;
405
+ amount: number;
406
+ cartId: string;
407
+ botClient: string;
408
+ customer: OrderCustomer;
409
+ products: OrderProduct[];
410
+ }
411
+
412
+ interface Image {
413
+ id: string;
414
+ guildId: string;
415
+ url: string;
416
+ reference: string;
417
+ name: string;
418
+ expiresIn: number;
419
+ }
420
+ type imageCreate = Omit<Image, "id">;
421
+
422
+ type CouponStatus = "ACTIVED" | "DEACTIVATED" | "EXPIRED";
423
+ interface Coupon {
424
+ id: string;
425
+ reference: string;
426
+ guildId: string;
427
+ createdBy: string;
428
+ discount: number | null;
429
+ valorMin: number | null;
430
+ valorMax: number | null;
431
+ amount: number | null;
432
+ uses: number | null;
433
+ status?: CouponStatus;
434
+ guild?: Guild | null;
435
+ }
436
+ interface CouponDraftSetArgs {
437
+ id: string;
438
+ userId: string;
439
+ data: CouponUpdateArgs["data"];
440
+ }
441
+ interface CouponDraftGetArgs {
442
+ id: string;
443
+ userId: string;
444
+ }
445
+ interface CouponCreateArgs {
446
+ createdBy: string;
447
+ reference: string;
448
+ guildId: string;
449
+ discount?: number;
450
+ valorMin?: number;
451
+ valorMax?: number;
452
+ role?: string;
453
+ amount?: number;
454
+ uses?: number;
455
+ }
456
+ interface CouponUpdateArgs {
457
+ id: string;
458
+ data: Omit<Partial<Coupon>, "id" | "reference">;
459
+ }
460
+
461
+ type CatalogStatus = "ACTIVED" | "DEACTIVATED" | "BANNED";
462
+ interface CatalogProduct {
463
+ catalogId: string;
464
+ productId: string;
465
+ product: Product;
466
+ }
467
+ interface Catalog {
468
+ id: string;
469
+ guildId: string;
470
+ reference: string;
471
+ createBy: string;
472
+ title: string | null;
473
+ description: string | null;
474
+ banners: JsonValue<string[]> | null;
475
+ color: string | null;
476
+ placeholder: string | null;
477
+ status?: CatalogStatus;
478
+ messages: JsonValue<string[]> | null;
479
+ products?: CatalogProduct[];
480
+ guild?: Guild | null;
481
+ createdAt?: Date;
482
+ updatedAt?: Date;
483
+ }
484
+ interface CatalogCreateArgs {
485
+ guildId: string;
486
+ createBy: string;
487
+ reference: string;
488
+ title?: string | null;
489
+ description?: string | null;
490
+ banners?: JsonValue<Array<string>> | null;
491
+ color?: string | null;
492
+ placeholder?: string | null;
493
+ messages?: JsonValue<string> | null;
494
+ productId?: string;
495
+ }
496
+ interface CatalogUpdateArgs {
497
+ id: string;
498
+ data: Omit<Partial<Catalog>, "id" | "reference" | "guild" | "products">;
499
+ }
500
+ interface CatalogDraftSetArgs {
501
+ id: string;
502
+ userId: string;
503
+ data: CatalogUpdateArgs["data"];
504
+ }
505
+ interface CatalogDraftGetArgs {
506
+ id: string;
507
+ userId: string;
508
+ }
509
+
510
+ type CartStatus = "MAIN" | "COUPON" | "PAYMENT" | "APPROVED" | "PENDING_APPROVAL";
511
+ type ProductId = string;
512
+ interface CartProduct {
513
+ productId: ProductId;
514
+ amount: number;
515
+ amountAvaliable: number;
516
+ cartId: string;
517
+ product: Product;
518
+ }
519
+ interface CreateCartProduct {
520
+ productId: ProductId;
521
+ amount: number;
522
+ amountAvaliable: number;
523
+ }
524
+ interface CreateCartArgs {
525
+ guildId: string;
526
+ userId: string;
527
+ expireAt: Date;
528
+ botClient: string;
529
+ message: string;
530
+ status?: CartStatus;
531
+ products: CreateCartProduct[];
532
+ }
533
+ interface UpdateCartData {
534
+ status?: CartStatus | null;
535
+ message?: string | null;
536
+ expireAt?: Date;
537
+ orderId?: string;
538
+ products?: {
539
+ create?: CreateCartProduct[];
540
+ createMany?: {
541
+ data: CreateCartProduct[];
542
+ skipDuplicates?: boolean;
543
+ };
544
+ deleteMany?: {
545
+ productId: string;
546
+ }[];
547
+ set?: {
548
+ productId: string;
549
+ }[];
550
+ updateMany?: {
551
+ where: {
552
+ productId: string;
553
+ };
554
+ data: Partial<CreateCartProduct>;
555
+ }[];
556
+ } | null;
557
+ }
558
+ interface CartUpdateArgs {
559
+ id: string;
560
+ data: UpdateCartData;
561
+ }
562
+ interface Cart {
563
+ id: string;
564
+ guildId: string;
565
+ status: CartStatus;
566
+ userId: string;
567
+ message: string;
568
+ products: CartProduct[];
569
+ createdAt: Date;
570
+ updatedAt: Date;
571
+ expireAt?: Date;
572
+ orderId?: string;
573
+ botClient: string;
574
+ guild?: Guild$1 | null;
575
+ }
576
+ interface CartDraft {
577
+ products: CartDraftProduct[];
578
+ }
579
+ interface CartDraftProduct {
580
+ productId: string;
581
+ amount: number;
582
+ }
583
+ interface CartGetArgs {
584
+ userId: string;
585
+ guildId: string;
586
+ }
587
+
588
+ declare function cartWillExpire(cart: Cart): Promise<void>;
589
+ declare function cartAntiFakeVerify(configs: Config, member: GuildMember): boolean;
590
+ declare function cartVerifyPermission(cart: Cart, member: GuildMember, configs: Config): boolean;
591
+ declare function cartCalculeTotal(cart: Cart): Decimal$1;
592
+ declare function cartVerifyAproved(cartId: string): Promise<boolean>;
593
+
594
+ declare const formatPrice: (value: number | {
595
+ toString(): string;
596
+ }) => string;
597
+ declare const formatDecimalToNumber: (value: {
598
+ toString(): string;
599
+ }) => number;
600
+ declare const formatNumberToDecimal: (value: number) => Decimal$1;
601
+ declare function formatRelativeTime(ms: number): string;
602
+
603
+ declare function hasPermission(member: GuildMember, requiredPerms: ActionPermission[], configs: Config): boolean;
604
+
605
+ type CreateStaticPixInput = Parameters<typeof createStaticPix>[0];
606
+ interface QRCodeOptions {
607
+ merchantName?: string;
608
+ merchantCity?: string;
609
+ amount?: number;
610
+ description?: string;
611
+ logoUrl?: string;
612
+ logoSize?: number;
613
+ qrColor?: string;
614
+ backgroundColor?: string;
615
+ rounded?: boolean;
616
+ }
617
+ declare class Pix {
618
+ create(data: CreateStaticPixInput): PixStaticObject | null;
619
+ private loadImageFromUrl;
620
+ qrCodeImage(pixKeyOrPayload: string, options?: QRCodeOptions): Promise<Buffer>;
621
+ private roundRect;
622
+ }
623
+ declare const pixUtils: Pix;
624
+
625
+ interface ShopEasySDKOptions {
626
+ baseUrl?: string;
627
+ secretKey?: string;
628
+ }
629
+ declare class ShopEasySdk {
630
+ constructor(options: ShopEasySDKOptions);
631
+ carts: {
632
+ draft: {
633
+ get: (cardId: string) => Promise<CartDraft | null>;
634
+ set: ({ cartId, update, }: {
635
+ cartId: string;
636
+ update: CartDraft;
637
+ }) => Promise<Cart>;
638
+ delete: (cartId: string) => Promise<void>;
639
+ };
640
+ create(args: CreateCartArgs): Promise<Cart>;
641
+ get(args: CartGetArgs): Promise<Cart | null>;
642
+ getById(cartId: string): Promise<Cart | null>;
643
+ getAllByGuild(guildId: string): Promise<Cart[]>;
644
+ update(args: CartUpdateArgs): Promise<Cart>;
645
+ expires(botClient: string): Promise<Cart[]>;
646
+ count(guildId: string): Promise<number>;
647
+ delete(cartId: string): Promise<void>;
648
+ };
649
+ catalogs: {
650
+ setDraft(args: CatalogDraftSetArgs): Promise<Catalog | null>;
651
+ getDraft(args: CatalogDraftGetArgs): Promise<Catalog | null>;
652
+ getByReference(reference: string, guildId: string): Promise<Catalog | null>;
653
+ getById(id: string): Promise<Catalog | null>;
654
+ create(args: CatalogCreateArgs): Promise<Catalog>;
655
+ getByCaching(id: string): Promise<Catalog | null>;
656
+ getAllByGuild(guildId: string): Promise<Array<Catalog>>;
657
+ update(args: CatalogUpdateArgs): Promise<Catalog>;
658
+ count(guildId: string): Promise<number>;
659
+ delete(id: string): Promise<Catalog>;
660
+ };
661
+ configs: {
662
+ getByGuild(guildId: string): Promise<Config>;
663
+ setDraft(args: ConfigDraftSetArgs): Promise<Config | null>;
664
+ delDraft(args: ConfigDraftGetArgs): Promise<Config | null>;
665
+ getDraft(args: ConfigDraftGetArgs): Promise<Config | null>;
666
+ update(args: ConfigUpdateArgs): Promise<Config>;
667
+ getByCaching(_guildId: string): Promise<Config | null>;
668
+ };
669
+ coupons: {
670
+ setDraft(args: CouponDraftSetArgs): Promise<Coupon | null>;
671
+ getDraft(args: CouponDraftGetArgs): Promise<Coupon | null>;
672
+ existsByCode(code: string): Promise<boolean>;
673
+ getById(id: string): Promise<Coupon | null>;
674
+ create(args: CouponCreateArgs): Promise<Coupon>;
675
+ getByCaching(id: string): Promise<Coupon | null>;
676
+ getAllByGuild(guildId: string): Promise<Coupon[]>;
677
+ update(args: CouponUpdateArgs): Promise<Coupon>;
678
+ count(guildId: string): Promise<number>;
679
+ delete(id: string): Promise<Coupon>;
680
+ };
681
+ customers: {
682
+ setDraft(args: CustomerDraftSetArgs): Promise<Customer | null>;
683
+ getDraft(args: CustomerDraftGetArgs): Promise<Customer | null>;
684
+ existsByReference(_reference: string): Promise<boolean>;
685
+ getById(id: string): Promise<Customer | null>;
686
+ getByReference(_reference: string): Promise<Customer | null>;
687
+ create(args: CustomerCreateArgs): Promise<Customer>;
688
+ getByCaching(id: string): Promise<Customer | null>;
689
+ getAllByGuild(guildId: string): Promise<Customer[]>;
690
+ update(args: CustomerUpdateArgs): Promise<Customer>;
691
+ count(guildId: string): Promise<number>;
692
+ delete(id: string): Promise<Customer>;
693
+ };
694
+ images: {
695
+ getAll(guildId: string): Promise<Image[]>;
696
+ create(args: imageCreate): Promise<Image>;
697
+ };
698
+ orders: {
699
+ create(args: OrderCreate): Promise<Order>;
700
+ get(orderId: string): Promise<Order | null>;
701
+ getPayment(orderId: string): Promise<OrderPayment | null>;
702
+ getApprovedUnprocessed(botClient: string, guildId?: string): Promise<Order[]>;
703
+ markAsReleased(id: string): Promise<Order>;
704
+ aprove(id: string): Promise<Order>;
705
+ };
706
+ paymentConfig: {
707
+ getOrCreate(guildId: string): Promise<PaymentConfig>;
708
+ update(args: UpdatePaymentConfigArgs): Promise<PaymentConfig>;
709
+ getByCaching(guildId: string): Promise<PaymentConfig | null>;
710
+ };
711
+ plans: {
712
+ getByGuild(guildId: string): Promise<Plan | null>;
713
+ havePlan(guildId: string): Promise<PlanType | null>;
714
+ create(args: Plan): Promise<Plan>;
715
+ getExpiring(days?: number): Promise<ExpiringPlan[]>;
716
+ getExpired(): Promise<ExpiredPlansResponse>;
717
+ getPlansNeedingAlert(days?: number): Promise<PlansNeedingAlertResponse>;
718
+ markAlertSent(guildId: string, daysUntilExpire: number): Promise<MarkAlertResponse>;
719
+ checkExpirations(): Promise<CheckExpirationsResponse>;
720
+ getExpirationStatus(guildId: string): Promise<PlanStatus>;
721
+ update(guildId: string, updates: Partial<Plan>): Promise<Plan>;
722
+ delete(guildId: string): Promise<void>;
723
+ createSubscription(args: PlanSubscriptionCreateArgs): Promise<EfiPixCreateResponse>;
724
+ };
725
+ products: {
726
+ setDraft(args: ProduductDraftSetArgs): Promise<Product | null>;
727
+ pushStock({ product, amount, }: ProductStockPushArgs): Promise<string[]>;
728
+ countStock(product: Product): number;
729
+ getDraft(args: ProduductDraftGetArgs): Promise<Product | null>;
730
+ existsByReference(args: ProductGetByReference): Promise<Product | null>;
731
+ getById(id: string): Promise<Product | null>;
732
+ getByReference({ reference, guildId, }: {
733
+ reference: string;
734
+ guildId: string;
735
+ }): Promise<Product | null>;
736
+ create(args: ProductCreateArgs): Promise<Product>;
737
+ getByCaching(id: string): Promise<Product | null>;
738
+ getAllByGuild(guildId: string): Promise<Array<Product>>;
739
+ update(args: ProductUpdateArgs): Promise<Product>;
740
+ count(guildId: string): Promise<number>;
741
+ delete(id: string): Promise<void>;
742
+ };
743
+ sales: {
744
+ create(args: SaleCreateArgs): Promise<Sale>;
745
+ getById(id: string): Promise<Sale | null>;
746
+ getAllByGuild(guildId: string): Promise<Sale[]>;
747
+ saleProductGet(id: string): Promise<SaleProduct$1 | null>;
748
+ delete(id: string): Promise<void>;
749
+ };
750
+ tokens: {
751
+ listUnused(): Promise<Token[] | null>;
752
+ update(args: TokenUpdateArgs): Promise<Token>;
753
+ };
754
+ users: {
755
+ get(userId: string): Promise<User | null>;
756
+ };
757
+ wallet: {
758
+ getOrCreate(userId: string): Promise<Wallet>;
759
+ getByUserId(userId: string): Promise<Wallet>;
760
+ getByApiKey(apiKey: string): Promise<Wallet>;
761
+ update(args: UpdateWalletArgs): Promise<Wallet>;
762
+ getByCaching(userId: string): Promise<Wallet | null>;
763
+ };
764
+ }
765
+
766
+ export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };