So can anyone tell if I'm on the right path?
I've taken a look at the PayAPI and found out that their doRefund
method can take a 'Full' type but the AM code has it hardcoded to
'Partial'. I've modified the paypal_common_api to change type to be
'Full' and remove 'Amount' from the xml if the money passed in was
nil. Here's my patch:
==============================
--- a/vendor/plugins/active_merchant/lib/active_merchant/billing/
gateways/paypal/paypal_common_api.rb
+++ b/vendor/plugins/active_merchant/lib/active_merchant/billing/
gateways/paypal/paypal_common_api.rb
@@ -147,8 +147,12 @@ module ActiveMerchant #:nodoc:
xml.tag! 'RefundTransactionRequest', 'xmlns:n2' =>
EBAY_NAMESPACE do
xml.tag! 'n2:Version', API_VERSION
xml.tag! 'TransactionID', identification
- xml.tag! 'Amount', amount(money), 'currencyID' => options
[:currency] || currency(money)
- xml.tag! 'RefundType', 'Partial'
+ if money.nil?
+ xml.tag! 'RefundType', 'Full'
+ else
+ xml.tag! 'Amount', amount(money), 'currencyID' =>
options[:currency] || currency(money)
+ xml.tag! 'RefundType', 'Partial'
+ end
xml.tag! 'Memo', options[:note] unless options
[:note].blank?
end
end
==============================
PayPal seems to be able to accept the request and returns a response
to me.