Skip to content

Commit

Permalink
add: New examples onestep marketplace
Browse files Browse the repository at this point in the history
add: New examples onestep marketplace
  • Loading branch information
WhinterGoncalves authored Sep 24, 2019
2 parents 3415be6 + 8860415 commit 3d58610
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 0 deletions.
45 changes: 45 additions & 0 deletions examples/create_charge_onestep_billet_marketplace.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,
marketplace: {
repasses: [{
payee_code: "Insira_aqui_o_indentificador_da_conta_destino",
percentage: 2500
}, {
payee_code: "Insira_aqui_o_indentificador_da_conta_destino",
percentage: 1500
}]
}
}],
shippings: [{
name: "Default Shipping Cost",
value: 100
}],
payment: {
banking_billet: {
expire_at: '2020-09-09',
customer: {
name: "Gorbadoc Oldbuck",
email: "oldbuck@gerencianet.com.br",
cpf: "04267484171",
birth: "1977-01-15",
phone_number: "5144916523"
}
}
}
}

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

54 changes: 54 additions & 0 deletions examples/create_charge_onestep_creditcard_marketplace.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
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,
marketplace: {
repasses: [{
payee_code: "Insira_aqui_o_indentificador_da_conta_destino",
percentage: 2500
}, {
payee_code: "Insira_aqui_o_indentificador_da_conta_destino",
percentage: 1500
}]
}
}],
shippings: [{
name: "Default Shipping Cost",
value: 100
}],
payment: {
credit_card: {
installments: 1,
payment_token: "InsiraAquiOPayment_token",
billing_address: {
street: "Av. JK",
number: 909,
neighborhood: "Bauxita",
zipcode: "35400000",
city: "Ouro Preto",
state: "MG"
},
customer: {
name: "Gorbadoc Oldbuck",
email: "oldbuck@gerencianet.com.br",
cpf: "94271564656",
birth: "1977-01-15",
phone_number: "5144916523"
}
}
}
}

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

0 comments on commit 3d58610

Please sign in to comment.