Skip to content

Commit

Permalink
Merge pull request #3 from dmalberto/master
Browse files Browse the repository at this point in the history
Add new endpoint
  • Loading branch information
WhinterGoncalves authored Aug 29, 2019
2 parents dc9ad0a + f3f7aff commit 3415be6
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.0.15

- Added: new endpoint (one step)

# 0.0.14

- Added: new endpoint (settle charge)
Expand Down
36 changes: 36 additions & 0 deletions examples/create_charge_onestep.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require "gerencianet"
require_relative "./credentials"

options = {
client_id: CREDENTIALS::CLIENT_ID,
client_secret: CREDENTIALS::CLIENT_SECRET,
sandbox: true
}

body = {
items: [{
name: "Product 1",
value: 1000,
amount: 2
}],
shippings: [{
name: "Default Shipping Cost",
value: 100
}],
payment: {
banking_billet: {
expire_at: tomorrow.strftime,
customer: {
name: "Gorbadoc Oldbuck",
email: "[email protected]",
cpf: "04267484171",
birth: "1977-01-15",
phone_number: "5144916523"
}
}
}
}

gerencianet = Gerencianet.new(options)
puts gerencianet.create_charge_onestep(body: body)

45 changes: 45 additions & 0 deletions examples/create_charge_onestep_creditcard.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
require "gerencianet"
require_relative "./credentials"

options = {
client_id: CREDENTIALS::CLIENT_ID,
client_secret: CREDENTIALS::CLIENT_SECRET,
sandbox: true
}

body = {
items: [{
name: "Product 1",
value: 1000,
amount: 2
}],
shippings: [{
name: "Default Shipping Cost",
value: 100
}],
payment: {
credit_card: {
installments: 1,
payment_token: "6426f3abd8688639c6772963669bbb8e0eb3c319",
billing_address: {
street: "Av. JK",
number: 909,
neighborhood: "Bauxita",
zipcode: "35400000",
city: "Ouro Preto",
state: "MG"
},
customer: {
name: "Gorbadoc Oldbuck",
email: "[email protected]",
cpf: "94271564656",
birth: "1977-01-15",
phone_number: "5144916523"
}
}
}
}

gerencianet = Gerencianet.new(options)
puts gerencianet.create_charge_onestep(body: body)

4 changes: 4 additions & 0 deletions lib/gerencianet/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ module Constants
route: "/charge/:id/balance-sheet",
method: "post"
},
create_charge_onestep: {
route: "/charge/one-step",
method: "post"
},
settleCharge: {
route: '/charge/:id/settle',
method: 'put'
Expand Down
Empty file modified lib/gerencianet/endpoints.rb
100644 → 100755
Empty file.
Empty file modified lib/gerencianet/status.rb
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion lib/gerencianet/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# :nodoc:
module Gerencianet
VERSION = "0.0.14"
VERSION = "0.0.15"
end

0 comments on commit 3415be6

Please sign in to comment.