gerencianet 0.0.7 → 0.0.8
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -45
- data/{docs/examples → examples}/.gitignore +0 -0
- data/{docs/examples → examples}/all_in_one.rb +0 -0
- data/{docs/examples → examples}/cancel_carnet.rb +0 -0
- data/{docs/examples → examples}/cancel_charge.rb +0 -0
- data/{docs/examples → examples}/cancel_parcel.rb +0 -0
- data/{docs/examples → examples}/cancel_subscription.rb +0 -0
- data/{docs/examples → examples}/create_billet_payment.rb +0 -0
- data/{docs/examples → examples}/create_card_payment.rb +0 -0
- data/{docs/examples → examples}/create_carnet.rb +0 -0
- data/{docs/examples → examples}/create_carnet_history.rb +0 -0
- data/{docs/examples → examples}/create_charge.rb +0 -0
- data/{docs/examples → examples}/create_charge_history.rb +0 -0
- data/{docs/examples → examples}/create_plan.rb +0 -0
- data/{docs/examples → examples}/create_subscription.rb +0 -0
- data/{docs/examples → examples}/create_subscription_payment.rb +0 -0
- data/{docs/examples → examples}/credentials.rb +0 -0
- data/{docs/examples → examples}/delete_plan.rb +0 -0
- data/{docs/examples → examples}/detail_carnet.rb +0 -0
- data/{docs/examples → examples}/detail_charge.rb +0 -0
- data/{docs/examples → examples}/detail_subscription.rb +0 -0
- data/{docs/examples → examples}/get_installments.rb +0 -0
- data/{docs/examples → examples}/get_notification.rb +0 -0
- data/{docs/examples → examples}/get_plans.rb +0 -0
- data/examples/link_charge.rb +27 -0
- data/{docs/examples → examples}/resend_billet.rb +0 -0
- data/{docs/examples → examples}/resend_carnet.rb +0 -0
- data/{docs/examples → examples}/resend_parcel.rb +0 -0
- data/{docs/examples → examples}/update_billet.rb +0 -0
- data/{docs/examples → examples}/update_carnet_metadata.rb +0 -0
- data/{docs/examples → examples}/update_charge_metadata.rb +0 -0
- data/{docs/examples → examples}/update_parcel.rb +0 -0
- data/{docs/examples → examples}/update_subscription_metadata.rb +0 -0
- data/gerencianet.gemspec +1 -0
- data/lib/gerencianet/constants.rb +4 -0
- data/lib/gerencianet/version.rb +1 -1
- metadata +54 -55
- data/docs/all-in-one.md +0 -92
- data/docs/carnet-cancel-parcel.md +0 -21
- data/docs/carnet-cancel.md +0 -20
- data/docs/carnet-create-history.md +0 -27
- data/docs/carnet-detailing.md +0 -61
- data/docs/carnet-resend-parcel.md +0 -27
- data/docs/carnet-resend.md +0 -26
- data/docs/carnet-update.md +0 -55
- data/docs/carnets.md +0 -165
- data/docs/charge-create-history.md +0 -27
- data/docs/charge-detailing.md +0 -42
- data/docs/charge-payment.md +0 -190
- data/docs/charge-resend-billet.md +0 -26
- data/docs/charge-update.md +0 -52
- data/docs/charge-with-marketplace.md +0 -54
- data/docs/charges.md +0 -75
- data/docs/installments.md +0 -108
- data/docs/notifications.md +0 -105
- data/docs/subscription-detailing.md +0 -56
- data/docs/subscription-payment.md +0 -100
- data/docs/subscription-update.md +0 -29
- data/docs/subscriptions.md +0 -69
data/docs/carnet-cancel.md
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
### Canceling the carnet
|
2
|
-
|
3
|
-
Only `active` carnets can be canceled:
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
params = {
|
7
|
-
id: 1000
|
8
|
-
}
|
9
|
-
|
10
|
-
gerencianet = Gerencianet.new(options)
|
11
|
-
puts gerencianet.cancel_carnet(params: params)
|
12
|
-
```
|
13
|
-
|
14
|
-
If everything goes well, the return will be:
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
{
|
18
|
-
"code": 200
|
19
|
-
}
|
20
|
-
```
|
@@ -1,27 +0,0 @@
|
|
1
|
-
## Adding information to carnet's history
|
2
|
-
|
3
|
-
It is possible to add information to the history of a carnet. These informations will be listed when [detailing a carnet](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/carnet-detailing.md).
|
4
|
-
|
5
|
-
The process to add information to history is shown below:
|
6
|
-
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
params = {
|
10
|
-
id: 1000
|
11
|
-
}
|
12
|
-
|
13
|
-
body = {
|
14
|
-
description: "Info that will be added to carnet history"
|
15
|
-
}
|
16
|
-
|
17
|
-
gerencianet = Gerencianet.new(options)
|
18
|
-
gerencianet.create_carnet_history(params: params, body: body)
|
19
|
-
```
|
20
|
-
|
21
|
-
If everything goes well, the return will be:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
{
|
25
|
-
"code": 200
|
26
|
-
}
|
27
|
-
```
|
data/docs/carnet-detailing.md
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
## Detailing carnets
|
2
|
-
|
3
|
-
In order to retrieve carnets, just provide the id:
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
params = {
|
7
|
-
id: 1000
|
8
|
-
}
|
9
|
-
|
10
|
-
gerencianet = Gerencianet.new(options)
|
11
|
-
puts gerencianet.detail_carnet(params: params)
|
12
|
-
```
|
13
|
-
|
14
|
-
The response you'll receive contains all the information about the carnet:
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
{
|
18
|
-
"code": 200,
|
19
|
-
"data": {
|
20
|
-
"carnet_id": 1000,
|
21
|
-
"status": "active",
|
22
|
-
"repeats": 4,
|
23
|
-
"cover": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CC-28333-61428-LEENA9/28333-61428-LEENA9",
|
24
|
-
"value": 8000,
|
25
|
-
"split_items": false,
|
26
|
-
"charges": [{
|
27
|
-
"charge_id": 357,
|
28
|
-
"parcel": "1",
|
29
|
-
"status": "waiting",
|
30
|
-
"value": 2000,
|
31
|
-
"expire_at": '2020-12-12',
|
32
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61428-LEENA9",
|
33
|
-
"barcode": "00190.00009 01523.894002 00061.428181 1 64780000002000"
|
34
|
-
}, {
|
35
|
-
"charge_id": 358,
|
36
|
-
"parcel": "2",
|
37
|
-
"status": "waiting",
|
38
|
-
"value": 2000,
|
39
|
-
"expire_at": '2021-01-12',
|
40
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61429-CORZE4",
|
41
|
-
"barcode": "00190.00009 01523.894002 00061.428181 8 65090000002000"
|
42
|
-
}, {
|
43
|
-
"charge_id": 359,
|
44
|
-
"parcel": "3",
|
45
|
-
"status": "waiting",
|
46
|
-
"value": 2000,
|
47
|
-
"expire_at": '2021-02-12',
|
48
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61430-HIRRA4",
|
49
|
-
"barcode": "00190.00009 01523.894002 00061.428181 7 65400000002000"
|
50
|
-
}, {
|
51
|
-
"charge_id": 360,
|
52
|
-
"parcel": "4",
|
53
|
-
"status": "waiting",
|
54
|
-
"value": 2000,
|
55
|
-
"expire_at": '2021-03-12',
|
56
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61431-HIRRA4",
|
57
|
-
"barcode": "00190.00009 01523.894002 00061.428181 5 65400000002000"
|
58
|
-
}
|
59
|
-
]
|
60
|
-
}
|
61
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
### Resending carnet parcel
|
2
|
-
|
3
|
-
To resend the carnet parcel, the parcel must have a `waiting` status.
|
4
|
-
|
5
|
-
If the parcel contemplates this requirement, you just have to provide the carnet id, the parcel number and a email to resend it:
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
params = {
|
9
|
-
id: 1000,
|
10
|
-
parcel: 1
|
11
|
-
}
|
12
|
-
|
13
|
-
body = {
|
14
|
-
email: 'oldbuck@gerencianet.com.br'
|
15
|
-
}
|
16
|
-
|
17
|
-
gerencianet = Gerencianet.new(options)
|
18
|
-
puts gerencianet.resend_parcel(params: params, body: body)
|
19
|
-
```
|
20
|
-
|
21
|
-
If everything goes well, the return will be:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
{
|
25
|
-
"code": 200
|
26
|
-
}
|
27
|
-
```
|
data/docs/carnet-resend.md
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
### Resending the carnet
|
2
|
-
|
3
|
-
To resend the carnet, it must have a `active` status.
|
4
|
-
|
5
|
-
If the carnet contemplates this requirement, you just have to provide the carnet id and a email to resend it:
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
params = {
|
9
|
-
id: 1000
|
10
|
-
}
|
11
|
-
|
12
|
-
body = {
|
13
|
-
email: 'oldbuck@gerencianet.com.br'
|
14
|
-
}
|
15
|
-
|
16
|
-
gerencianet = Gerencianet.new(options)
|
17
|
-
puts gerencianet.resend_carnet(params: params, body: body)
|
18
|
-
```
|
19
|
-
|
20
|
-
If everything goes well, the return will be:
|
21
|
-
|
22
|
-
```ruby
|
23
|
-
{
|
24
|
-
"code": 200
|
25
|
-
}
|
26
|
-
```
|
data/docs/carnet-update.md
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
## Updating carnets
|
2
|
-
|
3
|
-
### Changing the metadata
|
4
|
-
|
5
|
-
You can update the `custom_id` and the `notification_url` of a carnet at any time.
|
6
|
-
|
7
|
-
It's important to keep in mind that all the charges of the carnet will be updated. If you want to update only one charge, check [Updating charges](/docs/charge-update.md).
|
8
|
-
|
9
|
-
```ruby
|
10
|
-
params = {
|
11
|
-
id: 1000
|
12
|
-
}
|
13
|
-
|
14
|
-
body = {
|
15
|
-
notification_url: "http://yourdomain.com",
|
16
|
-
custom_id: "my_new_id"
|
17
|
-
}
|
18
|
-
|
19
|
-
gerencianet = Gerencianet.new(options)
|
20
|
-
puts gerencianet.update_carnet_metadata(params: params, body: body)
|
21
|
-
```
|
22
|
-
|
23
|
-
If everything goes well, the response will be:
|
24
|
-
|
25
|
-
```ruby
|
26
|
-
{
|
27
|
-
"code": 200
|
28
|
-
}
|
29
|
-
```
|
30
|
-
|
31
|
-
### Updating the expiration date of a parcel
|
32
|
-
|
33
|
-
Only parcels with status `waiting` or `unpaid` can have expiration date set or updated:
|
34
|
-
|
35
|
-
```ruby
|
36
|
-
params = {
|
37
|
-
id: 1000,
|
38
|
-
parcel: 1
|
39
|
-
}
|
40
|
-
|
41
|
-
body = {
|
42
|
-
expire_at: "2020-12-12"
|
43
|
-
}
|
44
|
-
|
45
|
-
gerencianet = Gerencianet.new(options)
|
46
|
-
puts gerencianet.update_parcel(params: params, body: body)
|
47
|
-
```
|
48
|
-
|
49
|
-
If everything goes well, the response will be:
|
50
|
-
|
51
|
-
```ruby
|
52
|
-
{
|
53
|
-
"code": 200
|
54
|
-
}
|
55
|
-
```
|
data/docs/carnets.md
DELETED
@@ -1,165 +0,0 @@
|
|
1
|
-
## Creating carnet billets
|
2
|
-
|
3
|
-
Carnet is a payment method that generates a bundle of charges with the same payment information and customer.
|
4
|
-
|
5
|
-
In order to generate a carnet, you'll need the items, the customer, the expiration date of the first charge and the number of repeats (or parcels).
|
6
|
-
|
7
|
-
The carnets can also be generated with the `metadata` attribute, just like in the banking billet, containing the `notification_url` and/or `custom_id`
|
8
|
-
|
9
|
-
There are other optional params:
|
10
|
-
|
11
|
-
- `split_items`, identifying if the total value must be splitted among the charges (defaults to `false`)
|
12
|
-
- The carnet `instructions`
|
13
|
-
|
14
|
-
### Required properties:
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
body = {
|
18
|
-
items: [{
|
19
|
-
name: "Carnet Item 1",
|
20
|
-
value: 1000,
|
21
|
-
amount: 2
|
22
|
-
}],
|
23
|
-
customer: {
|
24
|
-
name: "Gorbadoc Oldbuck",
|
25
|
-
email: "oldbuck@gerencianet.com.br",
|
26
|
-
cpf: "04267484171",
|
27
|
-
birth: "1977-01-15",
|
28
|
-
phone_number: "5144916523"
|
29
|
-
},
|
30
|
-
repeats: 4,
|
31
|
-
expire_at: "2020-12-12"
|
32
|
-
}
|
33
|
-
```
|
34
|
-
|
35
|
-
### Required properties plus metadata **(optional)**:
|
36
|
-
|
37
|
-
```ruby
|
38
|
-
body = {
|
39
|
-
items: [{
|
40
|
-
name: "Carnet Item 1",
|
41
|
-
value: 1000,
|
42
|
-
amount: 2
|
43
|
-
}],
|
44
|
-
customer: {
|
45
|
-
name: "Gorbadoc Oldbuck",
|
46
|
-
email: "oldbuck@gerencianet.com.br",
|
47
|
-
cpf: "04267484171",
|
48
|
-
birth: "1977-01-15",
|
49
|
-
phone_number: "5144916523"
|
50
|
-
},
|
51
|
-
repeats: 4,
|
52
|
-
expire_at: "2020-12-12",
|
53
|
-
metadata: {
|
54
|
-
custom_id: "my_id",
|
55
|
-
notification_url: "http://yourdomain.com"
|
56
|
-
}
|
57
|
-
}
|
58
|
-
```
|
59
|
-
|
60
|
-
The `notification_url` property will be used for sending notifications once things happen with charges statuses, as when it's payment was approved, for example. More about notifications [here](https://github.com/gerencianet/gn-api-sdk-node/tree/master/docs/notifications.md). The `custom_id` property can be used to set your own reference to the carnet.
|
61
|
-
|
62
|
-
### split_items attribute **(optional)**
|
63
|
-
|
64
|
-
By default, each parcel has the total value of the carnet. If you want to divide the total value among the parcels, change `split_items` property to *true*.
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
var body = {
|
68
|
-
items: [{
|
69
|
-
name: "Carnet Item 1",
|
70
|
-
value: 1000,
|
71
|
-
amount: 2
|
72
|
-
}],
|
73
|
-
customer: {
|
74
|
-
name: "Gorbadoc Oldbuck",
|
75
|
-
email: "oldbuck@gerencianet.com.br",
|
76
|
-
cpf: "04267484171",
|
77
|
-
birth: "1977-01-15",
|
78
|
-
phone_number: "5144916523"
|
79
|
-
},
|
80
|
-
repeats: 4,
|
81
|
-
expire_at: "2020-12-12",
|
82
|
-
split_items: true
|
83
|
-
}
|
84
|
-
```
|
85
|
-
|
86
|
-
### Setting instructions **(optional)**
|
87
|
-
|
88
|
-
If you want the carnet billet to have extra instructions, it's possible to send a maximum of 4 different instructions with a maximum of 90 caracters, just as follows:
|
89
|
-
|
90
|
-
```ruby
|
91
|
-
body = {
|
92
|
-
items: [{
|
93
|
-
name: "Carnet Item 1",
|
94
|
-
value: 1000,
|
95
|
-
amount: 2
|
96
|
-
}],
|
97
|
-
customer: {
|
98
|
-
name: "Gorbadoc Oldbuck",
|
99
|
-
email: "oldbuck@gerencianet.com.br",
|
100
|
-
cpf: "04267484171",
|
101
|
-
birth: "1977-01-15",
|
102
|
-
phone_number: "5144916523"
|
103
|
-
},
|
104
|
-
repeats: 4,
|
105
|
-
expire_at: "2020-12-12",
|
106
|
-
instructions: [
|
107
|
-
"Pay only with money",
|
108
|
-
"Do not pay with gold"
|
109
|
-
]
|
110
|
-
}
|
111
|
-
```
|
112
|
-
|
113
|
-
### Finally, create the carnet:
|
114
|
-
|
115
|
-
```ruby
|
116
|
-
gerencianet.create_carnet(body: body)
|
117
|
-
```
|
118
|
-
|
119
|
-
Check out the response:
|
120
|
-
|
121
|
-
```ruby
|
122
|
-
{
|
123
|
-
"code": 200,
|
124
|
-
"data": {
|
125
|
-
"carnet_id": 1000,
|
126
|
-
"cover": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CC-28333-61428-LEENA9/28333-61428-LEENA9",
|
127
|
-
"charges": [{
|
128
|
-
"charge_id": 357,
|
129
|
-
"parcel": "1",
|
130
|
-
"status": "waiting",
|
131
|
-
"value": 2000,
|
132
|
-
"expire_at": "2020-12-12",
|
133
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61428-LEENA9",
|
134
|
-
"barcode": "00190.00009 01523.894002 00061.428181 1 64780000002000"
|
135
|
-
}, {
|
136
|
-
"charge_id": 358,
|
137
|
-
"parcel": "2",
|
138
|
-
"status": "waiting",
|
139
|
-
"value": 2000,
|
140
|
-
"expire_at": "2021-01-12",
|
141
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61429-CORZE4",
|
142
|
-
"barcode": "00190.00009 01523.894002 00061.428181 8 65090000002000"
|
143
|
-
}, {
|
144
|
-
"charge_id": 359,
|
145
|
-
"parcel": "3",
|
146
|
-
"status": "waiting",
|
147
|
-
"value": 2000,
|
148
|
-
"expire_at": "2021-02-12",
|
149
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61430-HIRRA4",
|
150
|
-
"barcode": "00190.00009 01523.894002 00061.428181 7 65400000002000"
|
151
|
-
}, {
|
152
|
-
"charge_id": 360,
|
153
|
-
"parcel": "4",
|
154
|
-
"status": "waiting",
|
155
|
-
"value": 2000,
|
156
|
-
"expire_at": "2021-03-12",
|
157
|
-
"url": "https://visualizacao.gerencianet.com.br/emissao/28333_2385_ZEMAL5/A5CL-28333-61428-LEENA9/28333-61431-HIRRA4",
|
158
|
-
"barcode": "00190.00009 01523.894002 00061.428181 5 65400000002000"
|
159
|
-
}
|
160
|
-
]
|
161
|
-
}
|
162
|
-
}
|
163
|
-
```
|
164
|
-
|
165
|
-
Notice that, as the `repeats` were set to 4, the output contains 4 charges with `waiting` status. The value of each charge is the sum of the items values, because the `split_items` property was set to *false*. Also notice that `expire_at` increases monthly.
|
@@ -1,27 +0,0 @@
|
|
1
|
-
## Adding information to charge's history
|
2
|
-
|
3
|
-
It is possible to add information to the history of a charge. These informations will be listed when [detailing a charge](https://github.com/gerencianet/gn-api-sdk-ruby/tree/master/docs/charge-detailing.md).
|
4
|
-
|
5
|
-
The process to add information to history is shown below:
|
6
|
-
|
7
|
-
|
8
|
-
```ruby
|
9
|
-
params = {
|
10
|
-
id: 1253
|
11
|
-
}
|
12
|
-
|
13
|
-
body = {
|
14
|
-
description: "Info that will be added to charges history"
|
15
|
-
}
|
16
|
-
|
17
|
-
gerencianet = Gerencianet.new(options)
|
18
|
-
gerencianet.create_charge_history(params: params, body: body)
|
19
|
-
```
|
20
|
-
|
21
|
-
If everything goes well, the return will be:
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
{
|
25
|
-
"code": 200
|
26
|
-
}
|
27
|
-
```
|
data/docs/charge-detailing.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
## Detailing charges
|
2
|
-
|
3
|
-
It's very simple to get details from a charge. You just need the id:
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
params = {
|
7
|
-
id: 1300
|
8
|
-
}
|
9
|
-
|
10
|
-
gerencianet = Gerencianet.new(options)
|
11
|
-
gerencianet.detail_charge(params: params)
|
12
|
-
```
|
13
|
-
|
14
|
-
As response, you will receive all the information about the charge (including if it belongs to a subscription or carnet):
|
15
|
-
|
16
|
-
```ruby
|
17
|
-
{
|
18
|
-
"code": 200,
|
19
|
-
"data": {
|
20
|
-
"charge_id": 1300,
|
21
|
-
"subscription_id": 12,
|
22
|
-
"total": 2000,
|
23
|
-
"status": "new",
|
24
|
-
"custom_id": null,
|
25
|
-
"created_at": "2015-05-14",
|
26
|
-
"notification_url": "http://yourdomain.com",
|
27
|
-
"items": [
|
28
|
-
{
|
29
|
-
"name": "Product 1",
|
30
|
-
"value": 1000,
|
31
|
-
"amount": 2
|
32
|
-
}
|
33
|
-
],
|
34
|
-
"history": [
|
35
|
-
{
|
36
|
-
"message": "Cobrança criada",
|
37
|
-
"created_at": "2015-05-14 15:39:14"
|
38
|
-
}
|
39
|
-
]
|
40
|
-
}
|
41
|
-
}
|
42
|
-
```
|