@zennify/sdk-js 1.0.0 → 1.1.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.
@@ -1,9 +1,8 @@
1
- name: Publish to npm
1
+ name: Publish to npm (Stable)
2
2
 
3
3
  on:
4
- push:
5
- branches:
6
- - main
4
+ release:
5
+ types: [published]
7
6
 
8
7
  jobs:
9
8
  build:
@@ -16,7 +15,7 @@ jobs:
16
15
  - run: npm ci
17
16
  - run: npm run build
18
17
 
19
- publish-gpr:
18
+ publish-npm:
20
19
  needs: build
21
20
  runs-on: ubuntu-latest
22
21
  permissions:
@@ -30,6 +29,6 @@ jobs:
30
29
  registry-url: https://registry.npmjs.org/
31
30
  - run: npm ci
32
31
  - run: npm run build
33
- - run: npm publish --access public --tag beta
32
+ - run: npm publish --access public
34
33
  env:
35
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
34
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -24,20 +24,22 @@ class ZennifyAPIRequestError extends Error {
24
24
  this.name = "Usuário inválido";
25
25
  this.message = "Por favor, se re-autentique";
26
26
  }
27
- if (this.status === 503) {
27
+ else if (this.status === 503) {
28
28
  this.name = "API em atualização.";
29
29
  this.message = "Por favor, tente novamente em alguns minutos.";
30
30
  }
31
- if (this.status === 429) {
31
+ else if (this.status === 429) {
32
32
  this.name = "Calma ai!";
33
33
  this.message = "Suas ações estão sendo limitadas!";
34
34
  }
35
- const error = errors_translations[var_1.ZENNIFY_API_RESPONSE_LANGUAGE][body.code] ||
36
- errors_translations[var_1.ZENNIFY_API_RESPONSE_LANGUAGE]["UNKNOWN_TRANSLATION"];
37
- this.name = error.name
38
- .replace(match_regex, (value) => replacer(body, value));
39
- this.message = error.message
40
- .replace(match_regex, (value) => replacer(body, value));
35
+ else {
36
+ const error = errors_translations[var_1.ZENNIFY_API_RESPONSE_LANGUAGE][body.code] ||
37
+ errors_translations[var_1.ZENNIFY_API_RESPONSE_LANGUAGE]["UNKNOWN_TRANSLATION"];
38
+ this.name = error.name
39
+ .replace(match_regex, (value) => replacer(body, value));
40
+ this.message = error.message
41
+ .replace(match_regex, (value) => replacer(body, value));
42
+ }
41
43
  }
42
44
  }
43
45
  exports.ZennifyAPIRequestError = ZennifyAPIRequestError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zennify/sdk-js",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "A simple package to work with https://api.zennify.app",
5
5
  "main": "dist/main.js",
6
6
  "keywords": [],
@@ -30,27 +30,25 @@ export class ZennifyAPIRequestError extends Error {
30
30
  this.name = "Usuário inválido";
31
31
  this.message = "Por favor, se re-autentique"
32
32
  }
33
-
34
- if (this.status === 503) {
33
+ else if (this.status === 503) {
35
34
  this.name = "API em atualização.";
36
35
  this.message = "Por favor, tente novamente em alguns minutos.";
37
36
  }
38
-
39
- if (this.status === 429) {
37
+ else if (this.status === 429) {
40
38
  this.name = "Calma ai!";
41
39
  this.message = "Suas ações estão sendo limitadas!";
42
- }
40
+ } else {
43
41
 
44
- const error: { name: string, message: string } =
45
- errors_translations[ZENNIFY_API_RESPONSE_LANGUAGE][body.code] ||
46
- errors_translations[ZENNIFY_API_RESPONSE_LANGUAGE]["UNKNOWN_TRANSLATION"];
42
+ const error: { name: string, message: string } =
43
+ errors_translations[ZENNIFY_API_RESPONSE_LANGUAGE][body.code] ||
44
+ errors_translations[ZENNIFY_API_RESPONSE_LANGUAGE]["UNKNOWN_TRANSLATION"];
47
45
 
48
- this.name = error.name
49
- .replace(match_regex, (value) => replacer(body, value));
50
-
51
- this.message = error.message
52
- .replace(match_regex, (value) => replacer(body, value));
46
+ this.name = error.name
47
+ .replace(match_regex, (value) => replacer(body, value));
53
48
 
49
+ this.message = error.message
50
+ .replace(match_regex, (value) => replacer(body, value));
51
+ }
54
52
  }
55
53
 
56
54
  }
package/src/errors.ts CHANGED
@@ -151,6 +151,7 @@ export interface APIErrors {
151
151
  'STORE_ALREADY_CONFIGURED': {};
152
152
  'MP_ACCOUNT_OFFLINE': {};
153
153
  'MP_PIX_KEY_NOT_CONFIGURED': {}
154
+ 'MP_NOT_ALLOWED_TO_SELL': {}
154
155
  }
155
156
 
156
157
  type ExpectedAdditionalData = {
@@ -195,6 +195,10 @@
195
195
  "name": "PIX key not configured",
196
196
  "message": "The seller must configure a PIX key in Mercado Pago."
197
197
  },
198
+ "MP_NOT_ALLOWED_TO_SELL": {
199
+ "name": "Not authorized by Mercado Pago to sell",
200
+ "message": "Please contact Mercado Pago support."
201
+ },
198
202
  "INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS": {
199
203
  "name": "Invalid operation for this transaction.",
200
204
  "message": "The current status doesn't allow this operation."
@@ -191,6 +191,10 @@
191
191
  "name": "Chave PIX não configurada",
192
192
  "message": "O vendedor deve configurar uma chave pix no Mercado Pago."
193
193
  },
194
+ "MP_NOT_ALLOWED_TO_SELL": {
195
+ "name": "Sem autorização do Mercado Pago para vender",
196
+ "message": "Entre em contato com o Mercado Pago."
197
+ },
194
198
  "INVALID_OPERATION_FOR_CURRENT_TRANSACTION_STATUS": {
195
199
  "name": "Operação inválida para essa transação.",
196
200
  "message": "O estado atual não permite que a operação seja realizada."
package/types/errors.d.ts CHANGED
@@ -132,6 +132,7 @@ export interface APIErrors {
132
132
  'STORE_ALREADY_CONFIGURED': {};
133
133
  'MP_ACCOUNT_OFFLINE': {};
134
134
  'MP_PIX_KEY_NOT_CONFIGURED': {};
135
+ 'MP_NOT_ALLOWED_TO_SELL': {};
135
136
  }
136
137
  type ExpectedAdditionalData = {
137
138
  field: string;