Skip to content

Instantly share code, notes, and snippets.

@sivabudh
Created December 16, 2011 16:20
Show Gist options
  • Save sivabudh/1486685 to your computer and use it in GitHub Desktop.
Save sivabudh/1486685 to your computer and use it in GitHub Desktop.
PaypalExpressHelper#get_purchase_params
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