diff --git a/gravity-forms-braintree.php b/gravity-forms-braintree.php index 45534e9..5426412 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.1 +Version: 1.1.2 Author URI: http://plugify.io */ diff --git a/lib/class.plugify-gform-braintree.php b/lib/class.plugify-gform-braintree.php index 5128597..fbf1d8b 100644 --- a/lib/class.plugify-gform-braintree.php +++ b/lib/class.plugify-gform-braintree.php @@ -43,7 +43,7 @@ public function init_frontend () { /** * After form has been submitted, send CC details to Braintree and ensure the card is going to work - * If not, void the validation result (processed elsewhere) and have the submit the form again + * If not, void the validation result (processed elsewhere) and have them submit the form again * * @param $feed - Current configured payment feed * @param $submission_data - Contains form field data submitted by the user as well as payment information (i.e. payment amount, setup fee, line items, etc...) @@ -85,7 +85,22 @@ public function authorize( $feed, $submission_data, $form, $entry ) { $card_number = str_replace( array( '-', ' ' ), '', $submission_data['card_number'] ); // Prepare Braintree payload - $args = array( + // Use filter gform_braintree_payload to modify the default payload + // Example: + // + // add_filter( 'gform_braintree_payload', 'example_callback', 10, 3 ); + // function example_callback( $args, $entry, $form ) { + // // check for a field named "Email" + // foreach ( $form['fields'] as $field ) { + // if ( 'Email' == $field->label ) { + // $args['customer']['email'] = $entry[$field->id]; + // } + // } + // + // return $args; + // } + // + $args = apply_filters( 'gform_braintree_payload', array( 'amount' => $submission_data['payment_amount'], 'creditCard' => array( 'number' => $card_number, @@ -102,7 +117,7 @@ public function authorize( $feed, $submission_data, $form, $entry ) { 'locality' => $submission_data['city'], 'postalCode' => $submission_data['zip'] ) - ); + ), $entry, $form ); try { diff --git a/readme.txt b/readme.txt index 05daa4d..4f677a9 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.1 +Stable tag: 1.1.2 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html