allow for preferred currency

This commit is contained in:
vintem 2011-07-12 22:26:53 -03:00
parent 5340cdb907
commit ec356cf5e8
3 changed files with 3 additions and 2 deletions

View File

@ -217,7 +217,7 @@ CheckoutController.class_eval do
# hook to override paypal site options # hook to override paypal site options
def paypal_site_opts def paypal_site_opts
{} {:currency => payment_method.preferred_currency}
end end
def order_opts(order, payment_method, stage) def order_opts(order, payment_method, stage)

View File

@ -4,6 +4,7 @@ class BillingIntegration::PaypalExpress < BillingIntegration
preference :signature, :string preference :signature, :string
preference :review, :boolean, :default => false preference :review, :boolean, :default => false
preference :no_shipping, :boolean, :default => false preference :no_shipping, :boolean, :default => false
preference :currency, :string, :default => 'USD'
def provider_class def provider_class
ActiveMerchant::Billing::PaypalExpressGateway ActiveMerchant::Billing::PaypalExpressGateway

View File

@ -8,7 +8,7 @@ class PaypalAccount < ActiveRecord::Base
def capture(payment) def capture(payment)
authorization = find_authorization(payment) authorization = find_authorization(payment)
ppx_response = payment.payment_method.provider.capture((100 * payment.amount).to_i, authorization.params["transaction_id"]) ppx_response = payment.payment_method.provider.capture((100 * payment.amount).to_i, authorization.params["transaction_id"], :currency => payment.payment_method.preferred_currency)
if ppx_response.success? if ppx_response.success?
record_log payment, ppx_response record_log payment, ppx_response
payment.complete payment.complete