Created
December 16, 2011 16:20
-
-
Save sivabudh/1486685 to your computer and use it in GitHub Desktop.
PaypalExpressHelper#get_purchase_params
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
module PaypalExpressHelper | |
# ... other methods were implemented in the previous blog posts | |
def get_totals(cart) | |
# implemented in the previous blog posts | |
end | |
def to_cents(total) | |
# implemented in the previous blog posts | |
end | |
def get_items(cart) | |
# implemented in the previous blog posts | |
end | |
def get_purchase_params(cart, request, params) | |
subtotal, shipping, total = get_totals(cart) | |
return to_cents(total), { | |
:ip => request.remote_ip, | |
:token => params[:token], | |
:payer_id => params[:payer_id], | |
:subtotal => to_cents(subtotal), | |
:shipping => to_cents(shipping), | |
:handling => 0, | |
:tax => 0, | |
:items => get_items(cart), | |
} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment