Made review configuration option editable via admin ui
This commit is contained in:
parent
472321b53d
commit
bad727bf9c
|
@ -2,6 +2,7 @@ class BillingIntegration::PaypalExpress < BillingIntegration
|
||||||
preference :login, :string
|
preference :login, :string
|
||||||
preference :password, :password
|
preference :password, :password
|
||||||
preference :signature, :string
|
preference :signature, :string
|
||||||
|
preference :review, :boolean, :default => false
|
||||||
|
|
||||||
def provider_class
|
def provider_class
|
||||||
ActiveMerchant::Billing::PaypalExpressGateway
|
ActiveMerchant::Billing::PaypalExpressGateway
|
||||||
|
|
|
@ -2,6 +2,7 @@ class BillingIntegration::PaypalExpressUk < BillingIntegration
|
||||||
preference :login, :string
|
preference :login, :string
|
||||||
preference :password, :password
|
preference :password, :password
|
||||||
preference :signature, :string
|
preference :signature, :string
|
||||||
|
preference :review, :boolean, :default => false
|
||||||
|
|
||||||
def provider_class
|
def provider_class
|
||||||
ActiveMerchant::Billing::PaypalExpressUkGateway
|
ActiveMerchant::Billing::PaypalExpressUkGateway
|
||||||
|
|
|
@ -16,7 +16,7 @@ module Spree::PaypalExpress
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to (gateway.redirect_url_for response.token, :review => review)
|
redirect_to (gateway.redirect_url_for response.token, :review => payment_method.preferred_review)
|
||||||
end
|
end
|
||||||
|
|
||||||
def paypal_payment
|
def paypal_payment
|
||||||
|
@ -32,7 +32,7 @@ module Spree::PaypalExpress
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to (gateway.redirect_url_for response.token, :review => review)
|
redirect_to (gateway.redirect_url_for response.token, :review => payment_method.preferred_review)
|
||||||
end
|
end
|
||||||
|
|
||||||
def paypal_confirm
|
def paypal_confirm
|
||||||
|
@ -77,7 +77,7 @@ module Spree::PaypalExpress
|
||||||
@order.checkout.ship_address = order_ship_address
|
@order.checkout.ship_address = order_ship_address
|
||||||
@order.checkout.save
|
@order.checkout.save
|
||||||
|
|
||||||
if review
|
if payment_method.preferred_review
|
||||||
render :partial => "shared/paypal_express_confirm", :layout => true
|
render :partial => "shared/paypal_express_confirm", :layout => true
|
||||||
else
|
else
|
||||||
paypal_finish
|
paypal_finish
|
||||||
|
@ -318,17 +318,11 @@ module Spree::PaypalExpress
|
||||||
end
|
end
|
||||||
|
|
||||||
# create the gateway from the supplied options
|
# create the gateway from the supplied options
|
||||||
def paypal_gateway
|
def payment_method
|
||||||
integration = PaymentMethod.find(params[:payment_method_id])
|
PaymentMethod.find(params[:payment_method_id])
|
||||||
gateway = integration.provider
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# if you want to confirm the order on Paypal's site, then this needs to return false
|
def paypal_gateway
|
||||||
def review
|
payment_method.provider
|
||||||
if Spree::Config[:paypal_express_review].nil?
|
|
||||||
true
|
|
||||||
else
|
|
||||||
Spree::Config[:paypal_express_review] == "t" ? true : false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue