@abacatepay/types 0.0.3 → 2.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/README.md +21 -13
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/v1/routes.d.ts +81 -0
- package/dist/v1/routes.js +86 -0
- package/dist/v1/utils.d.ts +19 -0
- package/dist/v1/utils.js +25 -0
- package/dist/v2/entities/checkout.d.ts +106 -0
- package/dist/v2/entities/checkout.js +29 -0
- package/dist/v2/entities/coupon.d.ts +63 -0
- package/dist/v2/entities/coupon.js +14 -0
- package/dist/v2/entities/customer.d.ts +41 -0
- package/dist/v2/entities/customer.js +1 -0
- package/dist/v2/entities/payout.d.ts +51 -0
- package/dist/v2/entities/payout.js +11 -0
- package/dist/v2/entities/pix.d.ts +48 -0
- package/dist/v2/entities/pix.js +1 -0
- package/dist/v2/entities/products.d.ts +49 -0
- package/dist/v2/entities/products.js +5 -0
- package/dist/v2/entities/store.d.ts +36 -0
- package/dist/v2/entities/store.js +1 -0
- package/dist/v2/entities/subscription.d.ts +110 -0
- package/dist/v2/entities/subscription.js +8 -0
- package/dist/v2/index.d.ts +11 -0
- package/dist/v2/index.js +11 -0
- package/dist/v2/rest.d.ts +675 -0
- package/dist/v2/rest.js +1 -0
- package/dist/v2/routes.d.ts +129 -0
- package/dist/v2/routes.js +158 -0
- package/dist/v2/utils.d.ts +26 -0
- package/dist/v2/utils.js +42 -0
- package/dist/v2/webhook.d.ts +135 -0
- package/dist/v2/webhook.js +9 -0
- package/dist/version.d.ts +2 -2
- package/dist/version.js +3 -4
- package/package.json +29 -5
- package/dist/routes.d.ts +0 -68
- package/dist/routes.js +0 -99
package/README.md
CHANGED
|
@@ -1,29 +1,37 @@
|
|
|
1
|
-
<
|
|
2
|
-
<p align="center">Tipagens oficiais e helpers modernos para integrar com a API da AbacatePay.</p>
|
|
1
|
+
<div align="center">
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
<a href="https://www.npmjs.com/package/@abacatepay/types"><img src="https://img.shields.io/npm/v/@abacatepay/types" /></a>
|
|
6
|
-
<a href="https://www.npmjs.com/package/@abacatepay/types"><img src="https://img.shields.io/npm/dm/@abacatepay/types" /></a>
|
|
7
|
-
<img src="https://img.shields.io/badge/built%20for-bun%20%26%20node-0b7" />
|
|
8
|
-
<img src="https://img.shields.io/badge/types-TypeScript-3178c6" />
|
|
9
|
-
<img src="https://img.shields.io/badge/license-MIT-lightgray" />
|
|
10
|
-
</p>
|
|
3
|
+
## AbacatePay API Types
|
|
11
4
|
|
|
12
|
-
|
|
5
|
+
Tipagens oficiais e helpers modernos para integrar com a API da AbacatePay.
|
|
6
|
+
|
|
7
|
+
<img src="https://res.cloudinary.com/dkok1obj5/image/upload/v1767631413/avo_clhmaf.png" width="100%" alt="AbacatePay Open Source"/>
|
|
8
|
+
|
|
9
|
+
## Instalação
|
|
10
|
+
|
|
11
|
+
Use com o seu *package manager* favorito
|
|
12
|
+
|
|
13
|
+
</div>
|
|
13
14
|
|
|
14
15
|
```bash
|
|
16
|
+
bun add @abacatepay/types
|
|
17
|
+
pnpm add @abacatepay/types
|
|
15
18
|
npm install @abacatepay/types
|
|
16
19
|
```
|
|
17
20
|
|
|
18
|
-
<
|
|
21
|
+
<div align="center">
|
|
22
|
+
|
|
23
|
+
## Como a AbacatePay API Types documenta
|
|
19
24
|
|
|
20
25
|
Antes de tudo, você deve específicar a versão da API que você deseja importar os tipos. Coloque `/v*` no final da importação, sendo `*` a versão que deseja usar:
|
|
21
26
|
|
|
27
|
+
</div>
|
|
28
|
+
|
|
22
29
|
```ts
|
|
23
30
|
import { APICustomer } from '@abacatepay/types/v1'
|
|
24
31
|
```
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
|
|
34
|
+
<p align="center">Para tipos globais como <code>API_BASE_URL</code>, <code>API_VERSION</code>, <code>version</code> e <code>Routes</code>, apenas import normalmente sem a versão.</p>
|
|
27
35
|
|
|
28
36
|
```ts
|
|
29
37
|
import { version } from '@abacatepay/types'
|
|
@@ -69,7 +77,7 @@ import {
|
|
|
69
77
|
} from '@abacatepay/types/v1';
|
|
70
78
|
|
|
71
79
|
async function createCoupon(body: RESTPostCreateCouponBody) {
|
|
72
|
-
const path = `${API_BASE_URL}/${API_VERSION}/${Routes.
|
|
80
|
+
const path = `${API_BASE_URL}/${API_VERSION}/${Routes.coupon.create}`;
|
|
73
81
|
|
|
74
82
|
const response = await fetch(path, {
|
|
75
83
|
method: 'POST',
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export { API_BASE_URL, Routes } from './routes';
|
|
2
1
|
export { API_VERSION, version } from './version';
|
|
2
|
+
/**
|
|
3
|
+
* Base URL for the AbacatePay API (Version not included).
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://docs.abacatepay.com/}
|
|
6
|
+
*/
|
|
7
|
+
export declare const API_BASE_URL = "https://api.abacatepay.com/";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
export { API_BASE_URL, Routes } from './routes';
|
|
2
1
|
export { API_VERSION, version } from './version';
|
|
2
|
+
/**
|
|
3
|
+
* Base URL for the AbacatePay API (Version not included).
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://docs.abacatepay.com/}
|
|
6
|
+
*/
|
|
7
|
+
export const API_BASE_URL = 'https://api.abacatepay.com/';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { RESTGetCheckQRCodePixStatusQueryParams, RESTGetSearchWithdrawQueryParams, RESTPostSimulatePaymentQueryParams } from './rest';
|
|
2
|
+
export declare const Routes: {
|
|
3
|
+
readonly customer: {
|
|
4
|
+
/**
|
|
5
|
+
* POST - https://api.abacatepay.com/v1/customer/create
|
|
6
|
+
*/
|
|
7
|
+
readonly create: "/customer/create";
|
|
8
|
+
/**
|
|
9
|
+
* GET - https://api.abacatepay.com/v1/customer/list
|
|
10
|
+
*/
|
|
11
|
+
readonly list: "/customer/list";
|
|
12
|
+
};
|
|
13
|
+
readonly billing: {
|
|
14
|
+
/**
|
|
15
|
+
* POST - https://api.abacatepay.com/v1/billing/create
|
|
16
|
+
*/
|
|
17
|
+
readonly create: "/billing/create";
|
|
18
|
+
/**
|
|
19
|
+
* GET - https://api.abacatepay.com/v1/billing/list
|
|
20
|
+
*/
|
|
21
|
+
readonly list: "/billing/list";
|
|
22
|
+
};
|
|
23
|
+
readonly pix: {
|
|
24
|
+
/**
|
|
25
|
+
* POST - https://api.abacatepay.com/v1/pixQrCode/create
|
|
26
|
+
*/
|
|
27
|
+
readonly createQRCode: "/pixQrCode/create";
|
|
28
|
+
/**
|
|
29
|
+
* POST - https://api.abacatepay.com/v1/pixQrCode/simulate-payment
|
|
30
|
+
*/
|
|
31
|
+
readonly simulatePayment: ({ id }: RESTPostSimulatePaymentQueryParams) => `/pixQrCode/simulate-payment?id=${string}`;
|
|
32
|
+
/**
|
|
33
|
+
* GET - https://api.abacatepay.com/v1/pixQrCode/check
|
|
34
|
+
*/
|
|
35
|
+
readonly checkStatus: ({ id }: RESTGetCheckQRCodePixStatusQueryParams) => `/pixQrCode/check?id=${string}`;
|
|
36
|
+
};
|
|
37
|
+
readonly coupon: {
|
|
38
|
+
/**
|
|
39
|
+
* POST - https://api.abacatepay.com/v1/coupon/create
|
|
40
|
+
*/
|
|
41
|
+
readonly create: "/coupon/create";
|
|
42
|
+
/**
|
|
43
|
+
* GET - https://api.abacatepay.com/v1/coupon/list
|
|
44
|
+
*/
|
|
45
|
+
readonly list: "/coupon/list";
|
|
46
|
+
};
|
|
47
|
+
readonly withdraw: {
|
|
48
|
+
/**
|
|
49
|
+
* POST - https://api.abacatepay.com/v1/withdraw/create
|
|
50
|
+
*/
|
|
51
|
+
readonly create: "/withdraw/create";
|
|
52
|
+
/**
|
|
53
|
+
* GET - https://api.abacatepay.com/v1/withdraw/get
|
|
54
|
+
*/
|
|
55
|
+
readonly get: ({ externalId }: RESTGetSearchWithdrawQueryParams) => `/withdraw/get?externalId=${string}`;
|
|
56
|
+
/**
|
|
57
|
+
* GET - https://api.abacatepay.com/v1/withdraw/list
|
|
58
|
+
*/
|
|
59
|
+
readonly list: "/withdraw/list";
|
|
60
|
+
};
|
|
61
|
+
readonly store: {
|
|
62
|
+
/**
|
|
63
|
+
* GET - https://api.abacatepay.com/v1/store/get
|
|
64
|
+
*/
|
|
65
|
+
readonly get: "/store/get";
|
|
66
|
+
};
|
|
67
|
+
readonly mrr: {
|
|
68
|
+
/**
|
|
69
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/mrr
|
|
70
|
+
*/
|
|
71
|
+
readonly get: "/public-mrr/mrr";
|
|
72
|
+
/**
|
|
73
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/merchant-info
|
|
74
|
+
*/
|
|
75
|
+
readonly merchant: "/public-mrr/merchant-info";
|
|
76
|
+
/**
|
|
77
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/renevue
|
|
78
|
+
*/
|
|
79
|
+
readonly revenue: "/public-mrr/revenue";
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export const Routes = {
|
|
2
|
+
customer: {
|
|
3
|
+
/**
|
|
4
|
+
* POST - https://api.abacatepay.com/v1/customer/create
|
|
5
|
+
*/
|
|
6
|
+
create: '/customer/create',
|
|
7
|
+
/**
|
|
8
|
+
* GET - https://api.abacatepay.com/v1/customer/list
|
|
9
|
+
*/
|
|
10
|
+
list: '/customer/list',
|
|
11
|
+
},
|
|
12
|
+
billing: {
|
|
13
|
+
/**
|
|
14
|
+
* POST - https://api.abacatepay.com/v1/billing/create
|
|
15
|
+
*/
|
|
16
|
+
create: '/billing/create',
|
|
17
|
+
/**
|
|
18
|
+
* GET - https://api.abacatepay.com/v1/billing/list
|
|
19
|
+
*/
|
|
20
|
+
list: '/billing/list',
|
|
21
|
+
},
|
|
22
|
+
pix: {
|
|
23
|
+
/**
|
|
24
|
+
* POST - https://api.abacatepay.com/v1/pixQrCode/create
|
|
25
|
+
*/
|
|
26
|
+
createQRCode: '/pixQrCode/create',
|
|
27
|
+
/**
|
|
28
|
+
* POST - https://api.abacatepay.com/v1/pixQrCode/simulate-payment
|
|
29
|
+
*/
|
|
30
|
+
simulatePayment({ id }) {
|
|
31
|
+
return `/pixQrCode/simulate-payment?id=${id}`;
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* GET - https://api.abacatepay.com/v1/pixQrCode/check
|
|
35
|
+
*/
|
|
36
|
+
checkStatus({ id }) {
|
|
37
|
+
return `/pixQrCode/check?id=${id}`;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
coupon: {
|
|
41
|
+
/**
|
|
42
|
+
* POST - https://api.abacatepay.com/v1/coupon/create
|
|
43
|
+
*/
|
|
44
|
+
create: '/coupon/create',
|
|
45
|
+
/**
|
|
46
|
+
* GET - https://api.abacatepay.com/v1/coupon/list
|
|
47
|
+
*/
|
|
48
|
+
list: '/coupon/list',
|
|
49
|
+
},
|
|
50
|
+
withdraw: {
|
|
51
|
+
/**
|
|
52
|
+
* POST - https://api.abacatepay.com/v1/withdraw/create
|
|
53
|
+
*/
|
|
54
|
+
create: '/withdraw/create',
|
|
55
|
+
/**
|
|
56
|
+
* GET - https://api.abacatepay.com/v1/withdraw/get
|
|
57
|
+
*/
|
|
58
|
+
get({ externalId }) {
|
|
59
|
+
return `/withdraw/get?externalId=${externalId}`;
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
* GET - https://api.abacatepay.com/v1/withdraw/list
|
|
63
|
+
*/
|
|
64
|
+
list: '/withdraw/list',
|
|
65
|
+
},
|
|
66
|
+
store: {
|
|
67
|
+
/**
|
|
68
|
+
* GET - https://api.abacatepay.com/v1/store/get
|
|
69
|
+
*/
|
|
70
|
+
get: '/store/get',
|
|
71
|
+
},
|
|
72
|
+
mrr: {
|
|
73
|
+
/**
|
|
74
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/mrr
|
|
75
|
+
*/
|
|
76
|
+
get: '/public-mrr/mrr',
|
|
77
|
+
/**
|
|
78
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/merchant-info
|
|
79
|
+
*/
|
|
80
|
+
merchant: '/public-mrr/merchant-info',
|
|
81
|
+
/**
|
|
82
|
+
* GET - https://api.abacatepay.com/v1/public-mrr/renevue
|
|
83
|
+
*/
|
|
84
|
+
revenue: '/public-mrr/revenue',
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type WebhookEvent } from './webhook';
|
|
2
|
+
/**
|
|
3
|
+
* A type guard check for `withdraw.done` webhook events
|
|
4
|
+
* @param event - The webhook event to check against
|
|
5
|
+
* @returns A boolean that indicates if the webhook is a withdraw done webhook
|
|
6
|
+
*/
|
|
7
|
+
export declare function isWithdrawDoneWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookWithdrawDoneEvent;
|
|
8
|
+
/**
|
|
9
|
+
* A type guard check for `withdraw.failed` webhook events
|
|
10
|
+
* @param event - The webhook event to check against
|
|
11
|
+
* @returns A boolean that indicates if the webhook is a withdraw failed webhook
|
|
12
|
+
*/
|
|
13
|
+
export declare function isWithdrawFailedWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookWithdrawFailedEvent;
|
|
14
|
+
/**
|
|
15
|
+
* A type guard check for `billing.paid` webhook events
|
|
16
|
+
* @param event - The webhook event to check against
|
|
17
|
+
* @returns A boolean that indicates if the webhook is a billing paid webhook
|
|
18
|
+
*/
|
|
19
|
+
export declare function isBillingPaidWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookBillingPaidEvent;
|
package/dist/v1/utils.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { WebhookEventType } from './webhook';
|
|
2
|
+
/**
|
|
3
|
+
* A type guard check for `withdraw.done` webhook events
|
|
4
|
+
* @param event - The webhook event to check against
|
|
5
|
+
* @returns A boolean that indicates if the webhook is a withdraw done webhook
|
|
6
|
+
*/
|
|
7
|
+
export function isWithdrawDoneWebhookEvent(event) {
|
|
8
|
+
return event.event === WebhookEventType.WithdrawDone;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A type guard check for `withdraw.failed` webhook events
|
|
12
|
+
* @param event - The webhook event to check against
|
|
13
|
+
* @returns A boolean that indicates if the webhook is a withdraw failed webhook
|
|
14
|
+
*/
|
|
15
|
+
export function isWithdrawFailedWebhookEvent(event) {
|
|
16
|
+
return event.event === WebhookEventType.WithdrawFailed;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A type guard check for `billing.paid` webhook events
|
|
20
|
+
* @param event - The webhook event to check against
|
|
21
|
+
* @returns A boolean that indicates if the webhook is a billing paid webhook
|
|
22
|
+
*/
|
|
23
|
+
export function isBillingPaidWebhookEvent(event) {
|
|
24
|
+
return event.event === WebhookEventType.BillingPaid;
|
|
25
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/checkouts/reference#estrutura
|
|
3
|
+
*/
|
|
4
|
+
export interface APICheckout {
|
|
5
|
+
/**
|
|
6
|
+
* Unique billing identifier.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Total amount to be paid in cents.
|
|
11
|
+
*/
|
|
12
|
+
amount: number;
|
|
13
|
+
/**
|
|
14
|
+
* Amount already paid in cents.`null` if it has not yet been paid.
|
|
15
|
+
*/
|
|
16
|
+
paidAmount: number | null;
|
|
17
|
+
/**
|
|
18
|
+
* Bill ID in your system.
|
|
19
|
+
*/
|
|
20
|
+
externalId: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* URL where the user can complete the payment.
|
|
23
|
+
*/
|
|
24
|
+
url: string;
|
|
25
|
+
/**
|
|
26
|
+
* List of items in billing.
|
|
27
|
+
*/
|
|
28
|
+
items: {
|
|
29
|
+
/**
|
|
30
|
+
* Product ID.
|
|
31
|
+
*/
|
|
32
|
+
id: string;
|
|
33
|
+
/**
|
|
34
|
+
* Item quantity.
|
|
35
|
+
*/
|
|
36
|
+
quantity: number;
|
|
37
|
+
}[];
|
|
38
|
+
/**
|
|
39
|
+
* Billing status. Can be `PENDING`, `EXPIRED`, `CANCELLED`, `PAID`, `REFUNDED`.
|
|
40
|
+
*
|
|
41
|
+
* @see {@link PaymentStatus}
|
|
42
|
+
*/
|
|
43
|
+
status: PaymentStatus;
|
|
44
|
+
/**
|
|
45
|
+
* Indicates whether the charge was created in a development (true) or production (false) environment.
|
|
46
|
+
*/
|
|
47
|
+
devMode: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Additial metadata for the charge.
|
|
50
|
+
*/
|
|
51
|
+
metadata?: Record<string, object>;
|
|
52
|
+
/**
|
|
53
|
+
* URL that the customer will be redirected to when clicking the “back” button.
|
|
54
|
+
*/
|
|
55
|
+
returnUrl: string;
|
|
56
|
+
/**
|
|
57
|
+
* URL that the customer will be redirected to when making payment.
|
|
58
|
+
*/
|
|
59
|
+
completionUrl: string;
|
|
60
|
+
/**
|
|
61
|
+
* Payment receipt URL.
|
|
62
|
+
*/
|
|
63
|
+
receiptUrl: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* Coupons allowed in billing.
|
|
66
|
+
*/
|
|
67
|
+
coupons: string[];
|
|
68
|
+
/**
|
|
69
|
+
* Customer ID associated with the charge.
|
|
70
|
+
*/
|
|
71
|
+
customerId: string | null;
|
|
72
|
+
/**
|
|
73
|
+
* Charge creation date and time.
|
|
74
|
+
*/
|
|
75
|
+
createdAt: string;
|
|
76
|
+
/**
|
|
77
|
+
* Charge last updated date and time.
|
|
78
|
+
*/
|
|
79
|
+
updatedAt: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* https://docs.abacatepay.com/pages/payment/reference#atributos
|
|
83
|
+
*/
|
|
84
|
+
export declare enum PaymentStatus {
|
|
85
|
+
Pending = "PENDING",
|
|
86
|
+
Expired = "EXPIRED",
|
|
87
|
+
Cancelled = "CANCELLED",
|
|
88
|
+
Paid = "PAID",
|
|
89
|
+
Refunded = "REFUNDED"
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* https://docs.abacatepay.com/pages/payment/create#body-methods
|
|
93
|
+
*/
|
|
94
|
+
export declare enum PaymentMethod {
|
|
95
|
+
Pix = "PIX",
|
|
96
|
+
Card = "CARD"
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* https://docs.abacatepay.com/pages/payment/create#body-frequency
|
|
100
|
+
*
|
|
101
|
+
* @deprecated
|
|
102
|
+
*/
|
|
103
|
+
export declare enum PaymentFrequency {
|
|
104
|
+
OneTime = "ONE_TIME",
|
|
105
|
+
Multiple = "MULTIPLE_PAYMENTS"
|
|
106
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/payment/reference#atributos
|
|
3
|
+
*/
|
|
4
|
+
export var PaymentStatus;
|
|
5
|
+
(function (PaymentStatus) {
|
|
6
|
+
PaymentStatus["Pending"] = "PENDING";
|
|
7
|
+
PaymentStatus["Expired"] = "EXPIRED";
|
|
8
|
+
PaymentStatus["Cancelled"] = "CANCELLED";
|
|
9
|
+
PaymentStatus["Paid"] = "PAID";
|
|
10
|
+
PaymentStatus["Refunded"] = "REFUNDED";
|
|
11
|
+
})(PaymentStatus || (PaymentStatus = {}));
|
|
12
|
+
/**
|
|
13
|
+
* https://docs.abacatepay.com/pages/payment/create#body-methods
|
|
14
|
+
*/
|
|
15
|
+
export var PaymentMethod;
|
|
16
|
+
(function (PaymentMethod) {
|
|
17
|
+
PaymentMethod["Pix"] = "PIX";
|
|
18
|
+
PaymentMethod["Card"] = "CARD";
|
|
19
|
+
})(PaymentMethod || (PaymentMethod = {}));
|
|
20
|
+
/**
|
|
21
|
+
* https://docs.abacatepay.com/pages/payment/create#body-frequency
|
|
22
|
+
*
|
|
23
|
+
* @deprecated
|
|
24
|
+
*/
|
|
25
|
+
export var PaymentFrequency;
|
|
26
|
+
(function (PaymentFrequency) {
|
|
27
|
+
PaymentFrequency["OneTime"] = "ONE_TIME";
|
|
28
|
+
PaymentFrequency["Multiple"] = "MULTIPLE_PAYMENTS";
|
|
29
|
+
})(PaymentFrequency || (PaymentFrequency = {}));
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/coupon/reference#estrutura
|
|
3
|
+
*/
|
|
4
|
+
export interface APICoupon {
|
|
5
|
+
/**
|
|
6
|
+
* Unique coupon code that your customers will use to apply the discount.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Type of discount applied by the coupon.
|
|
11
|
+
*/
|
|
12
|
+
discountKind: CouponDiscountKind;
|
|
13
|
+
/**
|
|
14
|
+
* Discount amount. For `PERCENTAGE` use numbers from 1-100 (ex: 10 = 10%). For `FIXED` use the value in cents (ex: 500 = R$5.00).
|
|
15
|
+
*/
|
|
16
|
+
discount: number;
|
|
17
|
+
/**
|
|
18
|
+
* Coupon status.
|
|
19
|
+
*/
|
|
20
|
+
status: CouponStatus;
|
|
21
|
+
/**
|
|
22
|
+
* Limit on the number of times the coupon can be used. Use `-1` for unlimited coupons or a specific number to limit usage.
|
|
23
|
+
*
|
|
24
|
+
* @default 10
|
|
25
|
+
*/
|
|
26
|
+
maxRedeems: number;
|
|
27
|
+
/**
|
|
28
|
+
* Counter of how many times the coupon has been used by customers.
|
|
29
|
+
*/
|
|
30
|
+
redeemsCount: 0;
|
|
31
|
+
/**
|
|
32
|
+
* Indicates whether the coupon was created in a development (true) or production (false) environment.
|
|
33
|
+
*/
|
|
34
|
+
devMode: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Internal description of the coupon for your organization and control.
|
|
37
|
+
*/
|
|
38
|
+
notes?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Coupon creation date and time.
|
|
41
|
+
*/
|
|
42
|
+
createdAt: string;
|
|
43
|
+
/**
|
|
44
|
+
* Coupon last updated date and time.
|
|
45
|
+
*/
|
|
46
|
+
updatedAt: string;
|
|
47
|
+
/**
|
|
48
|
+
* Object to store additional information about the coupon, such as campaign, category, or other data relevant to your organization.
|
|
49
|
+
*/
|
|
50
|
+
metadata?: Record<string, object>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* https://docs.abacatepay.com/pages/coupon/reference#atributos
|
|
54
|
+
*/
|
|
55
|
+
export declare enum CouponDiscountKind {
|
|
56
|
+
Percentage = "PERCENTAGE",
|
|
57
|
+
Fixed = "FIXED"
|
|
58
|
+
}
|
|
59
|
+
export declare enum CouponStatus {
|
|
60
|
+
Active = "ACTIVE",
|
|
61
|
+
Inactive = "INACTIVE",
|
|
62
|
+
Expired = "EXPIRED"
|
|
63
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/coupon/reference#atributos
|
|
3
|
+
*/
|
|
4
|
+
export var CouponDiscountKind;
|
|
5
|
+
(function (CouponDiscountKind) {
|
|
6
|
+
CouponDiscountKind["Percentage"] = "PERCENTAGE";
|
|
7
|
+
CouponDiscountKind["Fixed"] = "FIXED";
|
|
8
|
+
})(CouponDiscountKind || (CouponDiscountKind = {}));
|
|
9
|
+
export var CouponStatus;
|
|
10
|
+
(function (CouponStatus) {
|
|
11
|
+
CouponStatus["Active"] = "ACTIVE";
|
|
12
|
+
CouponStatus["Inactive"] = "INACTIVE";
|
|
13
|
+
CouponStatus["Expired"] = "EXPIRED";
|
|
14
|
+
})(CouponStatus || (CouponStatus = {}));
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/client/reference#estrutura
|
|
3
|
+
*/
|
|
4
|
+
export interface APICustomer {
|
|
5
|
+
/**
|
|
6
|
+
* Unique customer identifier.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether the client was created in a testing environment.
|
|
11
|
+
*/
|
|
12
|
+
devMode: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Customer country.
|
|
15
|
+
*/
|
|
16
|
+
country: string;
|
|
17
|
+
/**
|
|
18
|
+
* Customer's full name.
|
|
19
|
+
*/
|
|
20
|
+
name: string;
|
|
21
|
+
/**
|
|
22
|
+
* Customer's email.
|
|
23
|
+
*/
|
|
24
|
+
email: string;
|
|
25
|
+
/**
|
|
26
|
+
* Customer's CPF or CNPJ.
|
|
27
|
+
*/
|
|
28
|
+
taxId: string;
|
|
29
|
+
/**
|
|
30
|
+
* Customer's cell phone.
|
|
31
|
+
*/
|
|
32
|
+
cellphone: string;
|
|
33
|
+
/**
|
|
34
|
+
* Customer zip code.
|
|
35
|
+
*/
|
|
36
|
+
zipCode: string;
|
|
37
|
+
/**
|
|
38
|
+
* Additional customer metadata.
|
|
39
|
+
*/
|
|
40
|
+
metadata?: Record<string, object>;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/payouts/reference
|
|
3
|
+
*/
|
|
4
|
+
export interface APIPayout {
|
|
5
|
+
/**
|
|
6
|
+
* Unique transaction identifier.
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Current transaction status.
|
|
11
|
+
*/
|
|
12
|
+
status: PayoutStatus;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates whether the transaction was created in a testing environment.
|
|
15
|
+
*/
|
|
16
|
+
devMode: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Transaction proof URL.
|
|
19
|
+
*/
|
|
20
|
+
receiptUrl: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* Payout value in cents.
|
|
23
|
+
*/
|
|
24
|
+
amount: number;
|
|
25
|
+
/**
|
|
26
|
+
* Platform fee in cents.
|
|
27
|
+
*/
|
|
28
|
+
platformFee: number;
|
|
29
|
+
/**
|
|
30
|
+
* External transaction identifier.
|
|
31
|
+
*/
|
|
32
|
+
externalId: string;
|
|
33
|
+
/**
|
|
34
|
+
* Transaction creation date.
|
|
35
|
+
*/
|
|
36
|
+
createdAt: string;
|
|
37
|
+
/**
|
|
38
|
+
* Transaction update date.
|
|
39
|
+
*/
|
|
40
|
+
updatedAt: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* https://docs.abacatepay.com/pages/payouts/reference#atributos
|
|
44
|
+
*/
|
|
45
|
+
export declare enum PayoutStatus {
|
|
46
|
+
Pending = "PENDING",
|
|
47
|
+
Expired = "EXPIRED",
|
|
48
|
+
Cancelled = "CANCELLED",
|
|
49
|
+
Complete = "COMPLETE",
|
|
50
|
+
Refunded = "REFUNDED"
|
|
51
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* https://docs.abacatepay.com/pages/payouts/reference#atributos
|
|
3
|
+
*/
|
|
4
|
+
export var PayoutStatus;
|
|
5
|
+
(function (PayoutStatus) {
|
|
6
|
+
PayoutStatus["Pending"] = "PENDING";
|
|
7
|
+
PayoutStatus["Expired"] = "EXPIRED";
|
|
8
|
+
PayoutStatus["Cancelled"] = "CANCELLED";
|
|
9
|
+
PayoutStatus["Complete"] = "COMPLETE";
|
|
10
|
+
PayoutStatus["Refunded"] = "REFUNDED";
|
|
11
|
+
})(PayoutStatus || (PayoutStatus = {}));
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { PaymentStatus } from './checkout';
|
|
2
|
+
/**
|
|
3
|
+
* https://docs.abacatepay.com/pages/transparents/reference
|
|
4
|
+
*/
|
|
5
|
+
export interface APIQRCodePIX {
|
|
6
|
+
/**
|
|
7
|
+
* Unique QRCode PIX identifier.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* Charge amount in cents (e.g. 4000 = R$40.00).
|
|
12
|
+
*/
|
|
13
|
+
amount: number;
|
|
14
|
+
/**
|
|
15
|
+
* PIX status. Can be `PENDING`, `EXPIRED`, `CANCELLED`, `PAID`, `REFUNDED`.
|
|
16
|
+
*
|
|
17
|
+
* @see {@link PaymentStatus}
|
|
18
|
+
*/
|
|
19
|
+
status: PaymentStatus;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the charge is in a testing (true) or production (false) environment.
|
|
22
|
+
*/
|
|
23
|
+
devMode: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* PIX code (copy-and-paste) for payment.
|
|
26
|
+
*/
|
|
27
|
+
brCode: string;
|
|
28
|
+
/**
|
|
29
|
+
* PIX code in Base64 format (Useful for displaying in images).
|
|
30
|
+
*/
|
|
31
|
+
brCodeBase64: string;
|
|
32
|
+
/**
|
|
33
|
+
* Platform fee in cents. Example: 80 means R$0.80.
|
|
34
|
+
*/
|
|
35
|
+
platformFee: number;
|
|
36
|
+
/**
|
|
37
|
+
* QRCode PIX creation date and time.
|
|
38
|
+
*/
|
|
39
|
+
createdAt: string;
|
|
40
|
+
/**
|
|
41
|
+
* QRCode PIX last updated date and time.
|
|
42
|
+
*/
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
/**
|
|
45
|
+
* QRCode expiration date and time.
|
|
46
|
+
*/
|
|
47
|
+
expiresAt: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|