Add in merch_pmt as an accepted type
-
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_pmtincludes/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]
- The topic ‘Add in merch_pmt as an accepted type’ is closed to new replies.