corrected credit amount to always be positive (PayPal does not accept negative credit amount)

Merges #47
This commit is contained in:
Chris Wise 2012-04-12 21:21:55 -04:00 committed by Ryan Bigg
parent f8e239e3c1
commit 11c8935aac
1 changed files with 2 additions and 1 deletions

View File

@ -26,8 +26,9 @@ class Spree::PaypalAccount < ActiveRecord::Base
authorization = find_capture(payment)
amount = payment.credit_allowed >= payment.order.outstanding_balance.abs ? payment.order.outstanding_balance : payment.credit_allowed
amount=amount.abs if amount
ppx_response = payment.payment_method.provider.credit(amount.nil? ? amount_in_cents(amount) : amount_in_cents(amount), authorization.params['transaction_id'])
ppx_response = payment.payment_method.provider.credit(amount.nil? ? amount_in_cents(amount) : amount_in_cents(amount), authorization.params['transaction_id'], :currency => payment.payment_method.preferred_currency)
if ppx_response.success?
record_log payment, ppx_response