update order on paypal checkout

This commit is contained in:
Bounmy Stephane 2012-05-21 23:01:52 +02:00
parent fb852bc1b2
commit 9d2c8fda03
1 changed files with 6 additions and 7 deletions

View File

@ -178,18 +178,17 @@ module Spree
return unless (params[:state] == "payment")
return unless params[:order][:payments_attributes]
if params[:order][:coupon_code]
@order.update_attributes(object_params)
if @order.coupon_code.present?
if @order.update_attributes(object_params)
if params[:order][:coupon_code] and !params[:order][:coupon_code].blank? and @order.coupon_code.present?
fire_event('spree.checkout.coupon_code_added', :coupon_code => @order.coupon_code)
end
end
load_order
payment_method = Spree::PaymentMethod.find(params[:order][:payments_attributes].first[:payment_method_id])
if payment_method.kind_of?(Spree::BillingIntegration::PaypalExpress) || payment_method.kind_of?(Spree::BillingIntegration::PaypalExpressUk)
redirect_to paypal_payment_order_checkout_url(@order, :payment_method_id => payment_method)
redirect_to(paypal_payment_order_checkout_url(@order, :payment_method_id => payment_method.id)) and return
end
end
@ -199,7 +198,7 @@ module Spree
else
user_action = Spree::PaypalExpress::Config[:paypal_express_local_confirm] == "t" ? "continue" : "commit"
end
#asset_url doesn't like Spree::Config[:logo] being an absolute url
#if statement didn't work within hash
if URI.parse(Spree::Config[:logo]).absolute?
@ -214,7 +213,7 @@ module Spree
:background_color => "ffffff", # must be hex only, six chars
:header_background_color => "ffffff",
:header_border_color => "ffffff",
:header_image => chosen_image,
:header_image => chosen_image,
:allow_note => true,
:locale => user_locale,
:req_confirm_shipping => false, # for security, might make an option later