Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gravity-forms-braintree.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

Expand Down
21 changes: 18 additions & 3 deletions lib/class.plugify-gform-braintree.php
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
Expand Down Expand Up @@ -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,
Expand All @@ -102,7 +117,7 @@ public function authorize( $feed, $submission_data, $form, $entry ) {
'locality' => $submission_data['city'],
'postalCode' => $submission_data['zip']
)
);
), $entry, $form );

try {

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down