Created
June 23, 2020 17:14
-
-
Save deivamagalhaes/f1c2050bbe50a1405518072c340c1a53 to your computer and use it in GitHub Desktop.
Unset transaction source for Braintree
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
<?php | |
add_filter( 'wc_braintree_transaction_data', 'sv_unset_transaction_source', 10, 2 ); | |
/** | |
* Unset the transaction source to prevent authorizations from expiring too soon. | |
* | |
* @param array $request_data The transaction/sale data | |
* @param \WC_Braintree_API_Transaction_Request $request the request object | |
* @return array | |
*/ | |
function sv_unset_transaction_source( $request_data, $request ) { | |
if ( ! empty( $request_data['transactionSource'] ) ) { | |
unset( $request_data['transactionSource'] ); | |
} | |
return $request_data; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment