README.rdoc

wepay-rails

Since Wepay uses Oauth2 to authenticate, wepay-rails has been built to
handle this for you. You will need to add a column to one of your models to
hold the authentication token. For example, if you have a user model:

When you include WepayRails::Payments, you get the controller actions you
need. For instance, initialize_wepay_access_token(auth_code) which
completes the Oauth2 handshake with Wepay and get's the access token
for future comunications with Wepay.

Finally, your checkout controller (or some controller that will interact
with the Wepay API):

class Purchase::CheckoutController < ApplicationController

before_filter :authenticate_account!
def index
if current_user.has_wepay_auth_code?
if wepay_access_token_exists?
# Send payment off to wepay or get the user or something else
render :json => gateway.wepay_user
return
else
initialize_wepay_access_token(current_user.wepay_auth_code)
end
else
redirect_to_wepay_for_auth
end
end
private
include WepayRails::Payments

end

First, we check to see if we have saved the auth code for the user, if so,
we next need to see if we have an Oauth2 access token. If not, we can
initialize the access token. If it is there, go ahead and make an api call
- the example above gets the wepay_user.

Contributing to wepay-rails

Check out the latest master to make sure the feature hasn't been
implemented or the bug hasn't been fixed yet

Check out the issue tracker to make sure someone already hasn't
requested it and/or contributed it

Fork the project

Start a feature/bugfix branch

Commit and push until you are happy with your contribution

Make sure to add tests for it. This is important so I don't break it in
a future version unintentionally.

Please try not to mess with the Rakefile, version, or history. If you want
to have your own version, or is otherwise necessary, that is fine, but
please isolate to its own commit so I can cherry-pick around it.