• Resolved Andi Lee Davis

    (@andi-lee-davis)


    hi There,

    Renewal orders for Woocommerce Subscriptions will always set to Pending becasue the merch_pmt is not in the aray list in includes/class-wc-gateway-ppec-ipn-handler.php Line 122

    Error:

    12-21-2020 @ 17:36:22 – IPN request is valid according to PayPal.
    12-21-2020 @ 17:36:22 – Found order #9958
    12-21-2020 @ 17:36:22 – Payment status: pending
    12-21-2020 @ 17:36:22 – Aborting, Invalid type:merch_pmt

    includes/class-wc-gateway-ppec-ipn-handler.php Line 122

    /**
    	 * Check for a valid transaction type.
    	 *
    	 * @param string $txn_type Transaction type
    	 */
    	protected function validate_transaction_type( $txn_type ) {
    		$accepted_types = array( 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money' );
    		if ( ! in_array( strtolower( $txn_type ), $accepted_types, true ) ) {
    			wc_gateway_ppec_log( 'Aborting, Invalid type:' . $txn_type );
    			exit;
    		}
    
    	}
    
    

    SUGGESTED FIX: add in merch_pmt, or add in a filter to allow a developer to override this setting.

    /**
    	 * Check for a valid transaction type.
    	 *
    	 * @param string $txn_type Transaction type
    	 */
    	protected function validate_transaction_type( $txn_type ) {
    		$accepted_types = array( 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money', 'merch_pmt' );
    		if ( ! in_array( strtolower( $txn_type ), $accepted_types, true ) ) {
    			wc_gateway_ppec_log( 'Aborting, Invalid type:' . $txn_type );
    			exit;
    		}
    
    	}
    
    

    Better you can add a filter and then the default can be maintained unless needed to be overwritten.

    
    /**
    	 * Check for a valid transaction type.
    	 *
    	 * @param string $txn_type Transaction type
    	 */
    	protected function validate_transaction_type( $txn_type ) {
    		$accepted_types = apply_filters('ppec_ipn_allowed_types', array( 'cart', 'instant', 'express_checkout', 'web_accept', 'masspay', 'send_money'));
    		if ( ! in_array( strtolower( $txn_type ), $accepted_types, true ) ) {
    			wc_gateway_ppec_log( 'Aborting, Invalid type:' . $txn_type );
    			exit;
    		}
    
    	}
    
    

    Thanks

    Andi

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    I think this is better suited for a ticket with us at WooCommerce.com, as there might need some logic put in place with Subscriptions, etc.

    Please contact us at WooCommerce.com > My Account > Support.

    Please include a link to this forum thread, so that we can keep track of what’s already been done.

    We will be able to help you further there.

    Plugin Contributor AW a11n

    (@slash1andy)

    Automattic Happiness Engineer

    Hey again!

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add in merch_pmt as an accepted type’ is closed to new replies.