Skip to content
Open

Dev #30

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
8f4f741
Update to latest version of Braintree PHP library.
mipaca Jul 21, 2016
82ce90b
Add gitignore file.
mipaca Jul 25, 2016
f0f28c1
Increase version number and add documentation about subscriptions.
mipaca Jul 25, 2016
44236cf
Update minimum Gravity Forms version. Update Braintree_Configuration …
mipaca Jul 25, 2016
f6403ae
Update subscription to search for existing customer before creating a…
mipaca Jul 26, 2016
33a1ce2
Update subscription method to set the price if the submitted price do…
mipaca Jul 26, 2016
ba8f355
Adjust getting the subscription and initial transacation ids and the …
mipaca Jul 26, 2016
963a435
Fix bug where it was not finding the customer by email address.
mipaca Jul 26, 2016
a5efcb3
Wrap the creation of customer and subscription in a try catch.
mipaca Jul 27, 2016
a607a77
Adjust indentation. Fix return attributes in authorize method. Pass f…
mipaca Aug 3, 2016
bbe304e
Add first bill date field for setting future bill dates.
mipaca Oct 3, 2016
8110a57
Add billing info fields to add first billing date field.
mipaca Oct 18, 2016
04f1aaa
Add tax exempt option to feed settings.
mipaca Jan 26, 2019
bf3bdaa
Add logging for args and result. Fix comment.
mipaca Mar 7, 2019
c771c45
Update to version 3.39.0 SDK.
mipaca Mar 21, 2019
9a8b82c
Update docs for SDK 3.39.0 update.
mipaca Mar 21, 2019
ce85a2c
Add exception message to debug log. Fix issue with where taxExempt sh…
mipaca Mar 21, 2019
e0fcb01
Update to add Advanced Fraud Tools to the plugin setup.
mipaca Mar 21, 2019
a7242c4
Updates to documentation and work in progress for getting field name …
mipaca Mar 22, 2019
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Created by .ignore support plugin (hsz.mobi)
.idea/
.DS_Store
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ Braintree Payments is a payment gateway provider owned by eBAY Inc, which allows
* Supports both production and sandbox environments, enabling you to test payments before going live
* Form entries will only be created when payment is successful
* Quick and easy setup
* Tax Exempt form feed setting for non-profits
* Advanced Fraud Prevention integration

## Subscriptions
The plugin does not currently support Braintree Subscriptions. Keep a look out for it in a future version

* Includes basic subscription functionality that searches for plans in the account and attempts to match the dollar amount of a plan to the amount specified.

## Upgrade Notice
If you are updating from a version previous to 1.0, your existing feeds will not work. Please make sure you check all your feeds and ensure they function correctly.
33 changes: 33 additions & 0 deletions assets/js/braintree-data-processing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Used for Advanced Fraud Tools integration.
*
* @since 1.4.0
*/
jQuery( function($) {
braintree.client.create({
authorization: braintree_data_processing_strings.bt_magic
}, function (err, clientInstance) {
// Creation of any other components...

// Inside of your client create callback...
braintree.dataCollector.create({
client: clientInstance,
kount: true
}, function (err, dataCollectorInstance) {
if (err) {
// Handle error in data collector creation
return;
}
var deviceDataInput = jQuery("[name=" + braintree_data_processing_strings.bt_field + "]");

if (deviceDataInput == null) {
deviceDataInput = document.createElement('input');
deviceDataInput.name = 'device_data';
deviceDataInput.type = 'hidden';
form.appendChild(deviceDataInput);
}

deviceDataInput.val(dataCollectorInstance.deviceData);
});
});
});
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.4.0
Author URI: http://plugify.io
*/

Expand Down
Binary file added lib/.DS_Store
Binary file not shown.
181 changes: 12 additions & 169 deletions lib/Braintree.php
Original file line number Diff line number Diff line change
@@ -1,181 +1,24 @@
<?php
/**
* Braintree base class and initialization
*
* PHP version 5
*
* @copyright 2010 Braintree Payment Solutions
*/


set_include_path(get_include_path() . PATH_SEPARATOR . realpath(dirname(__FILE__)));

/**
* Braintree PHP Library
*
* Provides methods to child classes. This class cannot be instantiated.
*
* @copyright 2010 Braintree Payment Solutions
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
*/
abstract class Braintree
{
/**
* @ignore
* don't permit an explicit call of the constructor!
* (like $t = new Braintree_Transaction())
*/
protected function __construct()
{
}
/**
* @ignore
* don't permit cloning the instances (like $x = clone $v)
*/
protected function __clone()
{
}

/**
* returns private/nonexistent instance properties
* @ignore
* @access public
* @param string $name property name
* @return mixed contents of instance properties
*/
public function __get($name)
{
if (array_key_exists($name, $this->_attributes)) {
return $this->_attributes[$name];
}
else {
trigger_error('Undefined property on ' . get_class($this) . ': ' . $name, E_USER_NOTICE);
return null;
}
}

/**
* used by isset() and empty()
* @access public
* @param string $name property name
* @return boolean
*/
public function __isset($name)
{
return array_key_exists($name, $this->_attributes);
}

public function _set($key, $value)
{
$this->_attributes[$key] = $value;
}

/**
*
* @param string $className
* @param object $resultObj
* @return object returns the passed object if successful
* @throws Braintree_Exception_ValidationsFailed
*/
public static function returnObjectOrThrowException($className, $resultObj)
{
$resultObjName = Braintree_Util::cleanClassName($className);
if ($resultObj->success) {
return $resultObj->$resultObjName;
} else {
throw new Braintree_Exception_ValidationsFailed();
}
}
}
require_once('Braintree/Modification.php');
require_once('Braintree/Instance.php');
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');

require_once('Braintree/Address.php');
require_once('Braintree/AddOn.php');
require_once('Braintree/Collection.php');
require_once('Braintree/Configuration.php');
require_once('Braintree/CreditCard.php');
require_once('Braintree/Customer.php');
require_once('Braintree/CustomerSearch.php');
require_once('Braintree/DisbursementDetails.php');
require_once('Braintree/Descriptor.php');
require_once('Braintree/Digest.php');
require_once('Braintree/Discount.php');
require_once('Braintree/IsNode.php');
require_once('Braintree/EqualityNode.php');
require_once('Braintree/Exception.php');
require_once('Braintree/Http.php');
require_once('Braintree/KeyValueNode.php');
require_once('Braintree/MerchantAccount.php');
require_once('Braintree/MerchantAccount/BusinessDetails.php');
require_once('Braintree/MerchantAccount/FundingDetails.php');
require_once('Braintree/MerchantAccount/IndividualDetails.php');
require_once('Braintree/MerchantAccount/AddressDetails.php');
require_once('Braintree/MultipleValueNode.php');
require_once('Braintree/MultipleValueOrTextNode.php');
require_once('Braintree/PartialMatchNode.php');
require_once('Braintree/Plan.php');
require_once('Braintree/RangeNode.php');
require_once('Braintree/ResourceCollection.php');
require_once('Braintree/SettlementBatchSummary.php');
require_once('Braintree/Subscription.php');
require_once('Braintree/SubscriptionSearch.php');
require_once('Braintree/TextNode.php');
require_once('Braintree/Transaction.php');
require_once('Braintree/Disbursement.php');
require_once('Braintree/TransactionSearch.php');
require_once('Braintree/TransparentRedirect.php');
require_once('Braintree/Util.php');
require_once('Braintree/Version.php');
require_once('Braintree/Xml.php');
require_once('Braintree/Error/Codes.php');
require_once('Braintree/Error/ErrorCollection.php');
require_once('Braintree/Error/Validation.php');
require_once('Braintree/Error/ValidationErrorCollection.php');
require_once('Braintree/Exception/Authentication.php');
require_once('Braintree/Exception/Authorization.php');
require_once('Braintree/Exception/Configuration.php');
require_once('Braintree/Exception/DownForMaintenance.php');
require_once('Braintree/Exception/ForgedQueryString.php');
require_once('Braintree/Exception/InvalidSignature.php');
require_once('Braintree/Exception/NotFound.php');
require_once('Braintree/Exception/ServerError.php');
require_once('Braintree/Exception/SSLCertificate.php');
require_once('Braintree/Exception/SSLCaFileNotFound.php');
require_once('Braintree/Exception/Unexpected.php');
require_once('Braintree/Exception/UpgradeRequired.php');
require_once('Braintree/Exception/ValidationsFailed.php');
require_once('Braintree/Result/CreditCardVerification.php');
require_once('Braintree/Result/Error.php');
require_once('Braintree/Result/Successful.php');
require_once('Braintree/Test/CreditCardNumbers.php');
require_once('Braintree/Test/MerchantAccount.php');
require_once('Braintree/Test/TransactionAmounts.php');
require_once('Braintree/Test/VenmoSdk.php');
require_once('Braintree/Transaction/AddressDetails.php');
require_once('Braintree/Transaction/CreditCardDetails.php');
require_once('Braintree/Transaction/CustomerDetails.php');
require_once('Braintree/Transaction/StatusDetails.php');
require_once('Braintree/Transaction/SubscriptionDetails.php');
require_once('Braintree/WebhookNotification.php');
require_once('Braintree/WebhookTesting.php');
require_once('Braintree/Xml/Generator.php');
require_once('Braintree/Xml/Parser.php');
require_once('Braintree/CreditCardVerification.php');
require_once('Braintree/CreditCardVerificationSearch.php');
require_once('Braintree/PartnerMerchant.php');

if (version_compare(PHP_VERSION, '5.2.1', '<')) {
throw new Braintree_Exception('PHP version >= 5.2.1 required');
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
throw new Braintree_Exception('PHP version >= 5.4.0 required');
}


function requireDependencies() {
$requiredExtensions = array('xmlwriter', 'SimpleXML', 'openssl', 'dom', 'hash', 'curl');
foreach ($requiredExtensions AS $ext) {
if (!extension_loaded($ext)) {
throw new Braintree_Exception('The Braintree library requires the ' . $ext . ' extension.');
class Braintree {
public static function requireDependencies() {
$requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
foreach ($requiredExtensions AS $ext) {
if (!extension_loaded($ext)) {
throw new Braintree_Exception('The Braintree library requires the ' . $ext . ' extension.');
}
}
}
}

requireDependencies();
Braintree::requireDependencies();
43 changes: 43 additions & 0 deletions lib/Braintree/AccountUpdaterDailyReport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php
namespace Braintree;

/**
* Creates an instance of AccountUpdaterDailyReport
*
*
* @package Braintree
*
* @property-read string $reportUrl
* @property-read date $reportDate
*/
class AccountUpdaterDailyReport extends Base
{
protected $_attributes = [];

protected function _initialize($disputeAttribs)
{
$this->_attributes = $disputeAttribs;
}

public static function factory($attributes)
{
$instance = new self();
$instance->_initialize($attributes);
return $instance;
}

public function __toString()
{
$display = [
'reportDate', 'reportUrl'
];

$displayAttributes = [];
foreach ($display AS $attrib) {
$displayAttributes[$attrib] = $this->$attrib;
}
return __CLASS__ . '[' .
Util::attributesToString($displayAttributes) .']';
}
}
class_alias('Braintree\AccountUpdaterDailyReport', 'Braintree_AccountUpdaterDailyReport');
55 changes: 55 additions & 0 deletions lib/Braintree/AchMandate.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php
namespace Braintree;

/**
* Braintree AchMandate module
* PHP Version 5
*
* @package Braintree
*
* @property-read string $text
* @property-read string $acceptedAt
*/
class AchMandate extends Base
{
/**
* create a printable representation of the object as:
* ClassName[property=value, property=value]
* @ignore
* @return string
*/
public function __toString()
{
return __CLASS__ . '[' .
Util::attributesToString($this->_attributes) . ']';
}

/**
* sets instance properties from an array of values
*
* @ignore
* @access protected
* @param array $achAttribs array of achMandate data
* @return void
*/
protected function _initialize($achAttribs)
{
// set the attributes
$this->_attributes = $achAttribs;
}

/**
* factory method: returns an instance of AchMandate
* to the requesting method, with populated properties
* @ignore
* @return AchMandate
*/
public static function factory($attributes)
{
$instance = new self();
$instance->_initialize($attributes);
return $instance;

}
}
class_alias('Braintree\AchMandate', 'Braintree_Mandate');
Loading