Partial Refund in PayPal Direct - 2.0

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anos atrás
Is this working in 2.0?  The button shows offline, but the modal opens with a refund option.  I looked at the plugin and see it returns false on the Partial Refund property.
12 anos atrás
So in nop 2.0 partial refunds are not in there.  This was an easy fix:

In the PayPalDirectPaymentProcessor.cs file, return true in the SupportPartiallyRefund method.

In the Refund method, I set a boolean at the beginning to capture if its a partial refund:

bool isPartialRefund = refundPaymentRequest.IsPartialRefund;


In the Refund method, where they set RefundType to RefundType.Full replace it with:

if (isPartialRefund)
            {
                req.RefundTransactionRequest.RefundType = RefundType.Partial;
                BasicAmountType amt = new BasicAmountType();
                amt.Value = refundPaymentRequest.AmountToRefund.ToString();
                amt.currencyID = CurrencyCodeType.USD;
                req.RefundTransactionRequest.Amount = amt;
            }
            else
                req.RefundTransactionRequest.RefundType = RefundType.Full;


In the Refund method, where they check for a Success response replace with:

if (Success)
                {
                    if (isPartialRefund)
                        result.NewPaymentStatus = PaymentStatus.PartiallyRefunded;
                    else
                        result.NewPaymentStatus = PaymentStatus.Refunded;
                    //cancelPaymentResult.RefundTransactionID = response.RefundTransactionID;
                }
                else
                {
                    result.AddError(error);
                }
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.