This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'pay360_hosted_cashier_get_parameters', 'vanbodevelops_filter_hc_parameters', 10, 3 ); | |
| function vanbodevelops_filter_hc_parameters( $args, $order, $gateway ) { | |
| // This is the customer ID prefix, from the settings | |
| $customer_prefix = $gateway->get_option( 'cashier_customer_prefix' ); | |
| $ref_number_parts = explode( ':', $args['transaction']['merchantReference'] ); | |
| $customer_prefix = str_replace( array( ' ', ':', ), array( '-', '-' ), $customer_prefix ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Actions | |
| add_action( 'woocommerce_api_wc_gateway_paysafe_response', 'vanbodevelops_intercept_hosted_response', 9 ); | |
| function vanbodevelops_intercept_hosted_response() { | |
| /** | |
| * @var \WcPaysafe\Gateways\Redirect\Gateway $gateway | |
| */ | |
| $gateway = vanbodevelops_get_gateway( 'netbanx' ); | |
| if ( 'hosted' != $gateway->get_option( 'integration', 'hosted' ) ) { | |
| return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'init', 'vanbodevelops_add_email_actions' ); | |
| function vanbodevelops_add_email_actions() { | |
| // Triggers for this email. | |
| add_action( 'woocommerce_order_status_cancelled_to_processing_notification', 'send_order_emails', 11, 2 ); | |
| add_action( 'woocommerce_order_status_failed_to_processing_notification', 'send_order_emails', 11, 2 ); | |
| add_action( 'woocommerce_order_status_on-hold_to_processing_notification', 'send_order_emails', 11, 2 ); | |
| add_action( 'woocommerce_order_status_pending_to_processing_notification', 'send_order_emails', 11, 2 ); | |
| } | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * IMPORTANT: Add the code to your "themes/theme-name/functions.php" file. | |
| */ | |
| add_filter( 'woocommerce_payment_complete_order_status', 'vanbodevelops_set_order_to_onhold_after_processing', 10, 3 ); | |
| function vanbodevelops_set_order_to_onhold_after_processing( $status, $order_id, $order_now ) { | |
| $order = wc_get_order( $order_id ); | |
| if ( ! class_exists( 'WC_Paytrace_Order' ) ) { | |
| return $status; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wc_paytrace_capture_approved_response_processed', 'vanbodevelops_set_order_processing_after_capture', 10, 3 ); | |
| /** | |
| * @param $response | |
| * @param \WC_Order $order | |
| * @param $amount | |
| */ | |
| function vanbodevelops_set_order_processing_after_capture( $response, $order, $amount ) { | |
| // It's our gateway | |
| if ( 'paytrace' != $order->get_payment_method() ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'wc_paysafe_payment_response_processed', 'vanbodevelops_paysafe_add_order_details_after_payment', 10, 2 ); | |
| /** | |
| * IMPORTANT: Add the code to your 'child-theme/functions.php' file | |
| * | |
| * @param \WC_Order $order | |
| * @param \WcPaysafe\Api\Response_Abstract $response | |
| */ | |
| function vanbodevelops_paysafe_add_order_details_after_payment($order, $response) { | |
| // If the transaction is successful | |
| if ( 'completed' == strtolower( $response->get_status() ) ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * IMPORTANT: Add to your 'wp-content/themes/theme-name/functions.php' file | |
| * | |
| * Description: Will limit the trustcommerce requests per interval of time. | |
| */ | |
| add_filter( 'wc_trustcommerce_process_single_payment_request', 'vanbodevelops_limit_transaction_requests', 9999, 3 ); | |
| /** | |
| * @param $request | |
| * @param $order |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * IMPORTANT: Add to your 'wp-content/themes/theme-name/functions.php' file | |
| */ | |
| add_filter( 'wc_paysafe_token_transaction_parameters', 'vanbodevelops_paysafe_modify_merchant_ref_number', 10, 4 ); | |
| /** | |
| * @param array $params The request parameters | |
| * @param \WC_Order $order The WC order object | |
| * @param string $token The payment token | |
| * @param string $trans_type The transaction type: 'cards', 'directdebit' | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * IMPORTANT: The code should be added to the "child-theme/functions.php" file or anywhere that you know it will be loaded | |
| */ | |
| function vd_paytrace_load_js() { | |
| if ( ! class_exists( '\WcPaytrace\Helpers\Factories' ) ) { | |
| return; | |
| } | |
| $pt_gateway = \WcPaytrace\Helpers\Factories::get_gateway( 'paytrace' ); |