gerencianet 0.0.11 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +2 -2
  3. data/CHANGELOG.md +23 -0
  4. data/README.md +4 -4
  5. data/examples/certs/developmentCertificate.pem +0 -0
  6. data/examples/certs/productionCertificate.pem +0 -0
  7. data/examples/credentials.rb +4 -2
  8. data/examples/{cancel_carnet.rb → default/carnet/cancel_carnet.rb} +2 -2
  9. data/examples/{cancel_parcel.rb → default/carnet/cancel_parcel.rb} +1 -1
  10. data/examples/{create_carnet.rb → default/carnet/create_carnet.rb} +2 -2
  11. data/examples/{create_carnet_history.rb → default/carnet/create_carnet_history.rb} +1 -1
  12. data/examples/{detail_carnet.rb → default/carnet/detail_carnet.rb} +1 -1
  13. data/examples/{resend_carnet.rb → default/carnet/resend_carnet.rb} +1 -1
  14. data/examples/{resend_parcel.rb → default/carnet/resend_parcel.rb} +1 -1
  15. data/examples/default/carnet/settle_carnet_parcel.rb +16 -0
  16. data/examples/{update_carnet_metadata.rb → default/carnet/update_carnet_metadata.rb} +1 -1
  17. data/examples/{update_parcel.rb → default/carnet/update_parcel.rb} +1 -1
  18. data/examples/{all_in_one.rb → default/charge/all_in_one.rb} +2 -2
  19. data/examples/{cancel_charge.rb → default/charge/cancel_charge.rb} +1 -1
  20. data/examples/{charge_link.rb → default/charge/charge_link.rb} +1 -1
  21. data/examples/{create_billet_payment.rb → default/charge/create_billet_payment.rb} +3 -3
  22. data/examples/{create_card_payment.rb → default/charge/create_card_payment.rb} +2 -2
  23. data/examples/{create_charge.rb → default/charge/create_charge.rb} +1 -1
  24. data/examples/default/charge/create_charge_balance_sheet.rb +80 -0
  25. data/examples/{create_charge_history.rb → default/charge/create_charge_history.rb} +1 -1
  26. data/examples/default/charge/create_charge_onestep.rb +36 -0
  27. data/examples/default/charge/create_charge_onestep_creditcard.rb +45 -0
  28. data/examples/{detail_charge.rb → default/charge/detail_charge.rb} +1 -1
  29. data/examples/{resend_billet.rb → default/charge/resend_billet.rb} +1 -1
  30. data/examples/default/charge/settle_charge.rb +15 -0
  31. data/examples/{update_billet.rb → default/charge/update_billet.rb} +1 -1
  32. data/examples/{update_charge_link.rb → default/charge/update_charge_link.rb} +1 -1
  33. data/examples/{update_charge_metadata.rb → default/charge/update_charge_metadata.rb} +1 -1
  34. data/examples/default/marketplace/create_charge_onestep_billet_marketplace.rb +45 -0
  35. data/examples/default/marketplace/create_charge_onestep_creditcard_marketplace.rb +54 -0
  36. data/examples/{get_notification.rb → default/notification/get_notification.rb} +1 -1
  37. data/examples/{get_installments.rb → default/others/get_installments.rb} +1 -1
  38. data/examples/{cancel_subscription.rb → default/subscriptions/cancel_subscription.rb} +1 -1
  39. data/examples/{create_plan.rb → default/subscriptions/create_plan.rb} +1 -1
  40. data/examples/{create_subscription.rb → default/subscriptions/create_subscription.rb} +1 -1
  41. data/examples/default/subscriptions/create_subscription_history.rb +19 -0
  42. data/examples/{create_subscription_payment.rb → default/subscriptions/create_subscription_payment.rb} +2 -2
  43. data/examples/{delete_plan.rb → default/subscriptions/delete_plan.rb} +1 -1
  44. data/examples/{detail_subscription.rb → default/subscriptions/detail_subscription.rb} +1 -1
  45. data/examples/{get_plans.rb → default/subscriptions/get_plans.rb} +1 -1
  46. data/examples/default/subscriptions/update_plan.rb +19 -0
  47. data/examples/{update_subscription_metadata.rb → default/subscriptions/update_subscription_metadata.rb} +1 -1
  48. data/examples/gn/account/pix_detail_balance.rb +16 -0
  49. data/examples/gn/account/pix_detail_settings.rb +17 -0
  50. data/examples/gn/account/pix_update_settings.rb +33 -0
  51. data/examples/gn/key/pix_create_evp.rb +17 -0
  52. data/examples/gn/key/pix_delete_evp.rb +20 -0
  53. data/examples/gn/key/pix_list_evp.rb +16 -0
  54. data/examples/pix/charge/pix_create_charge.rb +35 -0
  55. data/examples/pix/charge/pix_create_immediate_charge.rb +31 -0
  56. data/examples/pix/charge/pix_detail_charge.rb +21 -0
  57. data/examples/pix/charge/pix_list_charges.rb +21 -0
  58. data/examples/pix/charge/pix_update_charge.rb +26 -0
  59. data/examples/pix/location/pix_create_location.rb +20 -0
  60. data/examples/pix/location/pix_detail_location.rb +20 -0
  61. data/examples/pix/location/pix_generate_qrcode.rb +26 -0
  62. data/examples/pix/location/pix_list_location.rb +21 -0
  63. data/examples/pix/location/pix_unset_txid.rb +21 -0
  64. data/examples/pix/pix/pix_detail.rb +20 -0
  65. data/examples/pix/pix/pix_detail_devolution.rb +22 -0
  66. data/examples/pix/pix/pix_devolution.rb +27 -0
  67. data/examples/pix/pix/pix_list_received.rb +21 -0
  68. data/examples/pix/pix/pix_send.rb +27 -0
  69. data/examples/pix/webhooks/pix_config_webhook.rb +28 -0
  70. data/examples/pix/webhooks/pix_delete_webhook.rb +22 -0
  71. data/examples/pix/webhooks/pix_detail_webhook.rb +21 -0
  72. data/examples/pix/webhooks/pix_list_webhook.rb +22 -0
  73. data/gerencianet.gemspec +1 -1
  74. data/lib/gerencianet/constants.rb +263 -133
  75. data/lib/gerencianet/endpoints.rb +73 -20
  76. data/lib/gerencianet/status.rb +0 -0
  77. data/lib/gerencianet/version.rb +1 -1
  78. metadata +102 -67
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b74e7cdcdba62973e7773d06ed8c48b62a832e3a
4
- data.tar.gz: 53cbaf2abd0aa2509ffdc21becbee395ad41ca10
2
+ SHA256:
3
+ metadata.gz: b9e676e9448c9561ef82f570d1f0b05a85e5cb1900425596e8cb38b088ecc103
4
+ data.tar.gz: c413d4e46ae743d52e6600e1ded91bde8d4f715ab142d9f32f7f5b56c20d6fd2
5
5
  SHA512:
6
- metadata.gz: 716b5b99d2a9b1851717476d107aa14454ff3cb9968e5cf99b3ddb5f12903ad2bf51daba4230275c9c4736c3dafb36f16a51c69fc10d6bf0ab3d1600325d427b
7
- data.tar.gz: a312aacd012b93db6ebf55feb2c47f750b21d47876d76665c3b19e202edf77bd2cf16f95232a5bb8cd854050e7cc47fd555b1558f42b276448375a4557be7229
6
+ metadata.gz: 1b53928ac0f0cbadc29ce575d0f58ad8bd41c67fef63ff514b03ae4738ea679ab0f1ecd2c273a36a721391797cdd6156bb1f42eb6a04aef2e540e1fce268ec5c
7
+ data.tar.gz: 6d29b6c00633b04939391d3b3cd9395d0faf7f933c0d488fc11810523f66ae7b66fcf15b73e01dab0b01d71e29947c1aba09aae862d298c9e24d4630a6e10d95
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.0
4
- before_install: gem install bundler -v 1.10.6
3
+ - 2.6.6
4
+ before_install: gem install bundler -v 1.17.2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,26 @@
1
+ # 1.0.0
2
+
3
+ - Added: API Pix endpoints
4
+
5
+ # 0.0.15
6
+
7
+ - Added: new endpoint (one step)
8
+
9
+ # 0.0.14
10
+
11
+ - Added: new endpoint (settle charge)
12
+ - Added: new endpoint (settle carnet parcel)
13
+
14
+
15
+ # 0.0.13
16
+
17
+ - Added: new endpoint (create charge balance sheet)
18
+ - Updated: examples
19
+
20
+ # 0.0.12
21
+
22
+ - Updated: dependencies
23
+
1
24
  # 0.0.11
2
25
 
3
26
  - Added: new endpoint (update plan)
data/README.md CHANGED
@@ -29,7 +29,7 @@ $ gem install gerencianet
29
29
  ```
30
30
  ## Tested with
31
31
  ```
32
- ruby 2.1.0
32
+ ruby 2.6.6
33
33
  ```
34
34
  ## Basic usage
35
35
 
@@ -37,9 +37,9 @@ ruby 2.1.0
37
37
  require "gerencianet"
38
38
 
39
39
  options = {
40
- client_id: "client_id",
41
- client_secret: "client_secret",
42
- sandbox: true
40
+ client_id: CREDENTIALS::CLIENT_ID,
41
+ client_secret: CREDENTIALS::CLIENT_SECRET,
42
+ sandbox: CREDENTIALS::SANDBOX
43
43
  }
44
44
 
45
45
  gerencianet = Gerencianet.new(options)
File without changes
File without changes
@@ -1,5 +1,7 @@
1
1
  # example
2
2
  module CREDENTIALS
3
- CLIENT_ID = "Client_Id_a65082b30bb1e56e683bb5efe3bf9c09a3e359f8"
4
- CLIENT_SECRET = "Client_Secret_e7afbc13b6a533e6c0aced4b7b529f5c687060d4"
3
+ CLIENT_ID = "Client_Id"
4
+ CLIENT_SECRET = "Client_Secret"
5
+ PIX_CERT = "../../certs/developmentCertificate.pem"
6
+ SANDBOX = true
5
7
  end
@@ -1,10 +1,10 @@
1
1
  require "gerencianet"
2
- require_relative "./credentials"
2
+ require_relative "../../credentials"
3
3
 
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -5,7 +5,7 @@ require_relative "./credentials"
5
5
  options = {
6
6
  client_id: CREDENTIALS::CLIENT_ID,
7
7
  client_secret: CREDENTIALS::CLIENT_SECRET,
8
- sandbox: true
8
+ sandbox: CREDENTIALS::SANDBOX
9
9
  }
10
10
 
11
11
  tomorrow = Date.today + 1
@@ -20,7 +20,7 @@ body = {
20
20
  customer: {
21
21
  name: "Gorbadoc Oldbuck",
22
22
  email: "oldbuck@gerencianet.com.br",
23
- cpf: "04267484171",
23
+ cpf: "94271564656",
24
24
  birth: "1977-01-15",
25
25
  phone_number: "5144916523"
26
26
  },
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  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: CREDENTIALS::SANDBOX
8
+ }
9
+
10
+ params = {
11
+ id: 2363,
12
+ parcel: 1
13
+ }
14
+
15
+ gerencianet = Gerencianet.new(options)
16
+ puts gerencianet.settle_carnet_parcel(params: params)
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  charge = {
@@ -38,7 +38,7 @@ payment = {
38
38
  customer: {
39
39
  name: "Gorbadoc Oldbuck",
40
40
  email: "oldbuck@gerencianet.com.br",
41
- cpf: "04267484171",
41
+ cpf: "94271564656",
42
42
  birth: "1977-01-15",
43
43
  phone_number: "5144916523"
44
44
  }
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -5,7 +5,7 @@ require_relative "./credentials"
5
5
  options = {
6
6
  client_id: CREDENTIALS::CLIENT_ID,
7
7
  client_secret: CREDENTIALS::CLIENT_SECRET,
8
- sandbox: true
8
+ sandbox: CREDENTIALS::SANDBOX
9
9
  }
10
10
 
11
11
  expireAt = Date.today + 3
@@ -5,13 +5,13 @@ require_relative "./credentials"
5
5
  options = {
6
6
  client_id: CREDENTIALS::CLIENT_ID,
7
7
  client_secret: CREDENTIALS::CLIENT_SECRET,
8
- sandbox: true
8
+ sandbox: CREDENTIALS::SANDBOX
9
9
  }
10
10
 
11
11
  tomorrow = Date.today + 1
12
12
 
13
13
  params = {
14
- id: 2365
14
+ id: 553880
15
15
  }
16
16
 
17
17
  body = {
@@ -21,7 +21,7 @@ body = {
21
21
  customer: {
22
22
  name: "Gorbadoc Oldbuck",
23
23
  email: "oldbuck@gerencianet.com.br",
24
- cpf: "04267484171",
24
+ cpf: "94271564656",
25
25
  birth: "1977-01-15",
26
26
  phone_number: "5144916523"
27
27
  }
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  body = {
@@ -23,7 +23,7 @@ body = {
23
23
  customer: {
24
24
  name: "Gorbadoc Oldbuck",
25
25
  email: "oldbuck@gerencianet.com.br",
26
- cpf: "04267484171",
26
+ cpf: "94271564656",
27
27
  birth: "1977-01-15",
28
28
  phone_number: "5144916523"
29
29
  }
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  body = {
@@ -0,0 +1,80 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: CREDENTIALS::SANDBOX
8
+ }
9
+
10
+ params = {
11
+ id: 1000
12
+ }
13
+
14
+ body = {
15
+ title: "Balancete Demonstrativo",
16
+ body: [
17
+ {
18
+ header: "Demonstrativo de Consumo",
19
+ tables: [
20
+ {
21
+ rows: [
22
+ [
23
+ {
24
+ align: "left",
25
+ color: "#000000",
26
+ style: "bold",
27
+ text: "Exemplo de despesa",
28
+ colspan: 2
29
+ },
30
+ {
31
+ align: "left",
32
+ color: "#000000",
33
+ style: "bold",
34
+ text: "Total lançado",
35
+ colspan: 2
36
+ }
37
+ ],
38
+ [
39
+ {
40
+ align: "left",
41
+ color: "#000000",
42
+ style: "normal",
43
+ text: "Instalação",
44
+ colspan: 2
45
+ },
46
+ {
47
+ align: "left",
48
+ color: "#000000",
49
+ style: "normal",
50
+ text: "R$ 100,00",
51
+ colspan: 2
52
+ }
53
+ ]
54
+ ]
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ header: "Balancete Geral",
60
+ tables: [
61
+ {
62
+ rows: [
63
+ [
64
+ {
65
+ align: "left",
66
+ color: "#000000",
67
+ style: "normal",
68
+ text: "Confira na documentação da Gerencianet todas as configurações possíveis de um boleto balancete.",
69
+ colspan: 4
70
+ }
71
+ ]
72
+ ]
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ }
78
+
79
+ gerencianet = Gerencianet.new(options)
80
+ puts gerencianet.create_charge_balance_sheet(params: params, body: body)
@@ -4,7 +4,7 @@ require_relative "./credentials"
4
4
  options = {
5
5
  client_id: CREDENTIALS::CLIENT_ID,
6
6
  client_secret: CREDENTIALS::CLIENT_SECRET,
7
- sandbox: true
7
+ sandbox: CREDENTIALS::SANDBOX
8
8
  }
9
9
 
10
10
  params = {
@@ -0,0 +1,36 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: CREDENTIALS::SANDBOX
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
+ payment: {
21
+ banking_billet: {
22
+ expire_at: tomorrow.strftime,
23
+ customer: {
24
+ name: "Gorbadoc Oldbuck",
25
+ email: "oldbuck@gerencianet.com.br",
26
+ cpf: "94271564656",
27
+ birth: "1977-01-15",
28
+ phone_number: "5144916523"
29
+ }
30
+ }
31
+ }
32
+ }
33
+
34
+ gerencianet = Gerencianet.new(options)
35
+ puts gerencianet.create_charge_onestep(body: body)
36
+
@@ -0,0 +1,45 @@
1
+ require "gerencianet"
2
+ require_relative "./credentials"
3
+
4
+ options = {
5
+ client_id: CREDENTIALS::CLIENT_ID,
6
+ client_secret: CREDENTIALS::CLIENT_SECRET,
7
+ sandbox: CREDENTIALS::SANDBOX
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
+ payment: {
21
+ credit_card: {
22
+ installments: 1,
23
+ payment_token: "6426f3abd8688639c6772963669bbb8e0eb3c319",
24
+ billing_address: {
25
+ street: "Av. JK",
26
+ number: 909,
27
+ neighborhood: "Bauxita",
28
+ zipcode: "35400000",
29
+ city: "Ouro Preto",
30
+ state: "MG"
31
+ },
32
+ customer: {
33
+ name: "Gorbadoc Oldbuck",
34
+ email: "oldbuck@gerencianet.com.br",
35
+ cpf: "94271564656",
36
+ birth: "1977-01-15",
37
+ phone_number: "5144916523"
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ gerencianet = Gerencianet.new(options)
44
+ puts gerencianet.create_charge_onestep(body: body)
45
+