diff --git a/gravity-forms-braintree.php b/gravity-forms-braintree.php index c854f80..45534e9 100644 --- a/gravity-forms-braintree.php +++ b/gravity-forms-braintree.php @@ -4,7 +4,7 @@ Plugin URI: http://plugify.io/ Description: Allow your customers to purchase goods and services through Gravity Forms via Braintree Payments Author: Plugify -Version: 1.1 +Version: 1.1.1 Author URI: http://plugify.io */ diff --git a/lib/class.plugify-gform-braintree.php b/lib/class.plugify-gform-braintree.php index b88b96c..eb3dbdc 100644 --- a/lib/class.plugify-gform-braintree.php +++ b/lib/class.plugify-gform-braintree.php @@ -81,11 +81,14 @@ protected function authorize( $feed, $submission_data, $form, $entry ) { // at least, not in this version if( $settings = $this->get_plugin_settings() ) { + // Sanitize card number, removing dashes and spaces + $card_number = str_replace( array( '-', ' ' ), '', $submission_data['card_number'] ); + // Prepare Braintree payload $args = array( 'amount' => $submission_data['payment_amount'], 'creditCard' => array( - 'number' => $submission_data['card_number'], + 'number' => $card_number, 'expirationDate' => sprintf( '%s/%s', $submission_data['card_expiration_date'][0], $submission_data['card_expiration_date'][1]), 'cardholderName' => $submission_data['card_name'], 'cvv' => $submission_data['card_security_code'] @@ -104,7 +107,7 @@ protected function authorize( $feed, $submission_data, $form, $entry ) { if( $settings['settlement'] == 'Yes' ) { $args['options']['submitForSettlement'] = 'true'; } - + // Send transaction to Braintree $result = Braintree_Transaction::sale( $args ); diff --git a/readme.txt b/readme.txt index 707f427..05daa4d 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hello Tags: credit card,braintree,gravity form,payment Requires at least: 3.8 Tested up to: 3.9 -Stable tag: 1.1 +Stable tag: 1.1.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -61,6 +61,9 @@ No filters are currently available for this pre-release version == Changelog == += 1.1.1 = +* Dashes and spaces are now removed from credit card number before sending to Braintree + = 1.1 = * Fixed bug causing automatic settlement submission to fail