Skip to content

fix: endpoint used for ups create/update #620

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

Merged
merged 2 commits into from
May 27, 2025
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v7.0.1 (2025-05-27)

- Corrects the endpoint used for creating/updating UPS accounts

## v7.0.0 (2025-04-29)

See our [Upgrade Guide](UPGRADE_GUIDE.md#upgrading-from-6x-to-70) for more details.
Expand Down
33 changes: 0 additions & 33 deletions EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,39 +145,6 @@ public async Task TestUpdate()
Assert.Equal(testDescription, carrierAccount.Description);
}

[Fact]
[CrudOperations.Create]
[Testing.Parameters]
public async Task TestUpdateWithCustomWorkflow()
{
UseMockClient(new List<TestUtils.MockRequest>
{
// Fake retrieving an existing UPS account
new(
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_123$"),
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
{
Id = "ca_123",
Type = CarrierAccountType.Ups.Name,
}
)
)
});

// UPS should trigger a function error since not supported by legacy parameter method
try
{
Dictionary<string, object> parameters = new Dictionary<string, object>();
CarrierAccount carrierAccount = await Client.CarrierAccount.Update("ca_123", parameters);
Assert.Fail("Expected an exception to be thrown");
}
catch (InvalidFunctionError e)
{
// Function should have been halted due to incompatible carrier account type
Assert.NotNull(e);
}
}

[Fact]
[CrudOperations.Delete]
[Testing.Function]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System.Collections.Generic;
using System.Net;
using System.Threading.Tasks;
using EasyPost.Exceptions.API;
using EasyPost.Exceptions.General;
using EasyPost.Http;
using EasyPost.Models.API;
using EasyPost.Tests._Utilities;
using EasyPost.Tests._Utilities.Attributes;
Expand Down Expand Up @@ -99,7 +97,7 @@ public async Task TestCreateUps()
{
UseVCR("create_ups");

// UPS should hit the `/ups_oauth_registrations` endpoint
// UPS should hit the `/carrier_account_oauth_registrations` endpoint
Dictionary<string, object> data = Fixtures.BasicCarrierAccount;

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

[Fact]
[CrudOperations.Create]
[Testing.Exception]
public async Task TestPreventUsersUsingGenericParameterSetWithCustomUpdateWorkflow()
{
UseMockClient(new List<TestUtils.MockRequest>
{
// Fake retrieving an existing UPS account
new(
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_123$"),
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
{
Id = "ca_123",
Type = CarrierAccountType.Ups.Name,
}
)
),
new(
new TestUtils.MockRequestMatchRules(Method.Get, @"v2\/carrier_accounts\/ca_456$"),
new TestUtils.MockRequestResponseInfo(HttpStatusCode.OK, data: new CarrierAccount
{
Id = "ca_456",
Type = CarrierAccountType.FedEx.Name,
}
)
),
});

Parameters.CarrierAccount.Update genericParameters = new();
Parameters.CarrierAccount.UpdateUps upsParameters = new();

// should raise an exception because we're using a generic Create set with a custom workflow type (UpsAccount)
await Assert.ThrowsAsync<InvalidParameterError>(async () => await Client.CarrierAccount.Update("ca_123", genericParameters));

// should raise an exception because we're using a UPS-specific Create set with a standard workflow type (FedExAccount)
await Assert.ThrowsAsync<InvalidParameterError>(async () => await Client.CarrierAccount.Update("ca_456", upsParameters));
}

#endregion

#endregion
Expand Down
56 changes: 28 additions & 28 deletions EasyPost.Tests/cassettes/net/carrier_account_service/create.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading