There is a “known” PayPal partial refund bug in nopCommerce 3.50 version that has been reported by several nop users.
Issues (reported by users):
1) Anytime when a store admin issues a partial refund via PayPal, the nopCommerce dashboard automatically shows that the entire total amount has been refunded
2) The order notes does show the correct issued partial refund amount
3) The issue leads to incorrect profit / sales numbers because even the cancelled orders are there as a part of the sales / profit section in nopCommerce
public class PaymentPayPalStandardController -> public ActionResult IPNHandler() total = decimal.Parse(values["mc_gross"], new CultureInfo("en-US")); case PaymentStatus.Refunded: { if (_orderProcessingService.CanRefundOffline(order)) { _orderProcessingService.RefundOffline(order); } }
case PaymentStatus.Refunded: { if (order.OrderTotal == Math.Abs(total)) { if (_orderProcessingService.CanRefundOffline(order)) { _orderProcessingService.RefundOffline(order); } } else { if (_orderProcessingService.CanPartiallyRefundOffline(order, Math.Abs(total))) { _orderProcessingService.PartiallyRefundOffline(order, Math.Abs(total)); } } }
A complete fix (in respect of nopCommerce code) will be:
{ var totalToRefund = Math.Abs(mc_gross); if (totalToRefund > 0 && Math.Round(totalToRefund, 2).Equals(Math.Round(order.OrderTotal, 2))) { //refund if (_orderProcessingService.CanRefundOffline(order)) { _orderProcessingService.RefundOffline(order); } } else { //partial refund if (_orderProcessingService.CanPartiallyRefundOffline(order, totalToRefund)) { _orderProcessingService.PartiallyRefundOffline(order, totalToRefund); } } }
For a complete solution, please see the changeset: https://nopcommerce.codeplex.com/SourceControl/changeset/1e3b16cf3fe2af5d43f676af2bedf39f64a4e9aa
Looking for quality nopCommerce Web Hosting? Look no further than Arvixe Web Hosting!