Skip to content

PFW-1922 - Updated the Braintree SDK 6.24.0 #2100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: release
Choose a base branch
from
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
19 changes: 12 additions & 7 deletions classes/lib/lib/Braintree.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<?php // phpcs:ignore

/**
* Braintree PHP Library
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
*/
<?php // phpcs:disable

require_once(__DIR__ . DIRECTORY_SEPARATOR . 'autoload.php');

if (version_compare(PHP_VERSION, '7.3.0', '<')) {
throw new Braintree\Exception('PHP version >= 7.3.0 required');
}

// phpcs:ignore
/**
* Braintree PHP Library
* Creates class_aliases for old class names replaced by PSR-4 Namespaces
*/
class Braintree
{
/**
* Checks for required dependencies
*
* @throws Braintree/Exception With the missing extension
*
* @return void
*/
public static function requireDependencies()
{
$requiredExtensions = ['xmlwriter', 'openssl', 'dom', 'hash', 'curl'];
Expand Down
14 changes: 9 additions & 5 deletions classes/lib/lib/Braintree/AccountUpdaterDailyReport.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
/**
* Creates an instance of AccountUpdaterDailyReport
*
*
* @package Braintree
*
* @property-read string $reportUrl
* @property-read date $reportDate
* For attributes see our {@link https://developer.paypal.com/braintree/docs/reference/general/webhooks/account-updater/php#notification-kinds developer documentation}
*/
class AccountUpdaterDailyReport extends Base
{
Expand All @@ -20,13 +16,21 @@ protected function _initialize($disputeAttribs)
$this->_attributes = $disputeAttribs;
}

/**
* Creates an instance of an AccountUpdaterDailyReport from given attributes
*
* @param array $attributes to generate new AccountUpdaterDailyReport
*
* @return AccountUpdaterDailyReport
*/
public static function factory($attributes)
{
$instance = new self();
$instance->_initialize($attributes);
return $instance;
}

// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __toString()
{
$display = [
Expand Down
19 changes: 6 additions & 13 deletions classes/lib/lib/Braintree/AchMandate.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@
/**
* Braintree AchMandate module
*
* @package Braintree
*
* @property-read string $text
* @property-read string $acceptedAt
* See our {link https://developer.paypal.com/braintree/docs/reference/response/us-bank-account/php#ach_mandate developer docs} for information on attributes
*/
class AchMandate extends Base
{
/**
* create a printable representation of the object as:
* ClassName[property=value, property=value]
* @ignore
* @return string
*/
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __toString()
{
return __CLASS__ . '[' .
Expand All @@ -27,9 +19,8 @@ public function __toString()
/**
* sets instance properties from an array of values
*
* @ignore
* @access protected
* @param array $achAttribs array of achMandate data
*
* @return void
*/
protected function _initialize($achAttribs)
Expand All @@ -41,7 +32,9 @@ protected function _initialize($achAttribs)
/**
* factory method: returns an instance of AchMandate
* to the requesting method, with populated properties
* @ignore
*
* @param array $attributes response object attributes
*
* @return AchMandate
*/
public static function factory($attributes)
Expand Down
25 changes: 11 additions & 14 deletions classes/lib/lib/Braintree/AddOn.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,19 @@
namespace Braintree;

/**
* @property-read string $amount
* @property-read \DateTime $createdAt
* @property-read int|null $currentBillingCycle
* @property-read string $description
* @property-read string $id
* @property-read string|null $kind
* @property-read string $merchantId
* @property-read string $name
* @property-read boolean $neverExpires
* @property-read int|null $numberOfBillingCycles
* @property-read int|null $quantity
* @property-read \DateTime $updatedAt
* Braintree AddOn class
*
* Object containing information on AddOns of a subscription
*
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/add-on developer docs} for information on attributes
*/
class AddOn extends Modification
{
/**
* Creates an instance of an AddOn from given attributes
*
* @param array $attributes response object attributes
*
* @param array $attributes
* @return AddOn
*/
public static function factory($attributes)
Expand All @@ -32,7 +27,9 @@ public static function factory($attributes)


/**
* static methods redirecting to gateway
* static methods redirecting to gateway class
*
* @see AddOnGateway::all()
*
* @return AddOn[]
*/
Expand Down
25 changes: 7 additions & 18 deletions classes/lib/lib/Braintree/AddOnGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,18 @@

namespace Braintree;

/**
* Braintree AddOnGateway module
*
* Manages subscription addons
*/
class AddOnGateway
{
/**
*
* @var Gateway
*/
private $_gateway;

/**
*
* @var Configuration
*/
private $_config;

/**
*
* @var Http
*/
private $_http;

/**
*
* @param Gateway $gateway
*/
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __construct($gateway)
{
$this->_gateway = $gateway;
Expand All @@ -35,6 +23,7 @@ public function __construct($gateway)
}

/**
* Retrieve all add ons
*
* @return AddOn[]
*/
Expand Down
104 changes: 55 additions & 49 deletions classes/lib/lib/Braintree/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,7 @@
* CreditCard as the billing address. It can also be used
* as the shipping address when creating a Transaction.
*
* @package Braintree
*
* @property-read string $company
* @property-read string $countryName
* @property-read \DateTime $createdAt
* @property-read string $customerId
* @property-read string $extendedAddress
* @property-read string $firstName
* @property-read string $id
* @property-read string $lastName
* @property-read string $locality
* @property-read string $phoneNumber
* @property-read string $postalCode
* @property-read string $region
* @property-read string $streetAddress
* @property-read \DateTime $updatedAt
* See our {@link https://developer.paypal.com/braintree/docs/reference/response/address developer docs} for information on attributes
*/
class Address extends Base
{
Expand All @@ -34,6 +19,7 @@ class Address extends Base
* or is a Address with a different id
*
* @param object $other address to compare against
*
* @return boolean
*/
public function isEqual($other)
Expand All @@ -43,36 +29,25 @@ public function isEqual($other)
($this->id === $other->id && $this->customerId === $other->customerId);
}

/**
* create a printable representation of the object as:
* ClassName[property=value, property=value]
* @ignore
* @return string
*/
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
public function __toString()
{
return __CLASS__ . '[' .
Util::attributesToString($this->_attributes) . ']';
}

/**
* sets instance properties from an array of values
*
* @ignore
* @access protected
* @param array $addressAttribs array of address data
* @return void
*/
// phpcs:ignore PEAR.Commenting.FunctionComment.Missing
protected function _initialize($addressAttribs)
{
// set the attributes
$this->_attributes = $addressAttribs;
}

/**
* factory method: returns an instance of Address
* to the requesting method, with populated properties
* @ignore
* Creates an instance of an Address from given attributes
*
* @param array $attributes response object attributes
*
* @return Address
*/
public static function factory($attributes)
Expand All @@ -82,22 +57,29 @@ public static function factory($attributes)
return $instance;
}


// static methods redirecting to gateway

/**
* static method redirecting to gateway class
*
* @param array $attribs
* @return Address
* @param array $attribs containing request parameters
*
* @see AddressGateway::create()
*
* @return Result\Successful|Result\Error
*/
public static function create($attribs)
{
return Configuration::gateway()->address()->create($attribs);
}

/**
* static method redirecting to gateway class
*
* @param array $attribs containing request parameters
*
* @see AddressGateway::createNoValidate()
*
* @throws Exception\ValidationError
*
* @param array $attribs
* @return Address
*/
public static function createNoValidate($attribs)
Expand All @@ -106,22 +88,30 @@ public static function createNoValidate($attribs)
}

/**
* static method redirecting to gateway class
*
* @param mixed $customerOrId either a customer object or string ID of customer
* @param string $addressId optional unique identifier
*
* @param Customer|int $customerOrId
* @param int $addressId
* @throws InvalidArgumentException
* @return Result\Successful
* @see AddressGateway::delete()
*
* @return Result\Successful|Result\Error
*/
public static function delete($customerOrId = null, $addressId = null)
{
return Configuration::gateway()->address()->delete($customerOrId, $addressId);
}

/**
* static method redirecting to gateway class
*
* @param mixed $customerOrId either a customer object or string ID of customer
* @param string $addressId optional unique identifier
*
* @see AddressGateway::find()
*
* @param Customer|int $customerOrId
* @param int $addressId
* @throws Exception\NotFound
*
* @return Address
*/
public static function find($customerOrId, $addressId)
Expand All @@ -130,18 +120,34 @@ public static function find($customerOrId, $addressId)
}

/**
* static method redirecting to gateway class
*
* @param mixed $customerOrId (only used in call)
* @param string $addressId (only used in call)
* @param array $attributes containing request parameters
*
* @see AddressGateway::update()
*
* @param Customer|int $customerOrId
* @param int $addressId
* @param array $attributes
* @throws Exception\Unexpected
* @return Result\Successful|Result\Error
*/
public static function update($customerOrId, $addressId, $attributes)
{
return Configuration::gateway()->address()->update($customerOrId, $addressId, $attributes);
}

/**
* static method redirecting to gateway class
*
* @param mixed $customerOrId (only used in call)
* @param string $addressId (only used in call)
* @param array $attributes containing request parameters
*
* @see AddressGateway::updateNoValidate()
*
* @throws Exception\ValidationsFailed
*
* @return Address
*/
public static function updateNoValidate($customerOrId, $addressId, $attributes)
{
return Configuration::gateway()->address()->updateNoValidate($customerOrId, $addressId, $attributes);
Expand Down
Loading