@zennify/sdk-js 1.7.2 → 1.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.7.2",
3
+ "version": "1.9.0",
4
4
  "description": "A simple package to work with https://api.zennify.app",
5
5
  "main": "dist/main.js",
6
6
  "keywords": [],
package/src/errors.ts CHANGED
@@ -83,6 +83,7 @@ export interface APIErrors {
83
83
  'INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE': {};
84
84
  'ORDER_TRANSACTION_ALREADY_REFUNDED': {};
85
85
  'FAILED_REFUND': {};
86
+ 'INVALID_METADATA': { details: string };
86
87
  // MP errors
87
88
  'MP_ACCOUNT_OFFLINE': {};
88
89
  'MP_PIX_KEY_NOT_CONFIGURED': {};
@@ -1,5 +1,6 @@
1
- export type FullTransaction = {
1
+ export type BaseTransaction = {
2
2
  id: string,
3
+ created_at: string,
3
4
  entity: 'semiauto' | 'mercadopago',
4
5
  method: 'pix',
5
6
  managed: null,
@@ -12,7 +13,11 @@ export type FullTransaction = {
12
13
  refund_requested_by: null,
13
14
  pix_e2eid: null,
14
15
  pix_qrcode: null,
15
- payer_bank: null,
16
+ payer_bank: null
17
+ }
18
+
19
+ export type SaleTransaction = BaseTransaction & {
20
+ type: 'sale',
16
21
  order: {
17
22
  id: string,
18
23
  created_at: string,
@@ -52,4 +57,6 @@ export type FullTransaction = {
52
57
  }
53
58
  ]
54
59
  }
55
- }
60
+ };
61
+
62
+ export type FullTransaction = BaseTransaction & SaleTransaction;
@@ -231,6 +231,10 @@
231
231
  "name": "Failed to refund this order",
232
232
  "message": "Please contact support."
233
233
  },
234
+ "INVALID_METADATA": {
235
+ "name": "Invalid metadata for update",
236
+ "message": "Must be a JSON array or JSON object with up to 1000 characters"
237
+ },
234
238
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
235
239
  "name": "This seller has not yet configured receipt via PIX",
236
240
  "message": "Choose another method or wait for seller configuration."
@@ -227,6 +227,10 @@
227
227
  "name": "Ocorreu uma falha ao reembolsar este pedido",
228
228
  "message": "Entre em contato com o suporte."
229
229
  },
230
+ "INVALID_METADATA": {
231
+ "name": "Metadados inválidos para atualização",
232
+ "message": "Precisa ser um array JSON ou objeto JSON com até 1000 caracteres"
233
+ },
230
234
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
231
235
  "name": "O vendedor não configurou o recebimento via Pix",
232
236
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
package/types/errors.d.ts CHANGED
@@ -76,6 +76,9 @@ export interface APIErrors {
76
76
  'INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE': {};
77
77
  'ORDER_TRANSACTION_ALREADY_REFUNDED': {};
78
78
  'FAILED_REFUND': {};
79
+ 'INVALID_METADATA': {
80
+ details: string;
81
+ };
79
82
  'MP_ACCOUNT_OFFLINE': {};
80
83
  'MP_PIX_KEY_NOT_CONFIGURED': {};
81
84
  'MP_NOT_ALLOWED_TO_SELL': {};
@@ -1,5 +1,6 @@
1
- export type FullTransaction = {
1
+ export type BaseTransaction = {
2
2
  id: string;
3
+ created_at: string;
3
4
  entity: 'semiauto' | 'mercadopago';
4
5
  method: 'pix';
5
6
  managed: null;
@@ -13,6 +14,9 @@ export type FullTransaction = {
13
14
  pix_e2eid: null;
14
15
  pix_qrcode: null;
15
16
  payer_bank: null;
17
+ };
18
+ export type SaleTransaction = BaseTransaction & {
19
+ type: 'sale';
16
20
  order: {
17
21
  id: string;
18
22
  created_at: string;
@@ -53,3 +57,4 @@ export type FullTransaction = {
53
57
  ];
54
58
  };
55
59
  };
60
+ export type FullTransaction = BaseTransaction & SaleTransaction;