@zennify/sdk-js 1.5.0 → 1.7.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.
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/main.js CHANGED
@@ -24,4 +24,5 @@ __exportStar(require("./interfaces/Panels"), exports);
24
24
  __exportStar(require("./interfaces/Products"), exports);
25
25
  __exportStar(require("./interfaces/Guild"), exports);
26
26
  __exportStar(require("./interfaces/Stores"), exports);
27
+ __exportStar(require("./interfaces/Orders"), exports);
27
28
  __exportStar(require("./interfaces/Statistics"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.5.0",
3
+ "version": "1.7.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
@@ -76,12 +76,17 @@ export interface APIErrors {
76
76
  addon: string
77
77
  };
78
78
  'UNKNOWN_ORDER': {}
79
- 'INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS': {}
80
- 'INVALID_OPERATION_FOR_PAYMENT_ENTITY': {}
79
+ /// for update
80
+ 'INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS': {};
81
+ 'INVALID_OPERATION_FOR_PAYMENT_ENTITY': {};
82
+ 'INVALID_STATUS_FOR_ORDER_UPDATE': {};
83
+ 'INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE': {};
84
+ 'ORDER_TRANSACTION_ALREADY_REFUNDED': {};
85
+ 'FAILED_REFUND': {};
81
86
  // MP errors
82
87
  'MP_ACCOUNT_OFFLINE': {};
83
- 'MP_PIX_KEY_NOT_CONFIGURED': {}
84
- 'MP_NOT_ALLOWED_TO_SELL': {}
88
+ 'MP_PIX_KEY_NOT_CONFIGURED': {};
89
+ 'MP_NOT_ALLOWED_TO_SELL': {};
85
90
  /// bad preference configuration
86
91
  'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX': {};
87
92
  'THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_BOLETO': {};
@@ -0,0 +1,53 @@
1
+ export type FullOrder = {
2
+ id: string,
3
+ created_at: string,
4
+ platform: 'discord',
5
+ discord_guild_id?: null | string,
6
+ discount: number,
7
+ subtotal: number,
8
+ total_value: number,
9
+ rating?: null | number,
10
+ rating_message?: null | number,
11
+ metadata?: null | string,
12
+ transaction_data: {
13
+ id: string,
14
+ entity: 'semiauto' | 'mercadopago',
15
+ method: 'pix',
16
+ managed?: null | boolean,
17
+ status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis',
18
+ value: number,
19
+ base_value: number,
20
+ refunded_value: number,
21
+ refund_reason?: null | string,
22
+ refund_comment?: null | string,
23
+ refund_requested_by?: null | number,
24
+ pix_e2eid?: null | string,
25
+ pix_qrcode?: null | string,
26
+ payer_bank?: null | string
27
+ },
28
+ payer: {
29
+ id: number,
30
+ username: string,
31
+ discord_user_id: string
32
+ },
33
+ seller: {
34
+ id: number,
35
+ username: string,
36
+ discord_user_id: string
37
+ },
38
+ store: {
39
+ id: number,
40
+ name: string,
41
+ icon_id?: null | number,
42
+ banner_id?: null | number
43
+ },
44
+ products: {
45
+ id: number,
46
+ name: string,
47
+ value: number,
48
+ icon_id?: null | number,
49
+ banner_id?: null | number,
50
+ amount: number,
51
+ delivered: string[]
52
+ }[]
53
+ }
package/src/main.ts CHANGED
@@ -9,4 +9,5 @@ export * from './interfaces/Panels';
9
9
  export * from './interfaces/Products';
10
10
  export * from './interfaces/Guild';
11
11
  export * from './interfaces/Stores';
12
+ export * from './interfaces/Orders';
12
13
  export * from './interfaces/Statistics';
@@ -215,6 +215,22 @@
215
215
  "name": "This payment entity doesn't support this operation",
216
216
  "message": "Try using another payment entity or check the request"
217
217
  },
218
+ "INVALID_STATUS_FOR_ORDER_UPDATE": {
219
+ "name": "Invalid status provided",
220
+ "message": "Check the documentation."
221
+ },
222
+ "INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE": {
223
+ "name": "The refund amount exceeded the maximum value",
224
+ "message": "The maximum amount is ${max}"
225
+ },
226
+ "ORDER_TRANSACTION_ALREADY_REFUNDED": {
227
+ "name": "This order has already been refunded",
228
+ "message": "The order has already been refunded"
229
+ },
230
+ "FAILED_REFUND": {
231
+ "name": "Failed to refund this order",
232
+ "message": "Please contact support."
233
+ },
218
234
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
219
235
  "name": "This seller has not yet configured receipt via PIX",
220
236
  "message": "Choose another method or wait for seller configuration."
@@ -211,6 +211,22 @@
211
211
  "name": "Essa entidade de pagamento não suporta essa operação",
212
212
  "message": "Tente usando uma outra entidade de pagamento"
213
213
  },
214
+ "INVALID_STATUS_FOR_ORDER_UPDATE": {
215
+ "name": "Estado inválido fornecido",
216
+ "message": "Verifique a documentação."
217
+ },
218
+ "INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE": {
219
+ "name": "O valor do reembolso excedeu o valor máximo",
220
+ "message": "O valor máximo é de R$ {max}"
221
+ },
222
+ "ORDER_TRANSACTION_ALREADY_REFUNDED": {
223
+ "name": "Esse pedido já foi reembolsado",
224
+ "message": "O pedido já foi reembolsado"
225
+ },
226
+ "FAILED_REFUND": {
227
+ "name": "Ocorreu uma falha ao reembolsar este pedido",
228
+ "message": "Entre em contato com o suporte."
229
+ },
214
230
  "THIS_SELLER_HAS_NOT_YET_CONFIGURED_RECEIPT_VIA_PIX": {
215
231
  "name": "O vendedor não configurou o recebimento via Pix",
216
232
  "message": "Escolha outro método ou aguarde a configuração do vendedor."
package/types/errors.d.ts CHANGED
@@ -72,6 +72,10 @@ export interface APIErrors {
72
72
  'UNKNOWN_ORDER': {};
73
73
  'INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS': {};
74
74
  'INVALID_OPERATION_FOR_PAYMENT_ENTITY': {};
75
+ 'INVALID_STATUS_FOR_ORDER_UPDATE': {};
76
+ 'INVALID_REFUND_VALUE_EXCEEDS_ORDER_VALUE': {};
77
+ 'ORDER_TRANSACTION_ALREADY_REFUNDED': {};
78
+ 'FAILED_REFUND': {};
75
79
  'MP_ACCOUNT_OFFLINE': {};
76
80
  'MP_PIX_KEY_NOT_CONFIGURED': {};
77
81
  'MP_NOT_ALLOWED_TO_SELL': {};
@@ -0,0 +1,53 @@
1
+ export type FullOrder = {
2
+ id: string;
3
+ created_at: string;
4
+ platform: 'discord';
5
+ discord_guild_id?: null | string;
6
+ discount: number;
7
+ subtotal: number;
8
+ total_value: number;
9
+ rating?: null | number;
10
+ rating_message?: null | number;
11
+ metadata?: null | string;
12
+ transaction_data: {
13
+ id: string;
14
+ entity: 'semiauto' | 'mercadopago';
15
+ method: 'pix';
16
+ managed?: null | boolean;
17
+ status: 'approved' | 'cancelled' | 'expired' | 'pending' | 'refused' | 'rejected' | 'analysis';
18
+ value: number;
19
+ base_value: number;
20
+ refunded_value: number;
21
+ refund_reason?: null | string;
22
+ refund_comment?: null | string;
23
+ refund_requested_by?: null | number;
24
+ pix_e2eid?: null | string;
25
+ pix_qrcode?: null | string;
26
+ payer_bank?: null | string;
27
+ };
28
+ payer: {
29
+ id: number;
30
+ username: string;
31
+ discord_user_id: string;
32
+ };
33
+ seller: {
34
+ id: number;
35
+ username: string;
36
+ discord_user_id: string;
37
+ };
38
+ store: {
39
+ id: number;
40
+ name: string;
41
+ icon_id?: null | number;
42
+ banner_id?: null | number;
43
+ };
44
+ products: {
45
+ id: number;
46
+ name: string;
47
+ value: number;
48
+ icon_id?: null | number;
49
+ banner_id?: null | number;
50
+ amount: number;
51
+ delivered: string[];
52
+ }[];
53
+ };
package/types/main.d.ts CHANGED
@@ -8,4 +8,5 @@ export * from './interfaces/Panels';
8
8
  export * from './interfaces/Products';
9
9
  export * from './interfaces/Guild';
10
10
  export * from './interfaces/Stores';
11
+ export * from './interfaces/Orders';
11
12
  export * from './interfaces/Statistics';