WC_Gateway_Paypal_IPN_Handler::validate_currency()protectedWC 1.0

Check currency from IPN matches the order.

Метод класса: WC_Gateway_Paypal_IPN_Handler{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->validate_currency( $order, $currency );
$order(WC_Order) (обязательный)
Order object.
$currency(строка) (обязательный)
Currency code.

Код WC_Gateway_Paypal_IPN_Handler::validate_currency() 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;
	}
}