@abacatepay/types 2.0.0 β†’ 2.0.1

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 CHANGED
@@ -118,3 +118,6 @@ Bun.serve({
118
118
  },
119
119
  });
120
120
  ```
121
+
122
+ <p align="center">Feito com πŸ₯‘ pela equipe AbacatePay</br>
123
+ Open source, de verdade.</p>
@@ -15,7 +15,7 @@ export interface APIStore {
15
15
  /**
16
16
  * Object containing information about your account balances.
17
17
  *
18
- * @remarks All balance values ​​are returned in cents. To convert to Reais, divide by 100. For example: 15000 cents = R$150.00
18
+ * @remarks All balance values ​​are returned in cents. To convert to Reais, divide by 100. For example: 15000 cents = R$150.00.
19
19
  */
20
20
  balance: {
21
21
  /**
@@ -7,5 +7,6 @@ export * from './entities/products';
7
7
  export * from './entities/store';
8
8
  export * from './entities/subscription';
9
9
  export * from './rest';
10
+ export { Routes } from './routes';
10
11
  export * from './utils';
11
12
  export * from './webhook';
package/dist/v2/index.js CHANGED
@@ -7,5 +7,6 @@ export * from './entities/products';
7
7
  export * from './entities/store';
8
8
  export * from './entities/subscription';
9
9
  export * from './rest';
10
+ export { Routes } from './routes';
10
11
  export * from './utils';
11
12
  export * from './webhook';
package/dist/v2/rest.d.ts CHANGED
@@ -2,73 +2,73 @@ import type { APICheckout, APICoupon, APICustomer, APIPayout, APIQRCodePIX, APIS
2
2
  import type { APIProduct } from './entities/products';
3
3
  import type { APISubscription } from './entities/subscription';
4
4
  /**
5
- * Any response returned by the AbacatePay API
5
+ * Any response returned by the AbacatePay API.
6
6
  */
7
7
  export type APIResponse<Data> = {
8
8
  /**
9
- * The data of the response
9
+ * The data of the response.
10
10
  */
11
11
  data: Data;
12
12
  error: null;
13
13
  } | {
14
14
  data: null;
15
15
  /**
16
- * Error message returned from the API
16
+ * Error message returned from the API.
17
17
  */
18
18
  error: string;
19
19
  };
20
20
  /**
21
- * Any response returned by the AbacatePay API that has a `pagination` field (Not cursor based)
21
+ * Any response returned by the AbacatePay API that has a `pagination` field (Not cursor based).
22
22
  */
23
23
  export type APIResponseWithPagination<Data> = {
24
24
  /**
25
- * The data of the response
25
+ * The data of the response.
26
26
  */
27
27
  data: Data;
28
28
  error: null;
29
29
  /**
30
- * Pagination info
30
+ * Pagination info.
31
31
  */
32
32
  pagination: {
33
33
  /**
34
- * Current page
34
+ * Current page.
35
35
  */
36
36
  page: number;
37
37
  /**
38
- * Number of items per page
38
+ * Number of items per page.
39
39
  */
40
40
  limit: number;
41
41
  /**
42
- * Number of items
42
+ * Number of items.
43
43
  */
44
44
  items: number;
45
45
  /**
46
- * Number of pages
46
+ * Number of pages.
47
47
  */
48
48
  totalPages: number;
49
49
  };
50
50
  } | {
51
51
  data: null;
52
52
  /**
53
- * Error message returned from the API
53
+ * Error message returned from the API.
54
54
  */
55
55
  error: string;
56
56
  };
57
57
  /**
58
- * Any response returned by the AbacatePay API that has a `pagination` field and is cursor-based
58
+ * Any response returned by the AbacatePay API that has a `pagination` field and is cursor-based.
59
59
  */
60
60
  export type APIResponseWithCursorBasedPagination<Data> = {
61
61
  /**
62
- * The data of the response
62
+ * The data of the response.
63
63
  */
64
64
  data: Data;
65
65
  error: null;
66
66
  /**
67
- * Pagination info
67
+ * Pagination info.
68
68
  */
69
69
  pagination: {
70
70
  /**
71
- * Number of items per page
71
+ * Number of items per page.
72
72
  */
73
73
  limit: number;
74
74
  /**
@@ -80,14 +80,14 @@ export type APIResponseWithCursorBasedPagination<Data> = {
80
80
  */
81
81
  hasPrevious: boolean;
82
82
  /**
83
- * Cursor for the next page
83
+ * Cursor for the next page.
84
84
  */
85
85
  nextCursor: string | null;
86
86
  };
87
87
  } | {
88
88
  data: null;
89
89
  /**
90
- * Error message returned from the API
90
+ * Error message returned from the API.
91
91
  */
92
92
  error: string;
93
93
  };
@@ -336,7 +336,7 @@ export interface RESTPostCreateCouponBody {
336
336
  */
337
337
  discountKind: CouponDiscountKind;
338
338
  /**
339
- * Coupon description
339
+ * Coupon description.
340
340
  */
341
341
  notes?: string;
342
342
  /**
@@ -392,6 +392,12 @@ export interface RESTGetSearchPayoutQueryParams {
392
392
  */
393
393
  externalId: string;
394
394
  }
395
+ /**
396
+ * https://api.abacatepay.com/v2/payouts/get
397
+ *
398
+ * @reference https://docs.abacatepay.com/pages/payouts/get
399
+ */
400
+ export type RESTGetSearchPayoutData = APIPayout;
395
401
  /**
396
402
  * https://api.abacatepay.com/v2/payouts/list
397
403
  *
@@ -399,13 +405,13 @@ export interface RESTGetSearchPayoutQueryParams {
399
405
  */
400
406
  export interface RESTGetListPayoutsQueryParams {
401
407
  /**
402
- * Number of the page
408
+ * Number of the page.
403
409
  *
404
410
  * @default 1
405
411
  */
406
412
  page?: number;
407
413
  /**
408
- * Number of items per page
414
+ * Number of items per page.
409
415
  *
410
416
  * @default 20
411
417
  */
@@ -581,7 +587,7 @@ export type RESTPatchToggleCouponStatusData = APICoupon;
581
587
  */
582
588
  export interface RESTPostCreateProductBody extends Pick<APIProduct, 'externalId' | 'name' | 'price' | 'currency'> {
583
589
  /**
584
- * Description for the product
590
+ * Description for the product.
585
591
  */
586
592
  description?: string;
587
593
  }
@@ -1,4 +1,4 @@
1
- import type { RESTGetListPayoutsQueryParams, RESTGetListSubscriptionsQueryParams, RESTGetProductQueryParams } from './rest';
1
+ import type { RESTGetListCouponsQueryParams, RESTGetListCustomersQueryParams, RESTGetListPayoutsQueryParams, RESTGetListProductsQueryParams, RESTGetListSubscriptionsQueryParams, RESTGetProductQueryParams } from './rest';
2
2
  export declare const Routes: {
3
3
  readonly customers: {
4
4
  /**
@@ -8,7 +8,7 @@ export declare const Routes: {
8
8
  /**
9
9
  * GET - https://api.abacatepay.com/v2/customers/list
10
10
  */
11
- readonly list: "/customers/list";
11
+ readonly list: ({ page, limit }?: RESTGetListCustomersQueryParams) => `/customers/list?page=${number}&limit=${number}`;
12
12
  /**
13
13
  * GET - https://api.abacatepay.com/v2/customers/get
14
14
  */
@@ -54,7 +54,7 @@ export declare const Routes: {
54
54
  /**
55
55
  * GET - https://api.abacatepay.com/v2/coupons/list
56
56
  */
57
- readonly list: "/coupons/list";
57
+ readonly list: ({ page, limit }?: RESTGetListCouponsQueryParams) => `/coupons/list?page=${number}&limit=${number}`;
58
58
  /**
59
59
  * GET - https://api.abacatepay.com/v2/coupons/get
60
60
  */
@@ -120,7 +120,7 @@ export declare const Routes: {
120
120
  /**
121
121
  * GET - https://api.abacatepay.com/v2/products/list
122
122
  */
123
- readonly list: ({ page, limit }?: Record<"page" | "limit", number>) => `/products/list?page=${number}&limit=${number}`;
123
+ readonly list: ({ page, limit }?: RESTGetListProductsQueryParams) => `/products/list?page=${number}&limit=${number}`;
124
124
  /**
125
125
  * GET - https://api.abacatepay.com/v2/products/get
126
126
  */
package/dist/v2/routes.js CHANGED
@@ -7,7 +7,9 @@ export const Routes = {
7
7
  /**
8
8
  * GET - https://api.abacatepay.com/v2/customers/list
9
9
  */
10
- list: '/customers/list',
10
+ list({ page = 1, limit = 20 } = {}) {
11
+ return `/customers/list?page=${page}&limit=${limit}`;
12
+ },
11
13
  /**
12
14
  * GET - https://api.abacatepay.com/v2/customers/get
13
15
  */
@@ -61,7 +63,9 @@ export const Routes = {
61
63
  /**
62
64
  * GET - https://api.abacatepay.com/v2/coupons/list
63
65
  */
64
- list: '/coupons/list',
66
+ list({ page = 1, limit = 20 } = {}) {
67
+ return `/coupons/list?page=${page}&limit=${limit}`;
68
+ },
65
69
  /**
66
70
  * GET - https://api.abacatepay.com/v2/coupons/get
67
71
  */
@@ -1,26 +1,26 @@
1
1
  import { type WebhookEvent } from './webhook';
2
2
  /**
3
- * A type guard check for `payout.done` webhook events
4
- * @param event - The webhook event to check against
5
- * @returns A boolean that indicates if the webhook is a payout done webhook
3
+ * A type guard check for `payout.done` webhook events.
4
+ * @param event - The webhook event to check against.
5
+ * @returns A boolean that indicates if the webhook is a payout done webhook.
6
6
  */
7
7
  export declare function isPayoutDoneWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookPayoutDoneEvent;
8
8
  /**
9
- * A type guard check for `payout.failed` webhook events
10
- * @param event - The webhook event to check against
11
- * @returns A boolean that indicates if the webhook is a payout failed webhook
9
+ * A type guard check for `payout.failed` webhook events.
10
+ * @param event - The webhook event to check against.
11
+ * @returns A boolean that indicates if the webhook is a payout failed webhook.
12
12
  */
13
13
  export declare function isPayoutFailedWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookPayoutFailedEvent;
14
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
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
18
  */
19
19
  export declare function isBillingPaidWebhookEvent(event: WebhookEvent): event is import("./webhook").WebhookBillingPaidEvent;
20
20
  /**
21
- * Verify whether the signature is valid or not
22
- * @param raw Raw body response (string)
23
- * @param signature The content of the`X-Webhook-Signature` header
24
- * @returns A boolean that indicates if the signature is valid
21
+ * Verify whether the signature is valid or not.
22
+ * @param raw Raw body response (string).
23
+ * @param signature The content of the`X-Webhook-Signature` header.
24
+ * @returns A boolean that indicates if the signature is valid.
25
25
  */
26
26
  export declare const verifyWebhookSignature: (raw: string, signature: string) => boolean;
package/dist/v2/utils.js CHANGED
@@ -1,35 +1,35 @@
1
1
  import { createHmac, timingSafeEqual } from 'node:crypto';
2
2
  import { WebhookEventType } from './webhook';
3
3
  /**
4
- * A type guard check for `payout.done` webhook events
5
- * @param event - The webhook event to check against
6
- * @returns A boolean that indicates if the webhook is a payout done webhook
4
+ * A type guard check for `payout.done` webhook events.
5
+ * @param event - The webhook event to check against.
6
+ * @returns A boolean that indicates if the webhook is a payout done webhook.
7
7
  */
8
8
  export function isPayoutDoneWebhookEvent(event) {
9
9
  return event.event === WebhookEventType.PayoutDone;
10
10
  }
11
11
  /**
12
- * A type guard check for `payout.failed` webhook events
13
- * @param event - The webhook event to check against
14
- * @returns A boolean that indicates if the webhook is a payout failed webhook
12
+ * A type guard check for `payout.failed` webhook events.
13
+ * @param event - The webhook event to check against.
14
+ * @returns A boolean that indicates if the webhook is a payout failed webhook.
15
15
  */
16
16
  export function isPayoutFailedWebhookEvent(event) {
17
17
  return event.event === WebhookEventType.PayoutFailed;
18
18
  }
19
19
  /**
20
- * A type guard check for `billing.paid` webhook events
21
- * @param event - The webhook event to check against
22
- * @returns A boolean that indicates if the webhook is a billing paid webhook
20
+ * A type guard check for `billing.paid` webhook events.
21
+ * @param event - The webhook event to check against.
22
+ * @returns A boolean that indicates if the webhook is a billing paid webhook.
23
23
  */
24
24
  export function isBillingPaidWebhookEvent(event) {
25
25
  return event.event === WebhookEventType.BillingPaid;
26
26
  }
27
27
  const ABACATEPAY_PUBLIC_KEY = 't9dXRhHHo3yDEj5pVDYz0frf7q6bMKyMRmxxCPIPp3RCplBfXRxqlC6ZpiWmOqj4L63qEaeUOtrCI8P0VMUgo6iIga2ri9ogaHFs0WIIywSMg0q7RmBfybe1E5XJcfC4IW3alNqym0tXoAKkzvfEjZxV6bE0oG2zJrNNYmUCKZyV0KZ3JS8Votf9EAWWYdiDkMkpbMdPggfh1EqHlVkMiTady6jOR3hyzGEHrIz2Ret0xHKMbiqkr9HS1JhNHDX9';
28
28
  /**
29
- * Verify whether the signature is valid or not
30
- * @param raw Raw body response (string)
31
- * @param signature The content of the`X-Webhook-Signature` header
32
- * @returns A boolean that indicates if the signature is valid
29
+ * Verify whether the signature is valid or not.
30
+ * @param raw Raw body response (string).
31
+ * @param signature The content of the`X-Webhook-Signature` header.
32
+ * @returns A boolean that indicates if the signature is valid.
33
33
  */
34
34
  export const verifyWebhookSignature = (raw, signature) => {
35
35
  const bodyBuffer = Buffer.from(raw, 'utf8');
@@ -83,11 +83,11 @@ export type WebhookBillingPaidEvent = BaseWebhookEvent<WebhookEventType.BillingP
83
83
  */
84
84
  id: string;
85
85
  /**
86
- * Kind of the payment
86
+ * Kind of the payment.
87
87
  */
88
88
  kind: 'PIX';
89
89
  /**
90
- * Billing status, can only be `PAID` here
90
+ * Billing status, can only be `PAID` here.
91
91
  *
92
92
  * @see {@link PaymentStatus.Paid}
93
93
  */
package/dist/version.d.ts CHANGED
@@ -1,2 +1,8 @@
1
- export declare const version: "2.0.0";
1
+ /**
2
+ * Current version of [@abacatepay/types](https://www.npmjs.com/package/@abacatepay/types).
3
+ */
4
+ export declare const version: "2.0.1";
5
+ /**
6
+ * Current version of the AbacatePay API
7
+ */
2
8
  export declare const API_VERSION: "2";
package/dist/version.js CHANGED
@@ -1,3 +1,9 @@
1
1
  // AUTO-GENERATED β€” DO NOT EDIT
2
- export const version = '2.0.0';
2
+ /**
3
+ * Current version of [@abacatepay/types](https://www.npmjs.com/package/@abacatepay/types).
4
+ */
5
+ export const version = '2.0.1';
6
+ /**
7
+ * Current version of the AbacatePay API
8
+ */
3
9
  export const API_VERSION = '2';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0",
2
+ "version": "2.0.1",
3
3
  "name": "@abacatepay/types",
4
4
  "description": "Abacate Pay API typings that are always up to date.",
5
5
  "type": "module",
@@ -63,6 +63,6 @@
63
63
  },
64
64
  "repository": {
65
65
  "type": "git",
66
- "url": "https://github.com/almeidazs/abacate-pay-types"
66
+ "url": "https://github.com/almeidazs/ecosystem"
67
67
  }
68
68
  }