fixed correct tax amount display on PayPal site, tax and shipping
displayed seperately TODO: tax should be set differently joshnuss: fixed logo image url passed to paypal joshnuss: logo image should use Spree::Config setting joshnuss: save bill address during checkout if it is empty schustafa: Product descriptions can be nil without disrupting checkout.
This commit is contained in:
parent
5b88f63f6e
commit
228e341e58
|
@ -88,6 +88,7 @@ CheckoutController.class_eval do
|
|||
order_ship_address.save!
|
||||
|
||||
@order.ship_address = order_ship_address
|
||||
@order.bill_address = order_ship_address unless @order.bill_address
|
||||
end
|
||||
@order.save
|
||||
|
||||
|
@ -201,7 +202,7 @@ CheckoutController.class_eval do
|
|||
{ :description => "Goods from #{Spree::Config[:site_name]}", # site details...
|
||||
|
||||
#:page_style => "foobar", # merchant account can set named config
|
||||
:header_image => "https://#{Spree::Config[:site_name]}/images/logo.png",
|
||||
:header_image => "https://#{Spree::Config[:site_url]}#{Spree::Config[:logo]}",
|
||||
:background_color => "ffffff", # must be hex only, six chars
|
||||
:header_background_color => "ffffff",
|
||||
:header_border_color => "ffffff",
|
||||
|
@ -225,7 +226,7 @@ CheckoutController.class_eval do
|
|||
items = order.line_items.map do |item|
|
||||
price = (item.price * 100).to_i # convert for gateway
|
||||
{ :name => item.variant.product.name,
|
||||
:description => item.variant.product.description[0..120],
|
||||
:description => (item.variant.product.description[0..120] if item.variant.product.description),
|
||||
:sku => item.variant.sku,
|
||||
:quantity => item.quantity,
|
||||
:amount => price,
|
||||
|
@ -262,6 +263,8 @@ CheckoutController.class_eval do
|
|||
:shipping => ((order.adjustments.map { |a| a.amount if a.source_type == 'Shipment' }.compact.sum) * 100 ).to_i,
|
||||
:money => (order.total * 100 ).to_i }
|
||||
|
||||
# add correct tax amount by subtracting subtotal and shipping otherwise tax = 0 -> need to check adjustments.map
|
||||
opts[:tax] = (order.total*100).to_i - opts.slice(:subtotal, :shipping).values.sum
|
||||
|
||||
if stage == "checkout"
|
||||
opts[:handling] = 0
|
||||
|
|
Loading…
Reference in New Issue