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);
}