@warpstore/warpstore-package 1.0.0 → 1.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 +60 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# warpstore-package
|
|
2
|
+
|
|
3
|
+
Esta biblioteca oferece aos desenvolvedores uma coleção descomplicada de funcionalidades para facilitar a integração a API da Warp Store em seu site, permitindo a exibição e venda de produtos cadastrados no nosso Dashboard.
|
|
4
|
+
## 📲 Installation
|
|
5
|
+
|
|
6
|
+
1. Instale o nosso NODE SDK usando o comando logo abaixo:
|
|
7
|
+
```sh
|
|
8
|
+
$ npm i @warpstore/warpstore-package
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## 🌟 Começando
|
|
13
|
+
|
|
14
|
+
O uso simples se parece com:
|
|
15
|
+
|
|
16
|
+
```javascript
|
|
17
|
+
const warpstore = new WarpStore()
|
|
18
|
+
|
|
19
|
+
const response = await warpstore.template.v1.getStoreInfo({
|
|
20
|
+
subDomain: "seu_sub_dominio",
|
|
21
|
+
// domain: "ou_seu_dominio"
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
if(response.isFailure()){
|
|
25
|
+
console.log(response.value.errorName);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
console.log(response.value);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## ✨ Logic
|
|
33
|
+
|
|
34
|
+
Each operation will yield one of two outcomes: a MercadoPagoError in the event of an error, or the desired value in case of a successful operation.
|
|
35
|
+
|
|
36
|
+
You can check if the operation was successfull or not by calling the methods:
|
|
37
|
+
```javascript
|
|
38
|
+
const payment = await mercadoPago.value.payment.create()
|
|
39
|
+
if(payment.isFailure()) console.log("operation failed")
|
|
40
|
+
if(payment.isSuccess()) console.log("operation succeeded")
|
|
41
|
+
```
|
|
42
|
+
Definition of MercadoPagoError:
|
|
43
|
+
```javascript
|
|
44
|
+
class MercadoPagoError {
|
|
45
|
+
message: string;
|
|
46
|
+
aditionalInfo: any;
|
|
47
|
+
status: number;
|
|
48
|
+
code: number | string
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
response if successfull:
|
|
52
|
+
```javascript
|
|
53
|
+
const response = {
|
|
54
|
+
id: string
|
|
55
|
+
payment_method_id: string
|
|
56
|
+
// ...
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Keep in mind the responses are not typed, so you will have to look at the documentation to consult what each operation will return.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warpstore/warpstore-package",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/src/main.js",
|
|
6
6
|
"types": "dist/src/main.d.ts",
|
|
@@ -42,4 +42,4 @@
|
|
|
42
42
|
"ts-node-dev": "^2.0.0",
|
|
43
43
|
"tsconfig-paths": "^4.2.0"
|
|
44
44
|
}
|
|
45
|
-
}
|
|
45
|
+
}
|