@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.
- package/.github/workflows/{npm-publish-package.yml → npm-publish-package-ofc.yml} +6 -7
- package/dist/RequestError.js +10 -8
- package/package.json +1 -1
- package/src/RequestError.ts +11 -13
- package/src/errors.ts +1 -0
- package/translations/en_US.json +4 -0
- package/translations/pt_BR.json +4 -0
- package/types/errors.d.ts +1 -0
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
name: Publish to npm
|
|
1
|
+
name: Publish to npm (Stable)
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
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-
|
|
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
|
|
32
|
+
- run: npm publish --access public
|
|
34
33
|
env:
|
|
35
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/dist/RequestError.js
CHANGED
|
@@ -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
|
-
|
|
36
|
-
errors_translations[var_1.ZENNIFY_API_RESPONSE_LANGUAGE][
|
|
37
|
-
|
|
38
|
-
.
|
|
39
|
-
|
|
40
|
-
.
|
|
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
package/src/RequestError.ts
CHANGED
|
@@ -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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
package/translations/en_US.json
CHANGED
|
@@ -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."
|
package/translations/pt_BR.json
CHANGED
|
@@ -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