Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Recurly 2.1.2 → 2.3.1 Upgrade (./lib directory diff)
diff -r html/sites/all/libraries/recurly_v2/recurly/account.php vendor/recurly/recurly-client/lib/recurly/account.php
9c9,10
< function __construct($accountCode = null) {
---
> function __construct($accountCode = null, $client = null) {
> parent::__construct(null, $client);
11a13,15
> $this->address = new Recurly_Address();
> $this->balance_in_cents_invoiced = new Recurly_CurrencyList('balance_in_cents_invoiced');
> $this->balance_in_cents_uninvoiced = new Recurly_CurrencyList('balance_in_cents_uninvoiced');
17,18c21,22
< 'account_code','username','first_name','last_name',
< 'email','company_name','accept_language','billing_info'
---
> 'account_code','username','first_name','last_name','vat_number',
> 'email','company_name','accept_language','billing_info','address','tax_exempt', 'entity_use_code'
25a30
>
40c45,53
< return Recurly_Resource::_delete($this->uri());
---
> Recurly_Base::_delete($this->uri(), $this->_client);
> $this->state = 'closed';
> }
> public static function closeAccount($accountCode, $client = null) {
> return Recurly_Base::_delete(Recurly_Account::uriForAccount($accountCode), $client);
> }
>
> public function reopen() {
> $this->_save(Recurly_Client::PUT, $this->uri() . '/reopen');
42,43c55,56
< public static function closeAccount($accountCode) {
< return Recurly_Resource::_delete(Recurly_Account::uriForAccount($accountCode));
---
> public static function reopenAccount($accountCode, $client = null) {
> return Recurly_Base::_put(Recurly_Account::uriForAccount($accountCode) . '/reopen', $client);
diff -r html/sites/all/libraries/recurly_v2/recurly/addon.php vendor/recurly/recurly-client/lib/recurly/addon.php
8a9
> parent::__construct();
21,22c22,23
< public static function get($planCode, $addonCode) {
< return Recurly_Base::_get(Recurly_Addon::uriForAddOn($planCode, $addonCode));
---
> public static function get($planCode, $addonCode, $client = null) {
> return Recurly_Base::_get(Recurly_Addon::uriForAddOn($planCode, $addonCode), $client);
34c35
< return Recurly_Resource::_delete($this->uri());
---
> return Recurly_Base::_delete($this->uri(), $this->_client);
Only in vendor/recurly/recurly-client/lib/recurly: address.php
diff -r html/sites/all/libraries/recurly_v2/recurly/adjustment.php vendor/recurly/recurly-client/lib/recurly/adjustment.php
12c12
< 'taxable','accounting_code'
---
> 'accounting_code','tax_exempt'
19,20c19,20
< public static function get($adjustment_uuid) {
< return Recurly_Base::_get(Recurly_Client::PATH_ADJUSTMENTS . '/' . rawurlencode($adjustment_uuid));
---
> public static function get($adjustment_uuid, $client = null) {
> return Recurly_Base::_get(Recurly_Client::PATH_ADJUSTMENTS . '/' . rawurlencode($adjustment_uuid), $client);
27c27
< return Recurly_Resource::_delete($this->getHref());
---
> return Recurly_Base::_delete($this->getHref(), $this->_client);
diff -r html/sites/all/libraries/recurly_v2/recurly/base.php vendor/recurly/recurly-client/lib/recurly/base.php
24d23
<
56a56,91
> * Put to the URI, validate the response and return the object.
> * @param string Resource URI, if not fully qualified, the base URL will be appended
> * @param string Optional client for the request, useful for mocking the client
> */
> protected static function _put($uri, $client = null)
> {
> if (is_null($client))
> $client = new Recurly_Client();
> $response = $client->request(Recurly_Client::PUT, $uri);
> $response->assertValidResponse();
> if ($response->body) {
> $object = Recurly_Base::__parseXmlToNewObject($response->body, $client);
> }
> $response->assertSuccessResponse($object);
> return $object;
> }
>
> /**
> * Delete the URI, validate the response and return the object.
> * @param string Resource URI, if not fully qualified, the base URL will be appended
> * @param string Data to post to the URI
> * @param string Optional client for the request, useful for mocking the client
> */
> protected static function _delete($uri, $client = null)
> {
> if (is_null($client))
> $client = new Recurly_Client();
> $response = $client->request(Recurly_Client::DELETE, $uri);
> $response->assertValidResponse();
> if ($response->body) {
> return Recurly_Base::__parseXmlToNewObject($response->body, $client);
> }
> return null;
> }
>
> /**
115,116c150,154
< 'add_on' => 'Recurly_AddOn',
< 'add_ons' => 'Recurly_AddOnList',
---
> 'address' => 'Recurly_Address',
> 'add_on' => 'Recurly_Addon',
> 'add_ons' => 'Recurly_AddonList',
> 'balance_in_cents_invoiced' => 'Recurly_CurrencyList',
> 'balance_in_cents_uninvoiced' => 'Recurly_CurrencyList',
128a167,168
> 'note' => 'Recurly_Note',
> 'notes' => 'Recurly_NoteList',
139a180,181
> 'tax_detail' => 'Recurly_Tax_Detail',
> 'tax_details' => 'array',
143c185
< 'unit_amount_in_cents' => 'Recurly_CurrencyList'
---
> 'unit_amount_in_cents' => 'Recurly_CurrencyList',
147,148c189,190
< $dom = new DOMDocument();
< if (!$dom->loadXML($xml, LIBXML_NOBLANKS)) return null;
---
> $dom = new DOMDocument();
> if (empty($xml) || !$dom->loadXML($xml, LIBXML_NOBLANKS)) return null;
161,162c203,204
< $dom = new DOMDocument();
< if (!$dom->loadXML($xml, LIBXML_NOBLANKS)) return null;
---
> $dom = new DOMDocument();
> if (empty($xml) || !$dom->loadXML($xml, LIBXML_NOBLANKS)) return null;
diff -r html/sites/all/libraries/recurly_v2/recurly/billing_info.php vendor/recurly/recurly-client/lib/recurly/billing_info.php
13c13,15
< 'number','month','year','verification_value','start_year','start_month','issue_number'
---
> 'number','month','year','verification_value','start_year','start_month','issue_number',
> 'paypal_billing_agreement_id', 'amazon_billing_agreement_id',
> 'token_id'
30c32
< return Recurly_Resource::_delete($this->uri());
---
> return Recurly_Base::_delete($this->uri(), $this->_client);
32,33c34,35
< public static function deleteForAccount($accountCode) {
< return Recurly_Resource::_delete(Recurly_BillingInfo::uriForBillingInfo($accountCode));
---
> public static function deleteForAccount($accountCode, $client = null) {
> return Recurly_Base::_delete(Recurly_BillingInfo::uriForBillingInfo($accountCode), $client);
diff -r html/sites/all/libraries/recurly_v2/recurly/client.php vendor/recurly/recurly-client/lib/recurly/client.php
12a13,17
> * Subdomain for all requests.
> */
> public static $subdomain = 'api';
>
> /**
20c25
< public static $apiUrl = 'https://api.recurly.com/v2';
---
> public static $apiUrl = 'https://%s.recurly.com/v2';
32c37
< const API_CLIENT_VERSION = '2.1.2';
---
> const API_CLIENT_VERSION = '2.3.1';
48a54
> const PATH_NOTES = '/notes';
73,75c79,83
< $response = $this->_sendRequest($method, $uri, $data);
< $response->assertValidResponse();
< return $response;
---
> return $this->_sendRequest($method, $uri, $data);
> }
>
> public function baseUri() {
> return sprintf(Recurly_Client::$apiUrl, Recurly_Client::$subdomain);
101c109
< $uri = Recurly_Client::$apiUrl . $uri;
---
> $uri = $this->baseUri() . $uri;
149a158,162
> // Larger responses end up prefixed by "HTTP/1.1 100 Continue\r\n\r\n" which
> // needs to be discarded.
> if (strpos($header," 100 Continue") !== false ) {
> list($header, $body) = explode("\r\n\r\n", $body, 2);
> }
196c209
< $uri = Recurly_Client::$apiUrl . $uri;
---
> $uri = $this->baseUri() . $uri;
diff -r html/sites/all/libraries/recurly_v2/recurly/coupon.php vendor/recurly/recurly-client/lib/recurly/coupon.php
9a10
> parent::__construct();
32c33,37
< $redemption = new Recurly_CouponRedemption();
---
> if ($this->state != 'redeemable') {
> throw new Recurly_Error('Coupon is not redeemable.');
> }
>
> $redemption = new Recurly_CouponRedemption(null, $this->_client);
44d48
<
46c50
< return Recurly_Resource::_delete($this->uri());
---
> return Recurly_Base::_delete($this->uri(), $this->_client);
48,49c52,53
< public static function deleteCoupon($couponCode) {
< return Recurly_Resource::_delete(Recurly_Coupon::uriForCoupon($couponCode));
---
> public static function deleteCoupon($couponCode, $client = null) {
> return Recurly_Base::_delete(Recurly_Coupon::uriForCoupon($couponCode), $client);
diff -r html/sites/all/libraries/recurly_v2/recurly/currency_list.php vendor/recurly/recurly-client/lib/recurly/currency_list.php
47,48c47
< public function count()
< {
---
> public function count() {
56,62c55,61
<
< public function populateXmlDoc(&$doc, &$node)
< {
< $currencyNode = $node->appendChild($doc->createElement($this->nodeName));
<
< foreach($this->currencies as $currency) {
< $currencyNode->appendChild($doc->createElement($currency->currencyCode, $currency->amount_in_cents));
---
> public function populateXmlDoc(&$doc, &$node) {
> // Don't emit an element if there are no currencies.
> if ($this->currencies) {
> $currencyNode = $node->appendChild($doc->createElement($this->nodeName));
> foreach($this->currencies as $currency) {
> $currencyNode->appendChild($doc->createElement($currency->currencyCode, $currency->amount_in_cents));
> }
diff -r html/sites/all/libraries/recurly_v2/recurly/error_list.php vendor/recurly/recurly-client/lib/recurly/error_list.php
22c22
<
---
>
32c32
< $this->errors[$offset] = $value;
---
> $this->errors[$offset] = $value;
44c44
<
---
>
49c49
<
---
>
53c53
<
---
>
diff -r html/sites/all/libraries/recurly_v2/recurly/invoice.php vendor/recurly/recurly-client/lib/recurly/invoice.php
16c16
< * @param string Invoice number or UUID
---
> * @param string Invoice number
20,21c20
< $uri = Recurly_Client::PATH_INVOICES . '/' . rawurlencode($invoiceNumber);
< return self::_get($uri, $client);
---
> return self::_get(Recurly_Invoice::uriForInvoice($invoiceNumber), $client);
35c34
< $uri = Recurly_Client::PATH_INVOICES . '/' . rawurlencode($invoiceNumber);
---
> $uri = self::uriForInvoice($invoiceNumber);
68a68,78
> protected function uri() {
> if (!empty($this->_href))
> return $this->getHref();
> else if (!empty($this->invoice_number))
> return Recurly_Invoice::uriForInvoice($this->invoice_number);
> else
> throw new Recurly_Error("Invoice number not specified");
> }
> protected static function uriForInvoice($invoiceNumber) {
> return Recurly_Client::PATH_INVOICES . '/' . rawurlencode($invoiceNumber);
> }
Only in vendor/recurly/recurly-client/lib/recurly: note.php
Only in vendor/recurly/recurly-client/lib/recurly: note_list.php
diff -r html/sites/all/libraries/recurly_v2/recurly/plan.php vendor/recurly/recurly-client/lib/recurly/plan.php
8a9
> parent::__construct();
21c22
< 'total_billing_cycles','accounting_code'
---
> 'total_billing_cycles','accounting_code','tax_exempt'
40c41
< return Recurly_Resource::_delete($this->uri());
---
> return Recurly_Base::_delete($this->uri(), $this->_client);
42,43c43,44
< public static function deletePlan($planCode) {
< return Recurly_Resource::_delete(Recurly_Plan::uriForPlan($planCode));
---
> public static function deletePlan($planCode, $client = null) {
> return Recurly_Base::_delete(Recurly_Plan::uriForPlan($planCode), $client);
diff -r html/sites/all/libraries/recurly_v2/recurly/push_notification.php vendor/recurly/recurly-client/lib/recurly/push_notification.php
13,15c13,23
< * [new_account updated_account canceled_account
< * new_subscription updated_subscription canceled_subscription expired_subscription
< * successful_payment failed_payment successful_refund void_payment]
---
> * new_account_notification
> * updated_account_notification
> * canceled_account_notification
> * new_subscription_notification
> * updated_subscription_notification
> * canceled_subscription_notification
> * expired_subscription_notification
> * successful_payment_notification
> * failed_payment_notification
> * successful_refund_notification
> * void_payment_notification
diff -r html/sites/all/libraries/recurly_v2/recurly/redemption.php vendor/recurly/recurly-client/lib/recurly/redemption.php
20c20
< return Recurly_Resource::_delete($this->uri($accountCode));
---
> return Recurly_Base::_delete($this->uri($accountCode), $this->_client);
31,32c31,32
< else
< return false;
---
> else
> return false;
diff -r html/sites/all/libraries/recurly_v2/recurly/resource.php vendor/recurly/recurly-client/lib/recurly/resource.php
48a49,58
> /**
> * Return all of the values associated with this resource.
> *
> * @return array
> * The array of values stored with this resource.
> */
> public function getValues() {
> return $this->_values;
> }
>
63,78c73,74
< Recurly_Resource::__parseXmlToUpdateObject($response->body);
< $response->assertSuccessResponse($this);
< }
<
< /**
< * Delete the object at the given URI.
< * @param string URI of the object to delete
< * @param array Additional parameters for the delete
< */
< protected function _delete($uri)
< {
< if (is_null($this->_client))
< $this->_client = new Recurly_Client();
<
< $response = $this->_client->request(Recurly_Client::DELETE, $uri);
< if($response->body) {
---
> $response->assertValidResponse();
> if (isset($response->body)) {
82d77
< return true;
91c86,88
< return $doc->saveXML();
---
> // To be able to consistently run tests across different XML libraries,
> // favor `<foo></foo>` over `<foo/>`.
> return $doc->saveXML(null, LIBXML_NOEMPTYTAG);
105c102
< $attribute_node = $node->appendChild($doc->createElement($key));
---
> $attribute_node = $node->appendChild($doc->createElement($key));
124c121,127
< }
---
> }
> } else if (is_null($val)) {
> $domAttribute = $doc->createAttribute('nil');
> $domAttribute->value = 'nil';
> $attribute_node = $doc->createElement($key, null);
> $attribute_node->appendChild($domAttribute);
> $node->appendChild($attribute_node);
129c132
< $val = ($val ? 1 : 0);
---
> $val = ($val ? 'true' : 'false');
143c146
< if(!isset($this->_values[$attr])) { continue; }
---
> if(!array_key_exists($attr, $this->_values)) { continue; }
150a154,160
>
> // Check for nested objects.
> if ($this->_values[$attr] instanceof Recurly_Resource) {
> if ($this->_values[$attr]->getChangedAttributes()) {
> $attributes[$attr] = $this->$attr;
> }
> }
diff -r html/sites/all/libraries/recurly_v2/recurly/response.php vendor/recurly/recurly-client/lib/recurly/response.php
85c85
< if (!$dom->loadXML($xml)) return null;
---
> if (empty($xml) || !$dom->loadXML($xml)) return null;
diff -r html/sites/all/libraries/recurly_v2/recurly/subscription.php vendor/recurly/recurly-client/lib/recurly/subscription.php
13c13,14
< 'timeframe', 'subscription_add_ons'
---
> 'timeframe', 'subscription_add_ons', 'net_terms', 'po_number', 'collection_method',
> 'cost_in_cents', 'remaining_billing_cycles', 'bulk'
18,19c19
< public function __construct($href = null, $client = null)
< {
---
> public function __construct($href = null, $client = null) {
31a32,39
> public function preview() {
> if ($this->uuid) {
> $this->_save(Recurly_Client::POST, $this->uri() . '/preview');
> } else {
> $this->_save(Recurly_Client::POST, Recurly_Client::PATH_SUBSCRIPTIONS . '/preview');
> }
> }
>
85,86c93,100
< public function postpone($nextRenewalDate) {
< $this->_save(Recurly_Client::PUT, $this->uri() . '/postpone?next_renewal_date=' . $nextRenewalDate);
---
> /**
> * Postpone a subscription's renewal date.
> *
> * $nextRenewalDate - ISO8601 DateTime String, postpone the subscription to this date
> * $bulk - bool, for making bulk updates, avoid checking for duplicate subscriptions.
> **/
> public function postpone($nextRenewalDate, $bulk = false) {
> $this->_save(Recurly_Client::PUT, $this->uri() . '/postpone?next_renewal_date=' . $nextRenewalDate . '&bulk=' . ((bool) $bulk));
diff -r html/sites/all/libraries/recurly_v2/recurly/subscription_addon.php vendor/recurly/recurly-client/lib/recurly/subscription_addon.php
5c5
< protected static $_writeableAttributes;
---
> protected static $_writeableAttributes;
7,21c7,21
< public static function init() {
< Recurly_SubscriptionAddOn::$_writeableAttributes = array(
< 'add_on_code',
< 'quantity',
< 'unit_amount_in_cents'
< );
< }
<
< protected function getNodeName() {
< return 'subscription_add_on';
< }
<
< protected function getWriteableAttributes() {
< return Recurly_SubscriptionAddOn::$_writeableAttributes;
< }
---
> public static function init() {
> Recurly_SubscriptionAddOn::$_writeableAttributes = array(
> 'add_on_code',
> 'quantity',
> 'unit_amount_in_cents'
> );
> }
>
> protected function getNodeName() {
> return 'subscription_add_on';
> }
>
> protected function getWriteableAttributes() {
> return Recurly_SubscriptionAddOn::$_writeableAttributes;
> }
26,29c26,29
< protected function populateXmlDoc(&$doc, &$node, &$obj, $nested = false) {
< $addonNode = $node->appendChild($doc->createElement($this->getNodeName()));
< parent::populateXmlDoc($doc, $addonNode, $obj);
< }
---
> protected function populateXmlDoc(&$doc, &$node, &$obj, $nested = false) {
> $addonNode = $node->appendChild($doc->createElement($this->getNodeName()));
> parent::populateXmlDoc($doc, $addonNode, $obj);
> }
31,34c31,33
< protected function getChangedAttributes($nested = false)
< {
< // Return all attributes
< return $this->_values;
---
> protected function getChangedAttributes($nested = false) {
> // Ignore the name, it can't be changed.
> return array_diff_key($this->_values, array('name' => 0));
Only in vendor/recurly/recurly-client/lib/recurly: tax_detail.php
diff -r html/sites/all/libraries/recurly_v2/recurly/transaction.php vendor/recurly/recurly-client/lib/recurly/transaction.php
28,31c28,32
< if (is_null($amountInCents))
< $this->_delete($this->uri());
< else
< $this->_delete($this->uri() . '?amount_in_cents=' . strval(intval($amountInCents)));
---
> $uri = $this->uri();
> if (!is_null($amountInCents)) {
> $uri .= '?amount_in_cents=' . strval(intval($amountInCents));
> }
> $this->_save(Recurly_Client::DELETE, $uri);
diff -r html/sites/all/libraries/recurly_v2/recurly.php vendor/recurly/recurly-client/lib/recurly.php
15a16
> require_once(dirname(__FILE__) . '/recurly/address.php');
26a28,29
> require_once(dirname(__FILE__) . '/recurly/note.php');
> require_once(dirname(__FILE__) . '/recurly/note_list.php');
32a36
> require_once(dirname(__FILE__) . '/recurly/tax_detail.php');
@icio

This comment has been minimized.

Copy link
Owner Author

icio commented Feb 2, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.