gerencianet 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +8 -0
  3. data/README.md +15 -3
  4. data/docs/all-in-one.md +92 -0
  5. data/docs/carnet-detailing.md +61 -0
  6. data/docs/carnet-update.md +55 -0
  7. data/docs/carnets.md +217 -0
  8. data/docs/charge-detailing.md +42 -0
  9. data/docs/charge-payment.md +145 -0
  10. data/docs/charge-update.md +52 -0
  11. data/docs/charge-with-marketplace.md +54 -0
  12. data/docs/charges.md +94 -0
  13. data/docs/examples/.gitignore +1 -0
  14. data/docs/examples/all_in_one.rb +57 -0
  15. data/docs/examples/cancel_charge.rb +15 -0
  16. data/docs/examples/cancel_subscription.rb +15 -0
  17. data/docs/examples/create_billet_payment.rb +33 -0
  18. data/docs/examples/create_card_payment.rb +39 -0
  19. data/docs/examples/create_carnet.rb +32 -0
  20. data/docs/examples/create_charge.rb +24 -0
  21. data/docs/examples/create_plan.rb +17 -0
  22. data/docs/examples/create_subscription.rb +31 -0
  23. data/docs/examples/create_subscription_payment.rb +38 -0
  24. data/docs/examples/credentials.rb +5 -0
  25. data/docs/examples/delete_plan.rb +15 -0
  26. data/docs/examples/detail_carnet.rb +15 -0
  27. data/docs/examples/detail_charge.rb +15 -0
  28. data/docs/examples/detail_subscription.rb +15 -0
  29. data/docs/examples/get_installments.rb +16 -0
  30. data/docs/examples/get_notification.rb +15 -0
  31. data/docs/examples/get_plans.rb +17 -0
  32. data/docs/examples/update_billet.rb +19 -0
  33. data/docs/examples/update_carnet_metadata.rb +20 -0
  34. data/docs/examples/update_charge_metadata.rb +20 -0
  35. data/docs/examples/update_parcel.rb +20 -0
  36. data/docs/examples/update_subscription_metadata.rb +20 -0
  37. data/docs/installments.md +108 -0
  38. data/docs/notifications.md +105 -0
  39. data/docs/subscription-detailing.md +56 -0
  40. data/docs/subscription-payment.md +100 -0
  41. data/docs/subscription-update.md +29 -0
  42. data/docs/subscriptions.md +69 -0
  43. data/lib/gerencianet/constants.rb +1 -1
  44. data/lib/gerencianet/endpoints.rb +14 -19
  45. data/lib/gerencianet/version.rb +1 -1
  46. metadata +41 -2
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 2363
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.cancel_charge(params: params)
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1111
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.cancel_subscription(params: params)
@@ -0,0 +1,33 @@
1
+ require "gerencianet"
2
+ require "date"
3
+ require_relative "./credentials"
4
+
5
+ options = {
6
+ client_id: CREDENTIALS::CLIENT_ID,
7
+ client_secret: CREDENTIALS::CLIENT_SECRET,
8
+ sandbox: true
9
+ }
10
+
11
+ tomorrow = Date.today + 1
12
+
13
+ params = {
14
+ id: 2365
15
+ }
16
+
17
+ body = {
18
+ payment: {
19
+ banking_billet: {
20
+ expire_at: tomorrow.strftime,
21
+ customer: {
22
+ name: "Gorbadoc Oldbuck",
23
+ email: "oldbuck@gerencianet.com.br",
24
+ cpf: "04267484171",
25
+ birth: "1977-01-15",
26
+ phone_number: "5144916523"
27
+ }
28
+ }
29
+ }
30
+ }
31
+
32
+ gerencianet = Gerencianet.new(options)
33
+ puts gerencianet.pay_charge(params: params, body: body)
@@ -0,0 +1,39 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ body = {
11
+ payment: {
12
+ credit_card: {
13
+ installments: 1,
14
+ payment_token: "5739b06925244dd1ab8e0afa62389d5fb4ea2945",
15
+ billing_address: {
16
+ street: "Av. JK",
17
+ number: 909,
18
+ neighborhood: "Bauxita",
19
+ zipcode: "35400000",
20
+ city: "Ouro Preto",
21
+ state: "MG"
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
+ }
31
+ }
32
+ }
33
+
34
+ params = {
35
+ id: 2366
36
+ }
37
+
38
+ gerencianet = Gerencianet.new(options)
39
+ puts gerencianet.pay_charge(params: params, body: body)
@@ -0,0 +1,32 @@
1
+ require "gerencianet"
2
+ require "date"
3
+ require_relative "./credentials"
4
+
5
+ options = {
6
+ client_id: CREDENTIALS::CLIENT_ID,
7
+ client_secret: CREDENTIALS::CLIENT_SECRET,
8
+ sandbox: true
9
+ }
10
+
11
+ tomorrow = Date.today + 1
12
+
13
+ body = {
14
+ expire_at: tomorrow.strftime,
15
+ items: [{
16
+ name: "Carnet Item 1",
17
+ value: 1000,
18
+ amount: 2
19
+ }],
20
+ customer: {
21
+ name: "Gorbadoc Oldbuck",
22
+ email: "oldbuck@gerencianet.com.br",
23
+ cpf: "04267484171",
24
+ birth: "1977-01-15",
25
+ phone_number: "5144916523"
26
+ },
27
+ repeats: 12,
28
+ split_items: false
29
+ }
30
+
31
+ gerencianet = Gerencianet.new(options)
32
+ puts gerencianet.create_carnet(body: body)
@@ -0,0 +1,24 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ body = {
11
+ items: [{
12
+ name: "Product 1",
13
+ value: 1000,
14
+ amount: 2
15
+ }],
16
+ shippings: [{
17
+ name: "Default Shipping Cost",
18
+ value: 100
19
+ }]
20
+ }
21
+
22
+ gerencianet = Gerencianet.new(options)
23
+ puts gerencianet.create_charge(body: body)
24
+
@@ -0,0 +1,17 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ body = {
11
+ name: "My first plan",
12
+ repeats: 24,
13
+ interval: 2
14
+ }
15
+
16
+ gerencianet = Gerencianet.new(options)
17
+ puts gerencianet.create_plan(body: body)
@@ -0,0 +1,31 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ plan = {
11
+ name: "My first plan",
12
+ repeats: 24,
13
+ interval: 2
14
+ }
15
+
16
+ subscription = {
17
+ items: [{
18
+ name: "Product 1",
19
+ value: 1000,
20
+ amount: 2
21
+ }]
22
+ }
23
+
24
+ gerencianet = Gerencianet.new(options)
25
+ plan = gerencianet.create_plan(body: plan)
26
+
27
+ params = {
28
+ id: plan["data"]["plan_id"]
29
+ }
30
+
31
+ puts gerencianet.create_subscription(params: params, body: subscription)
@@ -0,0 +1,38 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1113
12
+ }
13
+
14
+ body = {
15
+ payment: {
16
+ credit_card: {
17
+ payment_token: "e0c210bb679fea225a586256234f8ce179fd16c5",
18
+ billing_address: {
19
+ street: "Av. JK",
20
+ number: 909,
21
+ neighborhood: "Bauxita",
22
+ zipcode: "35400000",
23
+ city: "Ouro Preto",
24
+ state: "MG"
25
+ },
26
+ customer: {
27
+ name: "Gorbadoc Oldbuck",
28
+ email: "oldbuck@gerencianet.com.br",
29
+ cpf: "04267484171",
30
+ birth: "1977-01-15",
31
+ phone_number: "5144916523"
32
+ }
33
+ }
34
+ }
35
+ }
36
+
37
+ gerencianet = Gerencianet.new(options)
38
+ puts gerencianet.pay_subscription(params: params, body: body)
@@ -0,0 +1,5 @@
1
+ # example
2
+ module CREDENTIALS
3
+ CLIENT_ID = "Client_Id_87927ea664846b546adb3708b2ad16ed3c00f02b"
4
+ CLIENT_SECRET = "Client_Secret_d8da11a01fe157db2bc35e4e6828cccf092db9e2"
5
+ end
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.delete_plan(params: params)
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1000
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.detail_carnet(params: params)
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1000
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.detail_charge(params: params)
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1120
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.detail_subscription(params: params)
@@ -0,0 +1,16 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ brand: "visa",
12
+ total: 5000
13
+ }
14
+
15
+ gerencianet = Gerencianet.new(options)
16
+ puts gerencianet.get_installments(params: params)
@@ -0,0 +1,15 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ token: "252948279264ee47e117cb099ef81"
12
+ }
13
+
14
+ gerencianet = Gerencianet.new(options)
15
+ puts gerencianet.get_notification(params: params)
@@ -0,0 +1,17 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ name: "My Plan",
12
+ limit: 1,
13
+ offset: 0
14
+ }
15
+
16
+ gerencianet = Gerencianet.new(options)
17
+ puts gerencianet.get_plans(params: params)
@@ -0,0 +1,19 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1008
12
+ }
13
+
14
+ body = {
15
+ expire_at: "2020-12-12"
16
+ }
17
+
18
+ gerencianet = Gerencianet.new(options)
19
+ puts gerencianet.update_billet(params: params, body: body)
@@ -0,0 +1,20 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1004
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)
@@ -0,0 +1,20 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: true
8
+ }
9
+
10
+ params = {
11
+ id: 1008
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_charge_metadata(params: params, body: body)