WC_Gateway_Paypal_IPN_Handler::payment_status_refunded
Handle a refunded order.
Method of the class: WC_Gateway_Paypal_IPN_Handler{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->payment_status_refunded( $order, $posted );
- $order(WC_Order) (required)
- Order object.
- $posted(array) (required)
- Posted data.
WC_Gateway_Paypal_IPN_Handler::payment_status_refunded() WC Gateway Paypal IPN Handler::payment status refunded code WC 10.5.0
protected function payment_status_refunded( $order, $posted ) {
// Only handle full refunds, not partial.
if ( $order->get_total() === wc_format_decimal( $posted['mc_gross'] * -1, wc_get_price_decimals() ) ) {
/* translators: %s: payment status. */
$order->update_status( OrderStatus::REFUNDED, sprintf( __( 'Payment %s via IPN.', 'woocommerce' ), strtolower( $posted['payment_status'] ) ) );
$this->send_ipn_email_notification(
/* translators: %s: order link. */
sprintf( __( 'Payment for order %s refunded', 'woocommerce' ), '<a class="link" href="' . esc_url( $order->get_edit_order_url() ) . '">' . $order->get_order_number() . '</a>' ),
/* translators: %1$s: order ID, %2$s: reason code. */
sprintf( __( 'Order #%1$s has been marked as refunded - PayPal reason code: %2$s', 'woocommerce' ), $order->get_order_number(), $posted['reason_code'] )
);
}
}