Skip to content

Instantly share code, notes, and snippets.

@sivabudh
Created November 17, 2011 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivabudh/1372301 to your computer and use it in GitHub Desktop.
Save sivabudh/1372301 to your computer and use it in GitHub Desktop.
PaypalExpressHelper#get_order_info
module PaypalExpressHelper
def get_setup_purchase_params(cart, request)
# implemented in the previous blog post
end
def get_order_info(gateway_response, cart)
subtotal, shipping, total = get_totals(cart)
{
shipping_address: gateway_response.address,
email: gateway_response.email,
name: gateway_response.name,
gateway_details: {
:token => gateway_response.token,
:payer_id => gateway_response.payer_id,
},
subtotal: subtotal,
shipping: shipping,
total: total,
}
end
def get_shipping(cart)
# define your own shipping calculation rules here
end
def get_items(cart)
# implemented in the previous blog post
end
def get_totals(cart)
# implemented in the previous blog post
end
def to_cents(money)
# implemented in the previous blog post
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment