2.3.0 • Published 4 years ago

@wp-pay/core v2.3.0

Weekly downloads
-
License
GPL-3.0
Repository
github
Last release
4 years ago

Table of contents

Status

Latest Stable Version Total Downloads Latest Unstable Version License Built with Grunt

WordPress Filters

pronamic_payment_gateway_configuration_id

add_filter(
	'pronamic_payment_gateway_configuration_id',
	/**
	 * Filter the payment gateway configuration ID to use specific 
	 * gateways for certain WooCommerce billing countries.
	 *
	 * @param int     $configuration_id Gateway configuration ID.
	 * @param Payment $payment          The payment resource data.
	 * @return int Gateway configuration ID.
	 */
	function( $configuration_id, $payment ) {
		if ( 'woocommerce' !== $payment->get_source() ) {
			return $configuration_id;
		}

		$billing_address = $payment->get_billing_address();

		if ( null === $billing_address ) {
			return $configuration_id;
		}

		$id = $configuration_id;

		switch ( $billing_address->get_country_code() ) {
			case 'US':
				$id = get_option( 'custom_us_gateway_configuration_id', $id );
				break;
			case 'AU':
				$id = get_option( 'custom_au_gateway_configuration_id', $id );
				break;
		}

		if ( 'pronamic_gateway' === get_post_type( $id ) && 'publish' === get_post_status( $id ) ) {
			$configuration_id = $id;
		}

		return $configuration_id;
	}
);
2.3.0

4 years ago

2.1.6

5 years ago

2.1.0

5 years ago

2.0.8

6 years ago

2.0.7

6 years ago

2.0.6

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago