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,9 +178,8 @@ 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
@ -189,7 +188,7 @@ module Spree
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