Skip to content

Commit e45d11f

Browse files
authored
Merge pull request #326 from EasyPost/v7.0.0
chore: prepare v7.0.0 for release
2 parents 6a08b4a + be97c0b commit e45d11f

File tree

6 files changed

+61
-22
lines changed

6 files changed

+61
-22
lines changed

CHANGELOG.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
# CHANGELOG
22

3-
## Next Major Release
3+
## v7.0.0 (2023-12-01)
4+
5+
Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md).
46

57
- Drops support for PHP 7.4
68
- Adds support for PHP 8.3
79
- Persists the HTTP client inside of the `EasyPostClient` via the `httpClient` property to reduce memory consumption on consecutive requests
8-
- Adds type hints for parameters and return values throughout the library, corrects docstring hints where necessary
10+
- Adds type declarations for parameters and return values throughout the library, corrects docstrings to match
911
- Removed `withCarbonOffset` parameter from `create`, `buy`, and `regenerateRates` functions of the Shipment service as EasyPost now offers Carbon Neutral shipments by default for free
1012
- Fixes a bug where the original filtering criteria of `all` calls wasn't passed along to `getNextPage` calls. Now, these are persisted via a `_params` key on response objects locally
1113
- Removes the undocumented `createAndBuy` function from the `Batch` service. The proper usage is to create a batch first and buy it separately
1214
- Renames `primaryOrSecondary` to `priority` to match the API name for the parameter
15+
- Corrects the order of the `userId` and `email` parameters in the `updateEmail` function of the ReferralCustomer service to match the rest of the library where IDs are always the first parameter
1316
- Fix various bugs throughout the library
1417

1518
## v6.9.1 (2023-11-20)
@@ -74,6 +77,8 @@
7477

7578
## v6.0.0 (2023-01-05)
7679

80+
Upgrading major versions of this project? Refer to the [Upgrade Guide](UPGRADE_GUIDE.md).
81+
7782
- Release final version of v6 that contains all the changes in the `v6.0.0-rc1` below
7883

7984
## v6.0.0-rc1 (2022-12-15)

UPGRADE_GUIDE.md

+49-13
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,48 @@
22

33
Use the following guide to assist in the upgrade process of the `easypost-php` library between major versions.
44

5+
- [Upgrading from 6.x to 7.0](#upgrading-from-6x-to-70)
56
- [Upgrading from 5.x to 6.0](#upgrading-from-5x-to-60)
67
- [Upgrading from 4.x to 5.0](#upgrading-from-4x-to-50)
78
- [Upgrading from 3.x to 4.0](#upgrading-from-3x-to-40)
89

10+
## Upgrading from 6.x to 7.0
11+
12+
### 7.0 High Impact Changes
13+
14+
- [Drop Support for PHP 7.4](#70-drop-support-for-php-74)
15+
- [Type Declarations Added](#70-type-declarations-added)
16+
- [Carbon Offset Removed](#70-carbon-offset-removed)
17+
18+
### 7.0 Low Impact Changes
19+
20+
- [createAndBuy Batch Function Removed](#70-createandbuy-batch-function-removed)
21+
- [updateEmail Parameter Order Corrected](#70-updateemail-parameter-order-corrected)
22+
23+
### 7.0 Drop Support for PHP 7.4
24+
25+
With the introduction of PHP 8.3, support for PHP 7.4 has been dropped. This library now requires PHP 8.0 or greater.
26+
27+
### 7.0 Type Declarations Added
28+
29+
The library previously had type hints available via docstrings. With PHP 8.0+ support, the library now has type declarations for every function parameter and return value. You will want to double check that the types passed to each function match the expectations to avoid `TypeError`s being thrown at runtime. Docstrings have been updated to match and assist IDEs in this process. You may notice some changes in what was expected before and the corrected types now. We've made every attempt to retain where possible the previous values or loose possible options to allow for the maximum backwards compatibility.
30+
31+
### 7.0 Carbon Offset Removed
32+
33+
EasyPost now offers Carbon Neutral shipments by default for free! Because of this, there is no longer a need to specify if you want to offset the carbon footprint of a shipment. The `withCarbonOffset` parameter of the `create`, `buy`, and `regenerateRates` shipment functions have been removed as a result. This is a high-impact change for those using `EndShippers` as the function interfaces have changed. You will need to inspect the callsites to create and buy shipments to ensure that the EndShipper parameter is being passed in the correct place now that the `withCarbonOffset` parameter has been removed.
34+
35+
### 7.0 createAndBuy Batch Function Removed
36+
37+
The `create_and_buy` Batch endpoint has been deprecated and has thus been removed from the library. The proper flow is to create a batch first and buy it separately with two API calls.
38+
39+
### 7.0 updateEmail Parameter Order Corrected
40+
41+
The `updateEmail` function of the `ReferralCustomer` service mistakenly had the `email` parameter first when it should have had `userId` first. This change has been made to ensure that every function that accepts an ID always has the ID come first. If you use this function, you will simply need to swap the order of the two parameters.
42+
943
## Upgrading from 5.x to 6.0
1044

45+
**NOTICE:** v6 is deprecated.
46+
1147
### 6.0 High Impact Changes
1248

1349
- [Drop Support for PHP 7.3](#60-drop-support-for-php-73)
@@ -20,11 +56,11 @@ Use the following guide to assist in the upgrade process of the `easypost-php` l
2056
- [Changed Function Return Types](#60-changed-function-return-types)
2157
- [Moved Functions](#60-moved-functions)
2258

23-
## 6.0 Drop Support for PHP 7.3
59+
### 6.0 Drop Support for PHP 7.3
2460

2561
With the introduction of PHP 8.2, support for PHP 7.3 has been dropped. This library now requires PHP 7.4 or greater.
2662

27-
## 6.0 New EasyPostClient Object
63+
### 6.0 New EasyPostClient Object
2864

2965
This library is now thread-safe with the introduction of a new `EasyPostClient` object. Instead of defining a global API key that all requests use, you create an `EasyPostClient` object and pass your API key to it. You then call your desired functions against a "service" which coincide with EasyPost objects:
3066

@@ -44,15 +80,15 @@ Previously used `->save()` instance methods are now static `update()` functions
4480

4581
Functions no longer accept an API key as an optional parameter. If you need per-function API key changes, create a new Client object and call the function on the new client that uses the API key you need.
4682

47-
## 6.0 Corrected Naming Conventions
83+
### 6.0 Corrected Naming Conventions
4884

4985
We previously had a mix of camelCase and snake_case function and parameter names in this library. These have all been corrected to only use `camelCase`. Things like `lowestRate`, `allApiKeys`, etc have changed.
5086

5187
The `Referral` class is now called `ReferralCustomer` to match our documentation and API.
5288

5389
Occurances of `smartrate` are now `smartRate` and `Smartrate` are now `SmartRate` to match the documentation and API expectations.
5490

55-
## 6.0 Improved Exceptions
91+
### 6.0 Improved Exceptions
5692

5793
Introduced ~2 dozen new exception types that extend from either `ApiException` or `EasyPostException`.
5894

@@ -89,13 +125,13 @@ ApiExceptions will behave like the previous EasyPostException class did. They wi
89125

90126
The `ecode` property of an `ApiException` is now just `code`
91127

92-
## 6.0 Changed Function Return Types
128+
### 6.0 Changed Function Return Types
93129

94130
Functions that previously returned `true` now return void as there is no response body from the API (eg: `fundWallet`, `deletePaymentMethod`, `updateEmail`, `createList`)
95131

96132
The results of calling `allApiKeys` is no longer double wrapped with the mode of the API key (these are still accessible inside of each object)
97133

98-
## 6.0 Moved Functions
134+
### 6.0 Moved Functions
99135

100136
The `validateWebhook`, `getLowestSmartRate`, and `receive` functions are now under `EasyPost\Util\Util` as they do not make any API calls and do not need the associated client object.
101137

@@ -121,7 +157,7 @@ The `receive` function previously in the namespace of `Event` is now called `rec
121157

122158
- [Removal of all Method from the Parcel Object](#50-removal-of-all-method-from-the-parcel-object)
123159

124-
## 5.0 Updating Dependencies
160+
### 5.0 Updating Dependencies
125161

126162
Likelihood of Impact: High
127163

@@ -133,7 +169,7 @@ easypost-php now requires PHP 7.3 or greater.
133169

134170
All dependencies had minor version bumps.
135171

136-
## 5.0 Default Timeouts for HTTP Requests
172+
### 5.0 Default Timeouts for HTTP Requests
137173

138174
Likelihood of Impact: Medium
139175

@@ -145,19 +181,19 @@ EasyPost::setConnectTimeout(30000);
145181
EasyPost::setResponseTimeout(60000);
146182
```
147183

148-
## 5.0 Removal of all() Method from the Order, CustomsInfo, and CustomsItem Objects
184+
### 5.0 Removal of all() Method from the Order, CustomsInfo, and CustomsItem Objects
149185

150186
Likelihood of Impact: Medium
151187

152188
The `/all` endpoint for the Order, CustomsInfo, and CustomsItem objects are not paginated and have therefore been removed from the library.
153189

154-
## 5.0 Removal of get_rates() Shipment Method
190+
### 5.0 Removal of get_rates() Shipment Method
155191

156192
Likelihood of Impact: Medium
157193

158194
The HTTP method used for the `get_rates` endpoint at the API level has changed from `POST` to `GET` and will only retrieve rates for a shipment instead of regenerating them. A new `/rerate` endpoint has been introduced to replace this functionality; In this library, you can now call the `Shipment::regenerate_rates` method to regenerate rates. Due to the logic change, the `get_rates` method has been removed since a Shipment inherently already has rates associated.
159195

160-
## 5.0 Removal of all() Method from the Parcel Object
196+
### 5.0 Removal of all() Method from the Parcel Object
161197

162198
Likelihood of Impact: Low
163199

@@ -175,13 +211,13 @@ There is no `/all` endpoint for the Parcel object. This function was removed as
175211

176212
- [Updating Dependencies](#40-updating-dependencies)
177213

178-
## 4.0 JSON Encoded Bodies
214+
### 4.0 JSON Encoded Bodies
179215

180216
Likelihood of Impact: High
181217

182218
All `POST` and `PUT` request bodies are now JSON encoded instead of form-encoded. You may see subtle inconsistencies to how certain data types were previously sent to the API. We have taken steps to mitigate and test against these edge cases.
183219

184-
## 4.0 Updating Dependencies
220+
### 4.0 Updating Dependencies
185221

186222
Likelihood of Impact: Low
187223

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "easypost/easypost-php",
33
"description": "EasyPost Shipping API Client Library for PHP",
4-
"version": "6.9.1",
4+
"version": "7.0.0",
55
"keywords": [
66
"shipping",
77
"api",

lib/EasyPost/Constant/Constants.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ abstract class Constants
1111
const BETA_API_VERSION = 'beta';
1212

1313
// Library constants
14-
const LIBRARY_VERSION = '6.9.1';
14+
const LIBRARY_VERSION = '7.0.0';
1515
const SUPPORT_EMAIL = '[email protected]';
1616

1717
// Validation

lib/EasyPost/Service/ReferralCustomerService.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,12 @@ public function create(mixed $params = null): mixed
5959
/**
6060
* Update an referral email.
6161
*
62-
* @param string $email
6362
* @param string $userId
63+
* @param string $email
6464
* @return void
6565
*/
66-
public function updateEmail(string $email, string $userId): void
66+
public function updateEmail(string $userId, string $email): void
6767
{
68-
// TODO: Swap the order of these params so ID comes first to match all other functions
69-
// this will be a breaking change and must be done when the next major release happens
7068
$wrappedParams = [
7169
'user' => [
7270
'email' => $email

test/EasyPost/ReferralCustomerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ public function testUpdateEmail(): void
105105

106106
try {
107107
self::$client->referralCustomer->updateEmail(
108+
$referralUsers['referral_customers'][0]['id'],
108109
109-
$referralUsers['referral_customers'][0]['id']
110110
);
111111
$this->assertTrue(true);
112112
} catch (\Exception $exception) {

0 commit comments

Comments
 (0)