WC_Gateway_Paypal_IPN_Handler::validate_currency()protectedWC 1.0

Check currency from IPN matches the 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->validate_currency( $order, $currency );
$order(WC_Order) (required)
Order object.
$currency(string) (required)
Currency code.

WC_Gateway_Paypal_IPN_Handler::validate_currency() code WC 8.7.0

protected function validate_currency( $order, $currency ) {
	if ( $order->get_currency() !== $currency ) {
		WC_Gateway_Paypal::log( 'Payment error: Currencies do not match (sent "' . $order->get_currency() . '" | returned "' . $currency . '")' );

		/* translators: %s: currency code. */
		$order->update_status( 'on-hold', sprintf( __( 'Validation error: PayPal currencies do not match (code %s).', 'woocommerce' ), $currency ) );
		exit;
	}
}