shopeasy-sdk 1.0.3 → 1.0.4
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/dist/functions/api/services/wallet.service.cjs +5 -1
- package/dist/functions/api/services/wallet.service.mjs +5 -1
- package/dist/index.d.cts +193 -158
- package/dist/index.d.mts +193 -158
- package/dist/index.d.ts +193 -158
- package/package.json +1 -1
|
@@ -13,7 +13,11 @@ class WalletService {
|
|
|
13
13
|
}
|
|
14
14
|
async getByApiKey(apiKey) {
|
|
15
15
|
const { data } = await config.api.get(`/wallet/by-api/${apiKey}`);
|
|
16
|
-
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
async withdrawAtos(args) {
|
|
19
|
+
const { walletKey, apiKey, pixKey, pixKeyType } = args;
|
|
20
|
+
const { data } = await config.api.post(`/atos/wallet/${walletKey}`, { apiKey, pixKey, pixKeyType });
|
|
17
21
|
return data;
|
|
18
22
|
}
|
|
19
23
|
async update(args) {
|
|
@@ -11,7 +11,11 @@ class WalletService {
|
|
|
11
11
|
}
|
|
12
12
|
async getByApiKey(apiKey) {
|
|
13
13
|
const { data } = await api.get(`/wallet/by-api/${apiKey}`);
|
|
14
|
-
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
async withdrawAtos(args) {
|
|
17
|
+
const { walletKey, apiKey, pixKey, pixKeyType } = args;
|
|
18
|
+
const { data } = await api.post(`/atos/wallet/${walletKey}`, { apiKey, pixKey, pixKeyType });
|
|
15
19
|
return data;
|
|
16
20
|
}
|
|
17
21
|
async update(args) {
|
package/dist/index.d.cts
CHANGED
|
@@ -2,6 +2,197 @@ import { Decimal as Decimal$1 } from 'decimal.js';
|
|
|
2
2
|
import { Guild as Guild$1, GuildMember } from 'discord.js';
|
|
3
3
|
import { createStaticPix, PixStaticObject } from 'pix-utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Tipos de chave PIX aceitos pela A-TOS
|
|
7
|
+
*/
|
|
8
|
+
type AtosPixKeyType = "phone" | "email" | "random" | "cpf" | "cnpj";
|
|
9
|
+
/**
|
|
10
|
+
* Recipient types:
|
|
11
|
+
* 0 → divide lucro (não altera valor)
|
|
12
|
+
* 1 → comissão percentual (antes dos sócios)
|
|
13
|
+
* 2 → soma no valor cobrado (taxas / upsell)
|
|
14
|
+
*/
|
|
15
|
+
type AtosRecipientType = 0 | 1 | 2;
|
|
16
|
+
/**
|
|
17
|
+
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
18
|
+
*/
|
|
19
|
+
interface AtosRecipientType2 {
|
|
20
|
+
id: string;
|
|
21
|
+
type: 2;
|
|
22
|
+
amount: number;
|
|
23
|
+
percentage?: never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type 1 → comissão percentual (antes dos sócios)
|
|
27
|
+
*/
|
|
28
|
+
interface AtosRecipientType1 {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 1;
|
|
31
|
+
percentage: number;
|
|
32
|
+
amount?: never;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type 0 → divisão de lucro entre sócios / owner
|
|
36
|
+
*/
|
|
37
|
+
interface AtosRecipientType0 {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 0;
|
|
40
|
+
percentage: number;
|
|
41
|
+
amount?: never;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Union final de recipients (INPUT)
|
|
45
|
+
*/
|
|
46
|
+
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
47
|
+
interface AtosCreatePixPaymentInput {
|
|
48
|
+
amount: number;
|
|
49
|
+
fee_to_customer?: boolean;
|
|
50
|
+
shop: {
|
|
51
|
+
/** ID lógico do servidor / loja */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Nome do servidor / loja */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Wallet / owner que receberá o saldo */
|
|
56
|
+
owner_id: string;
|
|
57
|
+
};
|
|
58
|
+
items: {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
}[];
|
|
63
|
+
customer: {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
seller: {
|
|
68
|
+
/** CPF ou CNPJ do titular da API Key */
|
|
69
|
+
national_registration: string;
|
|
70
|
+
national_registration_name: string;
|
|
71
|
+
};
|
|
72
|
+
recipients?: AtosRecipient[];
|
|
73
|
+
overwrite_webhook_url?: string;
|
|
74
|
+
}
|
|
75
|
+
interface AtosCreatePixPaymentResponse {
|
|
76
|
+
id: string;
|
|
77
|
+
amount: number;
|
|
78
|
+
status: string;
|
|
79
|
+
qr_code?: string;
|
|
80
|
+
qr_code_image_url?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recipient retornado pelo gateway
|
|
84
|
+
*/
|
|
85
|
+
interface AtosRecipientResponse {
|
|
86
|
+
id: string;
|
|
87
|
+
type: AtosRecipientType;
|
|
88
|
+
percentage: number | null;
|
|
89
|
+
amount: number;
|
|
90
|
+
available_at: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Shop retornado
|
|
94
|
+
*/
|
|
95
|
+
interface AtosShopResponse {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
owner_id: string;
|
|
99
|
+
created_at: string | null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Item retornado
|
|
103
|
+
*/
|
|
104
|
+
interface AtosItemResponse {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
quantity: number;
|
|
108
|
+
}
|
|
109
|
+
type AtosPaymentStatus = "pending" | "paid" | "expired" | "refunded" | "canceled" | "failed";
|
|
110
|
+
interface AtosGetPaymentResponse {
|
|
111
|
+
id: string;
|
|
112
|
+
shop: AtosShopResponse;
|
|
113
|
+
status: AtosPaymentStatus;
|
|
114
|
+
amount: number;
|
|
115
|
+
recipients: AtosRecipientResponse[];
|
|
116
|
+
items: AtosItemResponse[];
|
|
117
|
+
customer: AtosCustomerResponse;
|
|
118
|
+
/** Código PIX copia e cola (só existe se for PIX) */
|
|
119
|
+
data: string | null;
|
|
120
|
+
payer: unknown | null;
|
|
121
|
+
expire_at: string | null;
|
|
122
|
+
created_at: string;
|
|
123
|
+
infraction: unknown | null;
|
|
124
|
+
end2end_id: string | null;
|
|
125
|
+
receipt_file_url: string | null;
|
|
126
|
+
custom_message: string | null;
|
|
127
|
+
withdrawn: boolean;
|
|
128
|
+
withdraw_id: string | null;
|
|
129
|
+
kyc_validated: boolean;
|
|
130
|
+
identifier: string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Customer retornado
|
|
134
|
+
*/
|
|
135
|
+
interface AtosCustomerResponse {
|
|
136
|
+
id: string;
|
|
137
|
+
name: string;
|
|
138
|
+
cpf: string | null;
|
|
139
|
+
email: string | null;
|
|
140
|
+
ip: string | null;
|
|
141
|
+
}
|
|
142
|
+
interface AtosCreatePixPaymentFullResponse {
|
|
143
|
+
id: string;
|
|
144
|
+
shop: AtosShopResponse;
|
|
145
|
+
status: "pending" | "paid" | "expired" | "refunded";
|
|
146
|
+
amount: number;
|
|
147
|
+
recipients: AtosRecipientResponse[];
|
|
148
|
+
items: AtosItemResponse[];
|
|
149
|
+
customer: AtosCustomerResponse;
|
|
150
|
+
/** Código PIX (copia e cola) */
|
|
151
|
+
data: string;
|
|
152
|
+
payer: unknown | null;
|
|
153
|
+
/** Data de expiração do PIX */
|
|
154
|
+
expire_at: string;
|
|
155
|
+
created_at: string;
|
|
156
|
+
infraction: unknown | null;
|
|
157
|
+
end2end_id: string | null;
|
|
158
|
+
receipt_file_url: string | null;
|
|
159
|
+
custom_message: string | null;
|
|
160
|
+
withdrawn: boolean;
|
|
161
|
+
withdraw_id: string | null;
|
|
162
|
+
kyc_validated: boolean;
|
|
163
|
+
/** Identificador interno do gateway */
|
|
164
|
+
identifier: string;
|
|
165
|
+
}
|
|
166
|
+
interface AtosRefundResponse {
|
|
167
|
+
success?: boolean;
|
|
168
|
+
status?: string;
|
|
169
|
+
}
|
|
170
|
+
interface AtosWithdrawArgs {
|
|
171
|
+
apiKey: string;
|
|
172
|
+
pixKey: string;
|
|
173
|
+
pixKeyType: "cpf" | "cnpj" | "email" | "phone" | "random";
|
|
174
|
+
walletKey: string;
|
|
175
|
+
}
|
|
176
|
+
interface atosWithdrawResponse {
|
|
177
|
+
sucess?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface AtosWithdrawInput {
|
|
180
|
+
/** Wallet / owner que está sacando */
|
|
181
|
+
withdraw_user_id: string;
|
|
182
|
+
pixKey: string;
|
|
183
|
+
pixKeyType: AtosPixKeyType;
|
|
184
|
+
baasPostbackUrl: string;
|
|
185
|
+
}
|
|
186
|
+
interface AtosWithdrawResponse {
|
|
187
|
+
id: string;
|
|
188
|
+
status: string;
|
|
189
|
+
}
|
|
190
|
+
interface AtosBalanceResponse {
|
|
191
|
+
pending: number;
|
|
192
|
+
available: number;
|
|
193
|
+
locked: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
5
196
|
type GatewayProvider = "atos" | "fluxopay";
|
|
6
197
|
interface WalletBalance {
|
|
7
198
|
pending: number;
|
|
@@ -610,163 +801,6 @@ interface CartGetArgs {
|
|
|
610
801
|
guildId: string;
|
|
611
802
|
}
|
|
612
803
|
|
|
613
|
-
/**
|
|
614
|
-
* Tipos de chave PIX aceitos pela A-TOS
|
|
615
|
-
*/
|
|
616
|
-
type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
|
|
617
|
-
/**
|
|
618
|
-
* Recipient types:
|
|
619
|
-
* 0 → divide lucro (não altera valor)
|
|
620
|
-
* 1 → comissão percentual (antes dos sócios)
|
|
621
|
-
* 2 → soma no valor cobrado (taxas / upsell)
|
|
622
|
-
*/
|
|
623
|
-
type AtosRecipientType = 0 | 1 | 2;
|
|
624
|
-
/**
|
|
625
|
-
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
626
|
-
*/
|
|
627
|
-
interface AtosRecipientType2 {
|
|
628
|
-
id: string;
|
|
629
|
-
type: 2;
|
|
630
|
-
amount: number;
|
|
631
|
-
percentage?: never;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Type 1 → comissão percentual (antes dos sócios)
|
|
635
|
-
*/
|
|
636
|
-
interface AtosRecipientType1 {
|
|
637
|
-
id: string;
|
|
638
|
-
type: 1;
|
|
639
|
-
percentage: number;
|
|
640
|
-
amount?: never;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Type 0 → divisão de lucro entre sócios / owner
|
|
644
|
-
*/
|
|
645
|
-
interface AtosRecipientType0 {
|
|
646
|
-
id: string;
|
|
647
|
-
type: 0;
|
|
648
|
-
percentage: number;
|
|
649
|
-
amount?: never;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Union final de recipients (INPUT)
|
|
653
|
-
*/
|
|
654
|
-
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
655
|
-
interface AtosCreatePixPaymentInput {
|
|
656
|
-
amount: number;
|
|
657
|
-
fee_to_customer?: boolean;
|
|
658
|
-
shop: {
|
|
659
|
-
/** ID lógico do servidor / loja */
|
|
660
|
-
id: string;
|
|
661
|
-
/** Nome do servidor / loja */
|
|
662
|
-
name: string;
|
|
663
|
-
/** Wallet / owner que receberá o saldo */
|
|
664
|
-
owner_id: string;
|
|
665
|
-
};
|
|
666
|
-
items: {
|
|
667
|
-
id: string;
|
|
668
|
-
name: string;
|
|
669
|
-
quantity: number;
|
|
670
|
-
}[];
|
|
671
|
-
customer: {
|
|
672
|
-
id: string;
|
|
673
|
-
name: string;
|
|
674
|
-
};
|
|
675
|
-
seller: {
|
|
676
|
-
/** CPF ou CNPJ do titular da API Key */
|
|
677
|
-
national_registration: string;
|
|
678
|
-
national_registration_name: string;
|
|
679
|
-
};
|
|
680
|
-
recipients?: AtosRecipient[];
|
|
681
|
-
overwrite_webhook_url?: string;
|
|
682
|
-
}
|
|
683
|
-
interface AtosCreatePixPaymentResponse {
|
|
684
|
-
id: string;
|
|
685
|
-
amount: number;
|
|
686
|
-
status: string;
|
|
687
|
-
qr_code?: string;
|
|
688
|
-
qr_code_image_url?: string;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Recipient retornado pelo gateway
|
|
692
|
-
*/
|
|
693
|
-
interface AtosRecipientResponse {
|
|
694
|
-
id: string;
|
|
695
|
-
type: AtosRecipientType;
|
|
696
|
-
percentage: number | null;
|
|
697
|
-
amount: number;
|
|
698
|
-
available_at: string | null;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Shop retornado
|
|
702
|
-
*/
|
|
703
|
-
interface AtosShopResponse {
|
|
704
|
-
id: string;
|
|
705
|
-
name: string;
|
|
706
|
-
owner_id: string;
|
|
707
|
-
created_at: string | null;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Item retornado
|
|
711
|
-
*/
|
|
712
|
-
interface AtosItemResponse {
|
|
713
|
-
id: string;
|
|
714
|
-
name: string;
|
|
715
|
-
quantity: number;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Customer retornado
|
|
719
|
-
*/
|
|
720
|
-
interface AtosCustomerResponse {
|
|
721
|
-
id: string;
|
|
722
|
-
name: string;
|
|
723
|
-
cpf: string | null;
|
|
724
|
-
email: string | null;
|
|
725
|
-
ip: string | null;
|
|
726
|
-
}
|
|
727
|
-
interface AtosCreatePixPaymentFullResponse {
|
|
728
|
-
id: string;
|
|
729
|
-
shop: AtosShopResponse;
|
|
730
|
-
status: "pending" | "paid" | "expired" | "refunded";
|
|
731
|
-
amount: number;
|
|
732
|
-
recipients: AtosRecipientResponse[];
|
|
733
|
-
items: AtosItemResponse[];
|
|
734
|
-
customer: AtosCustomerResponse;
|
|
735
|
-
/** Código PIX (copia e cola) */
|
|
736
|
-
data: string;
|
|
737
|
-
payer: unknown | null;
|
|
738
|
-
/** Data de expiração do PIX */
|
|
739
|
-
expire_at: string;
|
|
740
|
-
created_at: string;
|
|
741
|
-
infraction: unknown | null;
|
|
742
|
-
end2end_id: string | null;
|
|
743
|
-
receipt_file_url: string | null;
|
|
744
|
-
custom_message: string | null;
|
|
745
|
-
withdrawn: boolean;
|
|
746
|
-
withdraw_id: string | null;
|
|
747
|
-
kyc_validated: boolean;
|
|
748
|
-
/** Identificador interno do gateway */
|
|
749
|
-
identifier: string;
|
|
750
|
-
}
|
|
751
|
-
interface AtosRefundResponse {
|
|
752
|
-
success?: boolean;
|
|
753
|
-
status?: string;
|
|
754
|
-
}
|
|
755
|
-
interface AtosWithdrawInput {
|
|
756
|
-
/** Wallet / owner que está sacando */
|
|
757
|
-
withdraw_user_id: string;
|
|
758
|
-
pixKey: string;
|
|
759
|
-
pixKeyType: AtosPixKeyType;
|
|
760
|
-
baasPostbackUrl: string;
|
|
761
|
-
}
|
|
762
|
-
interface AtosWithdrawResponse {
|
|
763
|
-
id: string;
|
|
764
|
-
status: string;
|
|
765
|
-
}
|
|
766
|
-
interface AtosBalanceResponse {
|
|
767
|
-
balance: number;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
804
|
interface Bot {
|
|
771
805
|
id: string;
|
|
772
806
|
hostingId: string | null;
|
|
@@ -968,10 +1002,11 @@ declare class ShopEasySdk {
|
|
|
968
1002
|
getOrCreate(userId: string): Promise<Wallet>;
|
|
969
1003
|
getByUserId(userId: string): Promise<Wallet>;
|
|
970
1004
|
getByApiKey(apiKey: string): Promise<Wallet>;
|
|
1005
|
+
withdrawAtos(args: AtosWithdrawArgs): Promise<atosWithdrawResponse>;
|
|
971
1006
|
update(args: UpdateWalletArgs): Promise<Wallet>;
|
|
972
1007
|
getByCaching(userId: string): Promise<Wallet | null>;
|
|
973
1008
|
};
|
|
974
1009
|
}
|
|
975
1010
|
|
|
976
1011
|
export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
|
|
977
|
-
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
|
|
1012
|
+
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosGetPaymentResponse, AtosItemResponse, AtosPaymentStatus, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawArgs, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, atosWithdrawResponse, imageCreate, paymentProvider };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,197 @@ import { Decimal as Decimal$1 } from 'decimal.js';
|
|
|
2
2
|
import { Guild as Guild$1, GuildMember } from 'discord.js';
|
|
3
3
|
import { createStaticPix, PixStaticObject } from 'pix-utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Tipos de chave PIX aceitos pela A-TOS
|
|
7
|
+
*/
|
|
8
|
+
type AtosPixKeyType = "phone" | "email" | "random" | "cpf" | "cnpj";
|
|
9
|
+
/**
|
|
10
|
+
* Recipient types:
|
|
11
|
+
* 0 → divide lucro (não altera valor)
|
|
12
|
+
* 1 → comissão percentual (antes dos sócios)
|
|
13
|
+
* 2 → soma no valor cobrado (taxas / upsell)
|
|
14
|
+
*/
|
|
15
|
+
type AtosRecipientType = 0 | 1 | 2;
|
|
16
|
+
/**
|
|
17
|
+
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
18
|
+
*/
|
|
19
|
+
interface AtosRecipientType2 {
|
|
20
|
+
id: string;
|
|
21
|
+
type: 2;
|
|
22
|
+
amount: number;
|
|
23
|
+
percentage?: never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type 1 → comissão percentual (antes dos sócios)
|
|
27
|
+
*/
|
|
28
|
+
interface AtosRecipientType1 {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 1;
|
|
31
|
+
percentage: number;
|
|
32
|
+
amount?: never;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type 0 → divisão de lucro entre sócios / owner
|
|
36
|
+
*/
|
|
37
|
+
interface AtosRecipientType0 {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 0;
|
|
40
|
+
percentage: number;
|
|
41
|
+
amount?: never;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Union final de recipients (INPUT)
|
|
45
|
+
*/
|
|
46
|
+
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
47
|
+
interface AtosCreatePixPaymentInput {
|
|
48
|
+
amount: number;
|
|
49
|
+
fee_to_customer?: boolean;
|
|
50
|
+
shop: {
|
|
51
|
+
/** ID lógico do servidor / loja */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Nome do servidor / loja */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Wallet / owner que receberá o saldo */
|
|
56
|
+
owner_id: string;
|
|
57
|
+
};
|
|
58
|
+
items: {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
}[];
|
|
63
|
+
customer: {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
seller: {
|
|
68
|
+
/** CPF ou CNPJ do titular da API Key */
|
|
69
|
+
national_registration: string;
|
|
70
|
+
national_registration_name: string;
|
|
71
|
+
};
|
|
72
|
+
recipients?: AtosRecipient[];
|
|
73
|
+
overwrite_webhook_url?: string;
|
|
74
|
+
}
|
|
75
|
+
interface AtosCreatePixPaymentResponse {
|
|
76
|
+
id: string;
|
|
77
|
+
amount: number;
|
|
78
|
+
status: string;
|
|
79
|
+
qr_code?: string;
|
|
80
|
+
qr_code_image_url?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recipient retornado pelo gateway
|
|
84
|
+
*/
|
|
85
|
+
interface AtosRecipientResponse {
|
|
86
|
+
id: string;
|
|
87
|
+
type: AtosRecipientType;
|
|
88
|
+
percentage: number | null;
|
|
89
|
+
amount: number;
|
|
90
|
+
available_at: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Shop retornado
|
|
94
|
+
*/
|
|
95
|
+
interface AtosShopResponse {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
owner_id: string;
|
|
99
|
+
created_at: string | null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Item retornado
|
|
103
|
+
*/
|
|
104
|
+
interface AtosItemResponse {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
quantity: number;
|
|
108
|
+
}
|
|
109
|
+
type AtosPaymentStatus = "pending" | "paid" | "expired" | "refunded" | "canceled" | "failed";
|
|
110
|
+
interface AtosGetPaymentResponse {
|
|
111
|
+
id: string;
|
|
112
|
+
shop: AtosShopResponse;
|
|
113
|
+
status: AtosPaymentStatus;
|
|
114
|
+
amount: number;
|
|
115
|
+
recipients: AtosRecipientResponse[];
|
|
116
|
+
items: AtosItemResponse[];
|
|
117
|
+
customer: AtosCustomerResponse;
|
|
118
|
+
/** Código PIX copia e cola (só existe se for PIX) */
|
|
119
|
+
data: string | null;
|
|
120
|
+
payer: unknown | null;
|
|
121
|
+
expire_at: string | null;
|
|
122
|
+
created_at: string;
|
|
123
|
+
infraction: unknown | null;
|
|
124
|
+
end2end_id: string | null;
|
|
125
|
+
receipt_file_url: string | null;
|
|
126
|
+
custom_message: string | null;
|
|
127
|
+
withdrawn: boolean;
|
|
128
|
+
withdraw_id: string | null;
|
|
129
|
+
kyc_validated: boolean;
|
|
130
|
+
identifier: string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Customer retornado
|
|
134
|
+
*/
|
|
135
|
+
interface AtosCustomerResponse {
|
|
136
|
+
id: string;
|
|
137
|
+
name: string;
|
|
138
|
+
cpf: string | null;
|
|
139
|
+
email: string | null;
|
|
140
|
+
ip: string | null;
|
|
141
|
+
}
|
|
142
|
+
interface AtosCreatePixPaymentFullResponse {
|
|
143
|
+
id: string;
|
|
144
|
+
shop: AtosShopResponse;
|
|
145
|
+
status: "pending" | "paid" | "expired" | "refunded";
|
|
146
|
+
amount: number;
|
|
147
|
+
recipients: AtosRecipientResponse[];
|
|
148
|
+
items: AtosItemResponse[];
|
|
149
|
+
customer: AtosCustomerResponse;
|
|
150
|
+
/** Código PIX (copia e cola) */
|
|
151
|
+
data: string;
|
|
152
|
+
payer: unknown | null;
|
|
153
|
+
/** Data de expiração do PIX */
|
|
154
|
+
expire_at: string;
|
|
155
|
+
created_at: string;
|
|
156
|
+
infraction: unknown | null;
|
|
157
|
+
end2end_id: string | null;
|
|
158
|
+
receipt_file_url: string | null;
|
|
159
|
+
custom_message: string | null;
|
|
160
|
+
withdrawn: boolean;
|
|
161
|
+
withdraw_id: string | null;
|
|
162
|
+
kyc_validated: boolean;
|
|
163
|
+
/** Identificador interno do gateway */
|
|
164
|
+
identifier: string;
|
|
165
|
+
}
|
|
166
|
+
interface AtosRefundResponse {
|
|
167
|
+
success?: boolean;
|
|
168
|
+
status?: string;
|
|
169
|
+
}
|
|
170
|
+
interface AtosWithdrawArgs {
|
|
171
|
+
apiKey: string;
|
|
172
|
+
pixKey: string;
|
|
173
|
+
pixKeyType: "cpf" | "cnpj" | "email" | "phone" | "random";
|
|
174
|
+
walletKey: string;
|
|
175
|
+
}
|
|
176
|
+
interface atosWithdrawResponse {
|
|
177
|
+
sucess?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface AtosWithdrawInput {
|
|
180
|
+
/** Wallet / owner que está sacando */
|
|
181
|
+
withdraw_user_id: string;
|
|
182
|
+
pixKey: string;
|
|
183
|
+
pixKeyType: AtosPixKeyType;
|
|
184
|
+
baasPostbackUrl: string;
|
|
185
|
+
}
|
|
186
|
+
interface AtosWithdrawResponse {
|
|
187
|
+
id: string;
|
|
188
|
+
status: string;
|
|
189
|
+
}
|
|
190
|
+
interface AtosBalanceResponse {
|
|
191
|
+
pending: number;
|
|
192
|
+
available: number;
|
|
193
|
+
locked: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
5
196
|
type GatewayProvider = "atos" | "fluxopay";
|
|
6
197
|
interface WalletBalance {
|
|
7
198
|
pending: number;
|
|
@@ -610,163 +801,6 @@ interface CartGetArgs {
|
|
|
610
801
|
guildId: string;
|
|
611
802
|
}
|
|
612
803
|
|
|
613
|
-
/**
|
|
614
|
-
* Tipos de chave PIX aceitos pela A-TOS
|
|
615
|
-
*/
|
|
616
|
-
type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
|
|
617
|
-
/**
|
|
618
|
-
* Recipient types:
|
|
619
|
-
* 0 → divide lucro (não altera valor)
|
|
620
|
-
* 1 → comissão percentual (antes dos sócios)
|
|
621
|
-
* 2 → soma no valor cobrado (taxas / upsell)
|
|
622
|
-
*/
|
|
623
|
-
type AtosRecipientType = 0 | 1 | 2;
|
|
624
|
-
/**
|
|
625
|
-
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
626
|
-
*/
|
|
627
|
-
interface AtosRecipientType2 {
|
|
628
|
-
id: string;
|
|
629
|
-
type: 2;
|
|
630
|
-
amount: number;
|
|
631
|
-
percentage?: never;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Type 1 → comissão percentual (antes dos sócios)
|
|
635
|
-
*/
|
|
636
|
-
interface AtosRecipientType1 {
|
|
637
|
-
id: string;
|
|
638
|
-
type: 1;
|
|
639
|
-
percentage: number;
|
|
640
|
-
amount?: never;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Type 0 → divisão de lucro entre sócios / owner
|
|
644
|
-
*/
|
|
645
|
-
interface AtosRecipientType0 {
|
|
646
|
-
id: string;
|
|
647
|
-
type: 0;
|
|
648
|
-
percentage: number;
|
|
649
|
-
amount?: never;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Union final de recipients (INPUT)
|
|
653
|
-
*/
|
|
654
|
-
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
655
|
-
interface AtosCreatePixPaymentInput {
|
|
656
|
-
amount: number;
|
|
657
|
-
fee_to_customer?: boolean;
|
|
658
|
-
shop: {
|
|
659
|
-
/** ID lógico do servidor / loja */
|
|
660
|
-
id: string;
|
|
661
|
-
/** Nome do servidor / loja */
|
|
662
|
-
name: string;
|
|
663
|
-
/** Wallet / owner que receberá o saldo */
|
|
664
|
-
owner_id: string;
|
|
665
|
-
};
|
|
666
|
-
items: {
|
|
667
|
-
id: string;
|
|
668
|
-
name: string;
|
|
669
|
-
quantity: number;
|
|
670
|
-
}[];
|
|
671
|
-
customer: {
|
|
672
|
-
id: string;
|
|
673
|
-
name: string;
|
|
674
|
-
};
|
|
675
|
-
seller: {
|
|
676
|
-
/** CPF ou CNPJ do titular da API Key */
|
|
677
|
-
national_registration: string;
|
|
678
|
-
national_registration_name: string;
|
|
679
|
-
};
|
|
680
|
-
recipients?: AtosRecipient[];
|
|
681
|
-
overwrite_webhook_url?: string;
|
|
682
|
-
}
|
|
683
|
-
interface AtosCreatePixPaymentResponse {
|
|
684
|
-
id: string;
|
|
685
|
-
amount: number;
|
|
686
|
-
status: string;
|
|
687
|
-
qr_code?: string;
|
|
688
|
-
qr_code_image_url?: string;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Recipient retornado pelo gateway
|
|
692
|
-
*/
|
|
693
|
-
interface AtosRecipientResponse {
|
|
694
|
-
id: string;
|
|
695
|
-
type: AtosRecipientType;
|
|
696
|
-
percentage: number | null;
|
|
697
|
-
amount: number;
|
|
698
|
-
available_at: string | null;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Shop retornado
|
|
702
|
-
*/
|
|
703
|
-
interface AtosShopResponse {
|
|
704
|
-
id: string;
|
|
705
|
-
name: string;
|
|
706
|
-
owner_id: string;
|
|
707
|
-
created_at: string | null;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Item retornado
|
|
711
|
-
*/
|
|
712
|
-
interface AtosItemResponse {
|
|
713
|
-
id: string;
|
|
714
|
-
name: string;
|
|
715
|
-
quantity: number;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Customer retornado
|
|
719
|
-
*/
|
|
720
|
-
interface AtosCustomerResponse {
|
|
721
|
-
id: string;
|
|
722
|
-
name: string;
|
|
723
|
-
cpf: string | null;
|
|
724
|
-
email: string | null;
|
|
725
|
-
ip: string | null;
|
|
726
|
-
}
|
|
727
|
-
interface AtosCreatePixPaymentFullResponse {
|
|
728
|
-
id: string;
|
|
729
|
-
shop: AtosShopResponse;
|
|
730
|
-
status: "pending" | "paid" | "expired" | "refunded";
|
|
731
|
-
amount: number;
|
|
732
|
-
recipients: AtosRecipientResponse[];
|
|
733
|
-
items: AtosItemResponse[];
|
|
734
|
-
customer: AtosCustomerResponse;
|
|
735
|
-
/** Código PIX (copia e cola) */
|
|
736
|
-
data: string;
|
|
737
|
-
payer: unknown | null;
|
|
738
|
-
/** Data de expiração do PIX */
|
|
739
|
-
expire_at: string;
|
|
740
|
-
created_at: string;
|
|
741
|
-
infraction: unknown | null;
|
|
742
|
-
end2end_id: string | null;
|
|
743
|
-
receipt_file_url: string | null;
|
|
744
|
-
custom_message: string | null;
|
|
745
|
-
withdrawn: boolean;
|
|
746
|
-
withdraw_id: string | null;
|
|
747
|
-
kyc_validated: boolean;
|
|
748
|
-
/** Identificador interno do gateway */
|
|
749
|
-
identifier: string;
|
|
750
|
-
}
|
|
751
|
-
interface AtosRefundResponse {
|
|
752
|
-
success?: boolean;
|
|
753
|
-
status?: string;
|
|
754
|
-
}
|
|
755
|
-
interface AtosWithdrawInput {
|
|
756
|
-
/** Wallet / owner que está sacando */
|
|
757
|
-
withdraw_user_id: string;
|
|
758
|
-
pixKey: string;
|
|
759
|
-
pixKeyType: AtosPixKeyType;
|
|
760
|
-
baasPostbackUrl: string;
|
|
761
|
-
}
|
|
762
|
-
interface AtosWithdrawResponse {
|
|
763
|
-
id: string;
|
|
764
|
-
status: string;
|
|
765
|
-
}
|
|
766
|
-
interface AtosBalanceResponse {
|
|
767
|
-
balance: number;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
804
|
interface Bot {
|
|
771
805
|
id: string;
|
|
772
806
|
hostingId: string | null;
|
|
@@ -968,10 +1002,11 @@ declare class ShopEasySdk {
|
|
|
968
1002
|
getOrCreate(userId: string): Promise<Wallet>;
|
|
969
1003
|
getByUserId(userId: string): Promise<Wallet>;
|
|
970
1004
|
getByApiKey(apiKey: string): Promise<Wallet>;
|
|
1005
|
+
withdrawAtos(args: AtosWithdrawArgs): Promise<atosWithdrawResponse>;
|
|
971
1006
|
update(args: UpdateWalletArgs): Promise<Wallet>;
|
|
972
1007
|
getByCaching(userId: string): Promise<Wallet | null>;
|
|
973
1008
|
};
|
|
974
1009
|
}
|
|
975
1010
|
|
|
976
1011
|
export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
|
|
977
|
-
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
|
|
1012
|
+
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosGetPaymentResponse, AtosItemResponse, AtosPaymentStatus, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawArgs, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, atosWithdrawResponse, imageCreate, paymentProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,197 @@ import { Decimal as Decimal$1 } from 'decimal.js';
|
|
|
2
2
|
import { Guild as Guild$1, GuildMember } from 'discord.js';
|
|
3
3
|
import { createStaticPix, PixStaticObject } from 'pix-utils';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Tipos de chave PIX aceitos pela A-TOS
|
|
7
|
+
*/
|
|
8
|
+
type AtosPixKeyType = "phone" | "email" | "random" | "cpf" | "cnpj";
|
|
9
|
+
/**
|
|
10
|
+
* Recipient types:
|
|
11
|
+
* 0 → divide lucro (não altera valor)
|
|
12
|
+
* 1 → comissão percentual (antes dos sócios)
|
|
13
|
+
* 2 → soma no valor cobrado (taxas / upsell)
|
|
14
|
+
*/
|
|
15
|
+
type AtosRecipientType = 0 | 1 | 2;
|
|
16
|
+
/**
|
|
17
|
+
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
18
|
+
*/
|
|
19
|
+
interface AtosRecipientType2 {
|
|
20
|
+
id: string;
|
|
21
|
+
type: 2;
|
|
22
|
+
amount: number;
|
|
23
|
+
percentage?: never;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Type 1 → comissão percentual (antes dos sócios)
|
|
27
|
+
*/
|
|
28
|
+
interface AtosRecipientType1 {
|
|
29
|
+
id: string;
|
|
30
|
+
type: 1;
|
|
31
|
+
percentage: number;
|
|
32
|
+
amount?: never;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Type 0 → divisão de lucro entre sócios / owner
|
|
36
|
+
*/
|
|
37
|
+
interface AtosRecipientType0 {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 0;
|
|
40
|
+
percentage: number;
|
|
41
|
+
amount?: never;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Union final de recipients (INPUT)
|
|
45
|
+
*/
|
|
46
|
+
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
47
|
+
interface AtosCreatePixPaymentInput {
|
|
48
|
+
amount: number;
|
|
49
|
+
fee_to_customer?: boolean;
|
|
50
|
+
shop: {
|
|
51
|
+
/** ID lógico do servidor / loja */
|
|
52
|
+
id: string;
|
|
53
|
+
/** Nome do servidor / loja */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Wallet / owner que receberá o saldo */
|
|
56
|
+
owner_id: string;
|
|
57
|
+
};
|
|
58
|
+
items: {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
quantity: number;
|
|
62
|
+
}[];
|
|
63
|
+
customer: {
|
|
64
|
+
id: string;
|
|
65
|
+
name: string;
|
|
66
|
+
};
|
|
67
|
+
seller: {
|
|
68
|
+
/** CPF ou CNPJ do titular da API Key */
|
|
69
|
+
national_registration: string;
|
|
70
|
+
national_registration_name: string;
|
|
71
|
+
};
|
|
72
|
+
recipients?: AtosRecipient[];
|
|
73
|
+
overwrite_webhook_url?: string;
|
|
74
|
+
}
|
|
75
|
+
interface AtosCreatePixPaymentResponse {
|
|
76
|
+
id: string;
|
|
77
|
+
amount: number;
|
|
78
|
+
status: string;
|
|
79
|
+
qr_code?: string;
|
|
80
|
+
qr_code_image_url?: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recipient retornado pelo gateway
|
|
84
|
+
*/
|
|
85
|
+
interface AtosRecipientResponse {
|
|
86
|
+
id: string;
|
|
87
|
+
type: AtosRecipientType;
|
|
88
|
+
percentage: number | null;
|
|
89
|
+
amount: number;
|
|
90
|
+
available_at: string | null;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Shop retornado
|
|
94
|
+
*/
|
|
95
|
+
interface AtosShopResponse {
|
|
96
|
+
id: string;
|
|
97
|
+
name: string;
|
|
98
|
+
owner_id: string;
|
|
99
|
+
created_at: string | null;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Item retornado
|
|
103
|
+
*/
|
|
104
|
+
interface AtosItemResponse {
|
|
105
|
+
id: string;
|
|
106
|
+
name: string;
|
|
107
|
+
quantity: number;
|
|
108
|
+
}
|
|
109
|
+
type AtosPaymentStatus = "pending" | "paid" | "expired" | "refunded" | "canceled" | "failed";
|
|
110
|
+
interface AtosGetPaymentResponse {
|
|
111
|
+
id: string;
|
|
112
|
+
shop: AtosShopResponse;
|
|
113
|
+
status: AtosPaymentStatus;
|
|
114
|
+
amount: number;
|
|
115
|
+
recipients: AtosRecipientResponse[];
|
|
116
|
+
items: AtosItemResponse[];
|
|
117
|
+
customer: AtosCustomerResponse;
|
|
118
|
+
/** Código PIX copia e cola (só existe se for PIX) */
|
|
119
|
+
data: string | null;
|
|
120
|
+
payer: unknown | null;
|
|
121
|
+
expire_at: string | null;
|
|
122
|
+
created_at: string;
|
|
123
|
+
infraction: unknown | null;
|
|
124
|
+
end2end_id: string | null;
|
|
125
|
+
receipt_file_url: string | null;
|
|
126
|
+
custom_message: string | null;
|
|
127
|
+
withdrawn: boolean;
|
|
128
|
+
withdraw_id: string | null;
|
|
129
|
+
kyc_validated: boolean;
|
|
130
|
+
identifier: string | null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Customer retornado
|
|
134
|
+
*/
|
|
135
|
+
interface AtosCustomerResponse {
|
|
136
|
+
id: string;
|
|
137
|
+
name: string;
|
|
138
|
+
cpf: string | null;
|
|
139
|
+
email: string | null;
|
|
140
|
+
ip: string | null;
|
|
141
|
+
}
|
|
142
|
+
interface AtosCreatePixPaymentFullResponse {
|
|
143
|
+
id: string;
|
|
144
|
+
shop: AtosShopResponse;
|
|
145
|
+
status: "pending" | "paid" | "expired" | "refunded";
|
|
146
|
+
amount: number;
|
|
147
|
+
recipients: AtosRecipientResponse[];
|
|
148
|
+
items: AtosItemResponse[];
|
|
149
|
+
customer: AtosCustomerResponse;
|
|
150
|
+
/** Código PIX (copia e cola) */
|
|
151
|
+
data: string;
|
|
152
|
+
payer: unknown | null;
|
|
153
|
+
/** Data de expiração do PIX */
|
|
154
|
+
expire_at: string;
|
|
155
|
+
created_at: string;
|
|
156
|
+
infraction: unknown | null;
|
|
157
|
+
end2end_id: string | null;
|
|
158
|
+
receipt_file_url: string | null;
|
|
159
|
+
custom_message: string | null;
|
|
160
|
+
withdrawn: boolean;
|
|
161
|
+
withdraw_id: string | null;
|
|
162
|
+
kyc_validated: boolean;
|
|
163
|
+
/** Identificador interno do gateway */
|
|
164
|
+
identifier: string;
|
|
165
|
+
}
|
|
166
|
+
interface AtosRefundResponse {
|
|
167
|
+
success?: boolean;
|
|
168
|
+
status?: string;
|
|
169
|
+
}
|
|
170
|
+
interface AtosWithdrawArgs {
|
|
171
|
+
apiKey: string;
|
|
172
|
+
pixKey: string;
|
|
173
|
+
pixKeyType: "cpf" | "cnpj" | "email" | "phone" | "random";
|
|
174
|
+
walletKey: string;
|
|
175
|
+
}
|
|
176
|
+
interface atosWithdrawResponse {
|
|
177
|
+
sucess?: boolean;
|
|
178
|
+
}
|
|
179
|
+
interface AtosWithdrawInput {
|
|
180
|
+
/** Wallet / owner que está sacando */
|
|
181
|
+
withdraw_user_id: string;
|
|
182
|
+
pixKey: string;
|
|
183
|
+
pixKeyType: AtosPixKeyType;
|
|
184
|
+
baasPostbackUrl: string;
|
|
185
|
+
}
|
|
186
|
+
interface AtosWithdrawResponse {
|
|
187
|
+
id: string;
|
|
188
|
+
status: string;
|
|
189
|
+
}
|
|
190
|
+
interface AtosBalanceResponse {
|
|
191
|
+
pending: number;
|
|
192
|
+
available: number;
|
|
193
|
+
locked: number;
|
|
194
|
+
}
|
|
195
|
+
|
|
5
196
|
type GatewayProvider = "atos" | "fluxopay";
|
|
6
197
|
interface WalletBalance {
|
|
7
198
|
pending: number;
|
|
@@ -610,163 +801,6 @@ interface CartGetArgs {
|
|
|
610
801
|
guildId: string;
|
|
611
802
|
}
|
|
612
803
|
|
|
613
|
-
/**
|
|
614
|
-
* Tipos de chave PIX aceitos pela A-TOS
|
|
615
|
-
*/
|
|
616
|
-
type AtosPixKeyType = "TELEF" | "EMAIL" | "CNPJ" | "CPF" | "CHAVE";
|
|
617
|
-
/**
|
|
618
|
-
* Recipient types:
|
|
619
|
-
* 0 → divide lucro (não altera valor)
|
|
620
|
-
* 1 → comissão percentual (antes dos sócios)
|
|
621
|
-
* 2 → soma no valor cobrado (taxas / upsell)
|
|
622
|
-
*/
|
|
623
|
-
type AtosRecipientType = 0 | 1 | 2;
|
|
624
|
-
/**
|
|
625
|
-
* Type 2 → valor fixo que SOMA ao valor cobrado
|
|
626
|
-
*/
|
|
627
|
-
interface AtosRecipientType2 {
|
|
628
|
-
id: string;
|
|
629
|
-
type: 2;
|
|
630
|
-
amount: number;
|
|
631
|
-
percentage?: never;
|
|
632
|
-
}
|
|
633
|
-
/**
|
|
634
|
-
* Type 1 → comissão percentual (antes dos sócios)
|
|
635
|
-
*/
|
|
636
|
-
interface AtosRecipientType1 {
|
|
637
|
-
id: string;
|
|
638
|
-
type: 1;
|
|
639
|
-
percentage: number;
|
|
640
|
-
amount?: never;
|
|
641
|
-
}
|
|
642
|
-
/**
|
|
643
|
-
* Type 0 → divisão de lucro entre sócios / owner
|
|
644
|
-
*/
|
|
645
|
-
interface AtosRecipientType0 {
|
|
646
|
-
id: string;
|
|
647
|
-
type: 0;
|
|
648
|
-
percentage: number;
|
|
649
|
-
amount?: never;
|
|
650
|
-
}
|
|
651
|
-
/**
|
|
652
|
-
* Union final de recipients (INPUT)
|
|
653
|
-
*/
|
|
654
|
-
type AtosRecipient = AtosRecipientType0 | AtosRecipientType1 | AtosRecipientType2;
|
|
655
|
-
interface AtosCreatePixPaymentInput {
|
|
656
|
-
amount: number;
|
|
657
|
-
fee_to_customer?: boolean;
|
|
658
|
-
shop: {
|
|
659
|
-
/** ID lógico do servidor / loja */
|
|
660
|
-
id: string;
|
|
661
|
-
/** Nome do servidor / loja */
|
|
662
|
-
name: string;
|
|
663
|
-
/** Wallet / owner que receberá o saldo */
|
|
664
|
-
owner_id: string;
|
|
665
|
-
};
|
|
666
|
-
items: {
|
|
667
|
-
id: string;
|
|
668
|
-
name: string;
|
|
669
|
-
quantity: number;
|
|
670
|
-
}[];
|
|
671
|
-
customer: {
|
|
672
|
-
id: string;
|
|
673
|
-
name: string;
|
|
674
|
-
};
|
|
675
|
-
seller: {
|
|
676
|
-
/** CPF ou CNPJ do titular da API Key */
|
|
677
|
-
national_registration: string;
|
|
678
|
-
national_registration_name: string;
|
|
679
|
-
};
|
|
680
|
-
recipients?: AtosRecipient[];
|
|
681
|
-
overwrite_webhook_url?: string;
|
|
682
|
-
}
|
|
683
|
-
interface AtosCreatePixPaymentResponse {
|
|
684
|
-
id: string;
|
|
685
|
-
amount: number;
|
|
686
|
-
status: string;
|
|
687
|
-
qr_code?: string;
|
|
688
|
-
qr_code_image_url?: string;
|
|
689
|
-
}
|
|
690
|
-
/**
|
|
691
|
-
* Recipient retornado pelo gateway
|
|
692
|
-
*/
|
|
693
|
-
interface AtosRecipientResponse {
|
|
694
|
-
id: string;
|
|
695
|
-
type: AtosRecipientType;
|
|
696
|
-
percentage: number | null;
|
|
697
|
-
amount: number;
|
|
698
|
-
available_at: string | null;
|
|
699
|
-
}
|
|
700
|
-
/**
|
|
701
|
-
* Shop retornado
|
|
702
|
-
*/
|
|
703
|
-
interface AtosShopResponse {
|
|
704
|
-
id: string;
|
|
705
|
-
name: string;
|
|
706
|
-
owner_id: string;
|
|
707
|
-
created_at: string | null;
|
|
708
|
-
}
|
|
709
|
-
/**
|
|
710
|
-
* Item retornado
|
|
711
|
-
*/
|
|
712
|
-
interface AtosItemResponse {
|
|
713
|
-
id: string;
|
|
714
|
-
name: string;
|
|
715
|
-
quantity: number;
|
|
716
|
-
}
|
|
717
|
-
/**
|
|
718
|
-
* Customer retornado
|
|
719
|
-
*/
|
|
720
|
-
interface AtosCustomerResponse {
|
|
721
|
-
id: string;
|
|
722
|
-
name: string;
|
|
723
|
-
cpf: string | null;
|
|
724
|
-
email: string | null;
|
|
725
|
-
ip: string | null;
|
|
726
|
-
}
|
|
727
|
-
interface AtosCreatePixPaymentFullResponse {
|
|
728
|
-
id: string;
|
|
729
|
-
shop: AtosShopResponse;
|
|
730
|
-
status: "pending" | "paid" | "expired" | "refunded";
|
|
731
|
-
amount: number;
|
|
732
|
-
recipients: AtosRecipientResponse[];
|
|
733
|
-
items: AtosItemResponse[];
|
|
734
|
-
customer: AtosCustomerResponse;
|
|
735
|
-
/** Código PIX (copia e cola) */
|
|
736
|
-
data: string;
|
|
737
|
-
payer: unknown | null;
|
|
738
|
-
/** Data de expiração do PIX */
|
|
739
|
-
expire_at: string;
|
|
740
|
-
created_at: string;
|
|
741
|
-
infraction: unknown | null;
|
|
742
|
-
end2end_id: string | null;
|
|
743
|
-
receipt_file_url: string | null;
|
|
744
|
-
custom_message: string | null;
|
|
745
|
-
withdrawn: boolean;
|
|
746
|
-
withdraw_id: string | null;
|
|
747
|
-
kyc_validated: boolean;
|
|
748
|
-
/** Identificador interno do gateway */
|
|
749
|
-
identifier: string;
|
|
750
|
-
}
|
|
751
|
-
interface AtosRefundResponse {
|
|
752
|
-
success?: boolean;
|
|
753
|
-
status?: string;
|
|
754
|
-
}
|
|
755
|
-
interface AtosWithdrawInput {
|
|
756
|
-
/** Wallet / owner que está sacando */
|
|
757
|
-
withdraw_user_id: string;
|
|
758
|
-
pixKey: string;
|
|
759
|
-
pixKeyType: AtosPixKeyType;
|
|
760
|
-
baasPostbackUrl: string;
|
|
761
|
-
}
|
|
762
|
-
interface AtosWithdrawResponse {
|
|
763
|
-
id: string;
|
|
764
|
-
status: string;
|
|
765
|
-
}
|
|
766
|
-
interface AtosBalanceResponse {
|
|
767
|
-
balance: number;
|
|
768
|
-
}
|
|
769
|
-
|
|
770
804
|
interface Bot {
|
|
771
805
|
id: string;
|
|
772
806
|
hostingId: string | null;
|
|
@@ -968,10 +1002,11 @@ declare class ShopEasySdk {
|
|
|
968
1002
|
getOrCreate(userId: string): Promise<Wallet>;
|
|
969
1003
|
getByUserId(userId: string): Promise<Wallet>;
|
|
970
1004
|
getByApiKey(apiKey: string): Promise<Wallet>;
|
|
1005
|
+
withdrawAtos(args: AtosWithdrawArgs): Promise<atosWithdrawResponse>;
|
|
971
1006
|
update(args: UpdateWalletArgs): Promise<Wallet>;
|
|
972
1007
|
getByCaching(userId: string): Promise<Wallet | null>;
|
|
973
1008
|
};
|
|
974
1009
|
}
|
|
975
1010
|
|
|
976
1011
|
export { ShopEasySdk, cartAntiFakeVerify, cartCalculeTotal, cartVerifyAproved, cartVerifyPermission, cartWillExpire, formatDecimalToNumber, formatNumberToDecimal, formatPrice, formatRelativeTime, hasPermission, pixUtils };
|
|
977
|
-
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosItemResponse, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, imageCreate, paymentProvider };
|
|
1012
|
+
export type { ActionPermission, AtosBalanceResponse, AtosCreatePixPaymentFullResponse, AtosCreatePixPaymentInput, AtosCreatePixPaymentResponse, AtosCustomerResponse, AtosGetPaymentResponse, AtosItemResponse, AtosPaymentStatus, AtosPixKeyType, AtosRecipient, AtosRecipientResponse, AtosRecipientType, AtosRecipientType0, AtosRecipientType1, AtosRecipientType2, AtosRefundResponse, AtosShopResponse, AtosWithdrawArgs, AtosWithdrawInput, AtosWithdrawResponse, Bot, BotDeploy, BotStatus, Cart, CartDraft, CartDraftProduct, CartGetArgs, CartProduct, CartStatus, CartUpdateArgs, Catalog, CatalogCreateArgs, CatalogDraft, CatalogDraftGetArgs, CatalogDraftSetArgs, CatalogProduct, CatalogStatus, CatalogUpdateArgs, CheckExpirationsResponse, Config, ConfigDraft, ConfigDraftGetArgs, ConfigDraftSetArgs, ConfigUpdateArgs, Coupon, CouponCreateArgs, CouponDraft, CouponDraftGetArgs, CouponDraftSetArgs, CouponStatus, CouponUpdateArgs, CreateCartArgs, CreateCartProduct, CreatePaymentConfigArgs, CreateWalletArgs, Customer, CustomerCreateArgs, CustomerDraft, CustomerDraftGetArgs, CustomerDraftSetArgs, CustomerUpdateArgs, EfiPixCreateResponse, ExpiredPlansResponse, ExpiringPlan, GatewayProvider, GenerateProductArgs, Image, ImageUpdate, MarkAlertBody, MarkAlertResponse, Order, OrderCreate, OrderCustomer, OrderPayment, OrderProduct, PaymentConfig, PaymentProvider, Plan, PlanNeedingAlert, PlanStatus, PlanSubscriptionCreateArgs, PlanType, PlansNeedingAlertResponse, Product, ProductCreateArgs, ProductDraft, ProductGetByReference, ProductId, ProductMode, ProductStatus, ProductStockPushArgs, ProductUpdateArgs, ProduductDraftGetArgs, ProduductDraftSetArgs, RolePermissionsMap, Sale, SaleCreateArgs, SaleProduct, SaleProductCreateArgs, StockMode, Token, TokenUpdateArgs, UpdateCartData, UpdatePaymentConfigArgs, UpdateWalletArgs, Wallet, atosWithdrawResponse, imageCreate, paymentProvider };
|