Skip to content

Commit 960bab0

Browse files
authored
Merge pull request #620 from EasyPost/ups_endpoint
fix: endpoint used for ups create/update
2 parents 16cced5 + 7b47988 commit 960bab0

File tree

21 files changed

+303
-448
lines changed

21 files changed

+303
-448
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## v7.0.1 (2025-05-27)
4+
5+
- Corrects the endpoint used for creating/updating UPS accounts
6+
37
## v7.0.0 (2025-04-29)
48

59
See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-6x-to-70) for more details.

EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -145,39 +145,6 @@ public async Task TestUpdate()
145145
Assert.Equal(testDescription, carrierAccount.Description);
146146
}
147147

148-
[Fact]
149-
[CrudOperations.Create]
150-
[Testing.Parameters]
151-
public async Task TestUpdateWithCustomWorkflow()
152-
{
153-
UseMockClient(new List<TestUtils.MockRequest>
154-
{
155-
// Fake retrieving an existing UPS account
156-
new(
157-
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_123$"),
158-
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
159-
{
160-
Id = "ca_123",
161-
Type = CarrierAccountType.Ups.Name,
162-
}
163-
)
164-
)
165-
});
166-
167-
// UPS should trigger a function error since not supported by legacy parameter method
168-
try
169-
{
170-
Dictionary<string, object> parameters = new Dictionary<string, object>();
171-
CarrierAccount carrierAccount = await Client.CarrierAccount.Update("ca_123", parameters);
172-
Assert.Fail("Expected an exception to be thrown");
173-
}
174-
catch (InvalidFunctionError e)
175-
{
176-
// Function should have been halted due to incompatible carrier account type
177-
Assert.NotNull(e);
178-
}
179-
}
180-
181148
[Fact]
182149
[CrudOperations.Delete]
183150
[Testing.Function]

EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
using System.Collections.Generic;
2-
using System.Net;
32
using System.Threading.Tasks;
43
using EasyPost.Exceptions.API;
54
using EasyPost.Exceptions.General;
6-
using EasyPost.Http;
75
using EasyPost.Models.API;
86
using EasyPost.Tests._Utilities;
97
using EasyPost.Tests._Utilities.Attributes;
@@ -99,7 +97,7 @@ public async Task TestCreateUps()
9997
{
10098
UseVCR("create_ups");
10199

102-
// UPS should hit the `/ups_oauth_registrations` endpoint
100+
// UPS should hit the `/carrier_account_oauth_registrations` endpoint
103101
Dictionary<string, object> data = Fixtures.BasicCarrierAccount;
104102

105103
Parameters.CarrierAccount.CreateUps parameters = Fixtures.Parameters.CarrierAccounts.CreateUps(data);
@@ -196,44 +194,6 @@ public async Task TestUpdateUps()
196194
// Assert.Equal(testDescription, carrierAccount.Description); // TODO: Uncomment when the UPS update endpoint is fixed
197195
}
198196

199-
[Fact]
200-
[CrudOperations.Create]
201-
[Testing.Exception]
202-
public async Task TestPreventUsersUsingGenericParameterSetWithCustomUpdateWorkflow()
203-
{
204-
UseMockClient(new List<TestUtils.MockRequest>
205-
{
206-
// Fake retrieving an existing UPS account
207-
new(
208-
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_123$"),
209-
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
210-
{
211-
Id = "ca_123",
212-
Type = CarrierAccountType.Ups.Name,
213-
}
214-
)
215-
),
216-
new(
217-
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_456$"),
218-
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
219-
{
220-
Id = "ca_456",
221-
Type = CarrierAccountType.FedEx.Name,
222-
}
223-
)
224-
),
225-
});
226-
227-
Parameters.CarrierAccount.Update genericParameters = new();
228-
Parameters.CarrierAccount.UpdateUps upsParameters = new();
229-
230-
// should raise an exception because we're using a generic Create set with a custom workflow type (UpsAccount)
231-
await Assert.ThrowsAsync<InvalidParameterError>(async () => await Client.CarrierAccount.Update("ca_123", genericParameters));
232-
233-
// should raise an exception because we're using a UPS-specific Create set with a standard workflow type (FedExAccount)
234-
await Assert.ThrowsAsync<InvalidParameterError>(async () => await Client.CarrierAccount.Update("ca_456", upsParameters));
235-
}
236-
237197
#endregion
238198

239199
#endregion

EasyPost.Tests/cassettes/net/carrier_account_service/create.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

EasyPost.Tests/cassettes/net/carrier_account_service/create_with_oauth.json

Lines changed: 28 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)