WC_Gateway_Paypal_IPN_Handler::payment_status_refunded()protectedWC 1.0

Handle a refunded order.

Method of the class: WC_Gateway_Paypal_IPN_Handler{}

No Hooks.

Return

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() code WC 8.7.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( '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'] )
		);
	}
}