Skip to content

Commit ef41ec4

Browse files
authored
Merge pull request #341 from recurly/version_2_10
Release client 2.10.0 / API version 2.10
2 parents 634d9ff + 89aad56 commit ef41ec4

File tree

3 files changed

+130
-3
lines changed

3 files changed

+130
-3
lines changed

CHANGELOG.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,132 @@
11
# Recurly PHP Client Library CHANGELOG
22

3+
## Version 2.10.0 (March 19th, 2018)
4+
5+
This release will upgrade us to API version 2.10.
6+
7+
* API Version 2.10 [#339](https://github.com/recurly/recurly-client-php/pull/339)
8+
* Add missing writeable fields to AddOn [#338](https://github.com/recurly/recurly-client-php/pull/338)
9+
* Removes links to singular subscription (thanks to @phpdave) [#340](https://github.com/recurly/recurly-client-php/pull/340)
10+
11+
### Upgrade Notes
12+
13+
There are several breaking changes to support the new credit memos feature.
14+
15+
#### 1. InvoiceCollection
16+
17+
When creating invoices or using `markFailed()`, we now return an `Recurly_InvoiceCollection` object rather than an `Recurly_Invoice`. If you wish to upgrade your application without changing functionality, we recommend that you use the `charge_invoice` on the `Recurly_InvoiceCollection`. Example:
18+
19+
```php
20+
# Change This:
21+
$invoice = Recurly_Invoice::invoicePendingCharges('my_account_code');
22+
23+
# To this
24+
$invoiceCollection = Recurly_Invoice::invoicePendingCharges('my_account_code');
25+
$invoice = $invoiceCollection->charge_invoice;
26+
```
27+
28+
Calls that now return `InvoiceCollection` instead of `Invoice`:
29+
30+
* `Recurly_Purchase::invoice()`
31+
* `Recurly_Purchase::preview()`
32+
* `Recurly_Purchase::authorize()`
33+
* `Recurly_Invoice::invoicePendingCharges()`
34+
* `Recurly_Invoice::previewPendingCharges()`
35+
36+
Furthermore, `Recurly_Invoice->markFailed()` no longer updates the invoice but rather returns a new `Recurly_InvoiceCollection` object:
37+
38+
```php
39+
# Change This:
40+
$invoice->markFailed();
41+
42+
# To this
43+
$invoiceCollection = $invoice->markFailed();
44+
$failedInvoice = $invoiceCollection->charge_invoice;
45+
```
46+
47+
#### 2. Recurly_Invoice->original_invoice removed
48+
49+
`Recurly_Invoice->original_invoice` was removed in favor of `Recurly_Invoice->original_invoices`. If you want to maintain functionality, change your code grab the first invoice from that endpoint:
50+
51+
```php
52+
# Change this
53+
$originalInvoice = $invoice->original_invoice->get();
54+
55+
# To this
56+
$originalInvoice = $invoice->original_invoices->get()->current(); # current is first item
57+
```
58+
59+
#### 3. Invoice `subtotal_*` changes
60+
61+
We have renamed two of the invoice subtotal fields to more clearly reflect their values:
62+
- Renamed `subtotal_in_cents` to `subtotal_before_discount_in_cents`
63+
- Renamed `subtotal_after_discount_in_cents` to `subtotal_in_cents`
64+
65+
#### 4. Invoice Refund -- `refund_apply_order` changed to `refund_method`
66+
67+
If you were using `Recurly_Invoice->refund` or `Recurly_Invoice->refundAmount` and explicitly setting the second `refund_apply_order` parameter, then you may need to change value to fit the new `refund_method` format. The values for this have changed from (`credit`, `transaction`) to (`credit_first`, `transaction_first`)
68+
69+
If you don't explicitly set the `refund_apply_order` like in these two calls, no change is needed:
70+
```php
71+
$invoice->refund($line_items);
72+
$invoice->refundAmount(1000);
73+
```
74+
75+
If you do set the second param, you'll need to change:
76+
* `credit` to `credit_first`
77+
* `transaction` to `transaction_first`
78+
79+
Examples:
80+
```php
81+
# Change `credit`:
82+
$invoice->refund($line_items, 'credit');
83+
$invoice->refundAmount(1000, 'credit');
84+
85+
# To `credit_first`
86+
$invoice->refund($line_items, 'credit_first');
87+
$invoice->refundAmount(1000, 'credit_first');
88+
89+
# Change `transaction`
90+
$invoice->refund($line_items, 'transaction');
91+
$invoice->refundAmount(1000, 'transaction');
92+
93+
# To `transaction_first`
94+
$invoice->refund($line_items, 'transaction_first');
95+
$invoice->refundAmount(1000, 'transaction_first');
96+
```
97+
98+
#### 5. Invoice States
99+
100+
If you are checking `Recurly_Invoice->state` anywhere, you will want to check that you have the new correct values. `collected` has changed to `paid` and `open` has changed to `pending`. Example:
101+
102+
```php
103+
# Change this
104+
if ($invoice->state == 'collected')
105+
# To this
106+
if ($invoice->state == 'paid')
107+
```
108+
```php
109+
# Change this
110+
if ($invoice->state == 'open')
111+
# To this
112+
if ($invoice->state == 'pending')
113+
```
114+
115+
This also affects the `Recurly_InvoiceList::getCollected()` and `Recurly_InvoiceList::getOpen()` functions. Example:
116+
117+
```php
118+
# Change this
119+
Recurly_InvoiceList::getCollected()
120+
# To this
121+
Recurly_InvoiceList::getPaid()
122+
```
123+
```php
124+
# Change this
125+
Recurly_InvoiceList::getOpen()
126+
# To this
127+
Recurly_InvoiceList::getPending()
128+
```
129+
3130
## Version 2.9.0 (October 6th, 2017)
4131

5132
This release will upgrade us to API version 2.8.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ date_default_timezone_set('America/Los_Angeles');
4343

4444
If you're using [Composer](http://getcomposer.org/), you can simply add a
4545
dependency on `recurly/recurly-client` to your project's `composer.json` file.
46-
Here's an example of a dependency on 2.7:
46+
Here's an example of a dependency on 2.10:
4747

4848
```json
4949
{
5050
"require": {
51-
"recurly/recurly-client": "2.8.*"
51+
"recurly/recurly-client": "2.10.*"
5252
}
5353
}
5454
```

lib/recurly/client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Recurly_Client
4444
*/
4545
private $_acceptLanguage = 'en-US';
4646

47-
const API_CLIENT_VERSION = '2.9.0';
47+
const API_CLIENT_VERSION = '2.10.0';
4848
const DEFAULT_ENCODING = 'UTF-8';
4949

5050
const GET = 'GET';

0 commit comments

Comments
 (0)