Skip to content

Instantly share code, notes, and snippets.

@TiagoTi
Last active August 29, 2015 14:16
Show Gist options
  • Save TiagoTi/98e46d685a95f4977a21 to your computer and use it in GitHub Desktop.
Save TiagoTi/98e46d685a95f4977a21 to your computer and use it in GitHub Desktop.
Configuração PagSeguro Ruby
I18n.locale='pt-BR'
PagSeguro.configure do |c|
c.token= 'X89X78XX72034XX7XXXC6X73X146978X'
c.email= 'xxxxxx@xxxxxx.xxx.xx'
end
RuntimeError in CheckoutController#create
Unauthorized
Extracted source (around line #47):
if response.errors.any?
raise response.errors.join("\n")
else
redirect_to response.url
end
def create
@payment = PagSeguro::PaymentRequest.new
@payment.abandon_url = abandon_url
@payment.notification_url = notification_url
@payment.redirect_url = redirect_url
@payment.items << { id:1, description:'@plan.name', amount:0.01, weight:0 }
@payment.reference = 1
@payment.sender={ name:'client test',
email: 'test@cliente.com',
phone:{area_code:'12', number:'12341234'}
}
puts "=> REQUEST"
response = @payment.register
if response.errors.any?
raise response.errors.join("\n") #47
else
redirect_to response.url
end
end
end
ENV['PagSeguroToken']= 'X89X78XX72034XX7XXXC6X73X146978X'
ENV['PagSeguroEmail']= 'xxxxxx@xxxxxx.xxx.xx'
def create
@payment = PagSeguro::PaymentRequest.new
@payment.token = ENV['PagSeguroToken']
@payment.email = ENV['PagSeguroEmail']
@payment.abandon_url = abandon_url
@payment.notification_url = notification_url
@payment.redirect_url = redirect_url
@payment.items << { id:1, description:'@plan.name', amount:0.01, weight:0 }
@payment.reference = 1
@payment.sender={ name:'client test',
email: 'test@cliente.com',
phone:{area_code:'12', number:'12341234'}
}
puts "=> REQUEST"
response = @payment.register
if response.errors.any?
raise response.errors.join("\n") #47
else
redirect_to response.url
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment