Support » Plugin: Eway Payment Gateway » Filter for payment method type?

  • Hi,

    Would you consider creating a filter for the Capture/PreAuth payment method type?

    Real life use case: some products can be directly captured, while some should be preauth and manually OK’d from eWay.

    If I’ve overlooked something and there’s already a way to do this per product basis, please let me know, thank you.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author webaware

    (@webaware)

    G’day Increaseo,

    Should be easy enough, I’ll cut a development release with this sometime this weekend.

    cheers,
    Ross

    Plugin Author webaware

    (@webaware)

    G’day Increaseo,

    Here’s a dev release with the new filter. You’d use it something like this (return true for Capture, false for Authorise):

    /**
     * maybe alter Eway transaction method for WooCommerce order
     * @param bool $capture
     * @param WC_Order $order
     * @return bool
     */
    add_filter('woocommerce_eway_method_capture', function($capture, $order) {
        // inspect order here...
        return false;
    }, 10, 2);

    https://www.dropbox.com/s/ghdjeyaouf8ibn1/eway-payment-gateway-5.0.0-dev.zip?dl=1

    Thread Starter Increaseo

    (@incdigital)

    Thank you for the speedy response and filter – really appreciated! 🙂

    Thread Starter Increaseo

    (@incdigital)

    Hi @webaware the new filter is working otherwise as expected, but the order status is getting set as Processing, not On hold.

    Code example:

    
    function inc_woocommerce_eway_method_capture( $capture ) {
    	$custom_product_id = get_page_by_title( 'x', OBJECT, 'product' );
    	$cart_content_ids  = array_merge(
    		wp_list_pluck( WC()->cart->get_cart_contents(), 'variation_id' ),
    		wp_list_pluck( WC()->cart->get_cart_contents(), 'product_id' )
    	);
    	if ( in_array( $custom_product_id->ID, $cart_content_ids, true ) ) {
    		$capture = false;
    	}
    	return $capture;
    }
    add_filter( 'woocommerce_eway_method_capture', 'inc_woocommerce_eway_method_capture', 10, 1 );
    

    Should we be manually setting that or should that be automatic with https://github.com/webaware/eway-payment-gateway/blob/master/includes/integrations/class.WooCommerce.php#L588-L595 ?

    Thanks!

    • This reply was modified 2 weeks ago by Increaseo.
Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.