Last active
August 29, 2015 14:16
-
-
Save TiagoTi/98e46d685a95f4977a21 to your computer and use it in GitHub Desktop.
Configuração PagSeguro Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I18n.locale='pt-BR' | |
PagSeguro.configure do |c| | |
c.token= 'X89X78XX72034XX7XXXC6X73X146978X' | |
c.email= 'xxxxxx@xxxxxx.xxx.xx' | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ENV['PagSeguroToken']= 'X89X78XX72034XX7XXXC6X73X146978X' | |
ENV['PagSeguroEmail']= 'xxxxxx@xxxxxx.xxx.xx' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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