Ignore partial refunds. Closes #735.

This commit is contained in:
Mike Jolley 2012-03-14 13:50:14 +00:00
parent acb8f14e99
commit ec5d592155
1 changed files with 18 additions and 0 deletions

View File

@ -521,6 +521,24 @@ class WC_Paypal extends WC_Payment_Gateway {
$order->update_status('failed', sprintf(__('Payment %s via IPN.', 'woocommerce'), strtolower($posted['payment_status']) ) );
break;
case "refunded" :
// Only handle full refunds, not partial
if ($order->get_order_total() == ($posted['mc_gross']*-1)) {
// Mark order as refunded
$order->update_status('refunded', sprintf(__('Payment %s via IPN.', 'woocommerce'), strtolower($posted['payment_status']) ) );
$message = woocommerce_mail_template(
__('Order refunded/reversed', 'woocommerce'),
sprintf(__('Order #%s has been marked as refunded - PayPal reason code: %s', 'woocommerce'), $order->id, $posted['reason_code'] )
);
// Send the mail
woocommerce_mail( get_option('woocommerce_new_order_email_recipient'), sprintf(__('Payment for order #%s refunded/reversed', 'woocommerce'), $order->id), $message );
}
break;
case "reversed" :
case "chargeback" :