moshbitten / paypal_permissions Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
This is my get access token:
def get_access_token
dispute = Dispute.find(session[:id])
request_token = session[:request_token]
verifier = session[:request_token_verifier]
paypal_response = ::PAYPAL_PERMISSIONS_GATEWAY.get_access_token request_token, verifier
p paypal_response.inspect
if paypal_response[:ack] == 'Success'
#dispute.order.payment.update_attributes({
#:ppp_access_token => paypal_response[:token],
#:ppp_access_token_verifier => paypal_response[:tokenSecret],
#})
puts "Right"
else
puts "Wrong"
end
end
I get in my log:
{:raw_response=>
\"responseEnvelope.timestamp=2012-09-23T06%3A47%3A54.432-07%3A00&responseEnvelope.a
ck=Failure&responseEnvelope.correlationId=afcab8b125dcc&responseEnvelope.build=2210301&error(0).errorId=520002&error(0).domain=PLATFORM&error(0).subdomain=Application&error
(0).severity=Error&error(0).category=Application&error(0).message=Internal+Error\", :errors=>
[{:parameters=>[], :error_id=>\"520002\", :domain=>\"PLATFORM\", :subdomain=>\"Application\",
:severity=>\"Error\", :category=>\"Application\", :message=>\"Internal Error\"}], :timestamp=>
\"2012-09-23T06:47:54.432-07:00\", :ack=>\"Failure\", :correlation_id=>\"afcab8b125dcc\"}"
I can see that on the seller paypal account has granted permissions correctly to my application.
why this error when I get back to my application, if the seller has granted permissions correctly
Ok the error was in my response_permissions_callback method.
I had:
def response_permissions_callback
dispute = Dispute.find(session[:id])
get_access_token
session[:request_token_verifier] = params[:verification_code]
redirect_to show_seller_user_dispute_url(current_user, dispute)
end
The correct way is:
def response_permissions_callback
dispute = Dispute.find(session[:id])
session[:request_token_verifier] = params[:verification_code]
get_access_token
redirect_to show_seller_user_dispute_url(current_user, dispute)
end
Thank you very much!
get_basic_personal_data is working fine on sandbox but on live mode when I try:
data = ::PAYPAL_PERMISSIONS_GATEWAY.get_basic_personal_data(access_token, verifier)
I get on my log this error:
Processing by UsersController#response_permissions_callback as HTML
Parameters: {"request_token"=>"AAAAAAGvyQk7DZKPze4L", "verification_code"=>"PGG4zCWrNtXaYksWWQqojw", "locale"=>"es", "id"=>"juan-dot-ardila-dot-serrano"}
Completed 500 Internal Server Error in 1219ms
ActiveMerchant::ResponseError (Failed with 302 Moved Temporarily):
Can someone explain why the sandbox is working properly and does not work in live mode?
thanks
Hi there,
Good work on the PayPal Permissions gem.
I'm using the X-PP-AUTHORIZATION header in ActiveMerchant, i'm guessing a few other people are also.
Any chance of getting x_pp_authorization.rb from this project moved into ActiveMerchant? It's a useful + generic piece of code, I feel it should belong there instead given it's multi-library benefit.
Jason
First - thank you for this gem.
Sorry, that I'm writing here, but I'm messing a lot with this and need some help.
I want get_basic_personal_data for existing merchant, but I constantly get
undefined local variable or method `required_params' for #<#Class:0x5e48b78:0x5e4b668>
I tried to include modules, but failed.
Can you help me with this ?
When I try use the method get_basic_personal_data I get this error in log:
"{:raw_response=>
\"responseEnvelope.timestamp=2012-09-26T13%3A13%3A48.334-07%3A00&responseEnvelope.a
ck=Failure&responseEnvelope.correlationId=fff93a856c53d&responseEnvelope.build=2210301&err
or(0).errorId=520003&error(0).domain=PLATFORM&error(0).subdomain=Application&error
(0).severity=Error&error(0).category=Application&error(0).message=Authentication+failed.+API
+credentials+are+incorrect.\", :errors=>[{:parameters=>[], :error_id=>\"520003\", :domain=>
\"PLATFORM\", :subdomain=>\"Application\", :severity=>\"Error\", :category=>\"Application\",
:message=>\"Authentication failed. API credentials are incorrect.\"}], :personal_data=>{},
:timestamp=>\"2012-09-26T13:13:48.334-07:00\", :ack=>\"Failure\", :correlation_id=>\"fff93a856c53d
\"}"
However the other methods is working fine and my Api credentials are correct on my env files.
These are my methods on my controller:
def request_permissions_callback
callback_url = URI.encode(response_permissions_callback_user_url(current_user))
permissions = 'REFUND, ACCESS_BASIC_PERSONAL_DATA'
paypal_response = ::PAYPAL_PERMISSIONS_GATEWAY.request_permissions callback_url,
permissions
if paypal_response[:ack] == 'Success'
session[:id] = current_user.id
request_token = paypal_response[:token]
session[:request_token] = request_token
url = ::PAYPAL_PERMISSIONS_GATEWAY.redirect_user_to_paypal_url(request_token)
redirect_to url
else
#render :text => paypal_response.inspect
# handle error
format.html { redirect_to requirements_to_sell_user_path(current_user), alert: t
(".permissions_wrong") }
end
end
def response_permissions_callback
session[:request_token_verifier] = params[:verification_code]
get_access_token
respond_to do |format|
if get_access_token == true
format.html { redirect_to requirements_to_sell_user_path(current_user), notice: t
(".refund_permissions_success") }
elsif get_access_token == false
format.html { redirect_to requirements_to_sell_user_path(current_user), alert: t
(".refund_permissions_wrong") }
end
end
end
def get_access_token
request_token = session[:request_token]
verifier = session[:request_token_verifier]
paypal_response = ::PAYPAL_PERMISSIONS_GATEWAY.get_access_token request_token,
verifier
if paypal_response[:ack] == 'Success'
current_user.update_attributes({
:ppp_access_token => paypal_response[:token],
:ppp_access_token_verifier => paypal_response[:token_secret],
})
p get_basic_personal_data(current_user).inspect
return true
else
return false
end
end
def get_basic_personal_data(current_user)
access_token = current_user.ppp_access_token
verifier = current_user.ppp_access_token_verifier
::PAYPAL_PERMISSIONS_GATEWAY.get_basic_personal_data(access_token, verifier)
end
Thank you very much!
please add LICENSE file or a section in the readme.
Just found your code yesterday.
I didn't know how else to contact you except through an issue. I think you are doing the encoding of strings different than the SDK from PayPal and when I extract your code I seem to fail to get a valid authorization header to make my own call to GetBasicPersonalData with my own http call. I don't need your full gem since I am not using ActiveMerchant.
So my question, is this working to make authorized calls to get personal data? Would you have time to answer some questions?
Thanks
You can check with version activemerchant 1.2.9 and this catch a
undefined method key
on action
request_permissions_callback
With active merchant 1.2.6 is working fine.
Thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.