Skip to content

Commit 16573bc

Browse files
authored
[chore, feat] Send FedEx SmartPost registration to correct endpoint, prep carrier account parameters (#515)
- Add enums for some common carrier account types - Update carrier account creation endpoint flow to use enums - Reorg base-child relationship of carrier account creation parameter sets to remove unnecessary parameters - Add FedExSmartpost parameter set - FedExSmartpost uses different endpoint for creation - Update unit tests, re-record cassettes as needed - Reduce line coverage
1 parent 1b3192d commit 16573bc

File tree

17 files changed

+365
-199
lines changed

17 files changed

+365
-199
lines changed

EasyPost.Tests/Fixture.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ internal static Dictionary<string, object> BasicPickup
5656

5757
const string pickupDate = "2023-05-12";
5858

59-
fixture.AddOrUpdate("min_datetime", pickupDate);
60-
fixture.AddOrUpdate("max_datetime", pickupDate);
59+
fixture!.AddOrUpdate("min_datetime", pickupDate);
60+
fixture!.AddOrUpdate("max_datetime", pickupDate);
6161

6262
return fixture;
6363
}
@@ -227,7 +227,6 @@ internal static ParameterSets.CarrierAccount.Create Create(Dictionary<string, ob
227227
Reference = fixture.GetOrNull<string>("reference"),
228228
Credentials = fixture.GetOrNull<Dictionary<string, object?>>("credentials"),
229229
TestCredentials = fixture.GetOrNull<Dictionary<string, object?>>("test_credentials"),
230-
RegistrationData = fixture.GetOrNull<Dictionary<string, object?>>("registration_data"),
231230
};
232231
}
233232

@@ -239,8 +238,6 @@ internal static ParameterSets.CarrierAccount.CreateFedEx CreateFedEx(Dictionary<
239238
{
240239
Description = fixture.GetOrNull<string>("description"),
241240
Reference = fixture.GetOrNull<string>("reference"),
242-
Credentials = fixture.GetOrNull<Dictionary<string, object?>>("credentials"),
243-
TestCredentials = fixture.GetOrNull<Dictionary<string, object?>>("test_credentials"),
244241
AccountNumber = "123456789",
245242
CorporateAddressCity = "San Francisco",
246243
CorporateAddressCountryCode = "US",

EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public async Task TestCreateWithCustomWorkflow()
6060
// Carriers like FedEx and UPS should hit the `/carrier_accounts/register` endpoint
6161
Dictionary<string, object> data = Fixtures.BasicCarrierAccount;
6262

63-
Parameters.CarrierAccount.Create parameters = Fixtures.Parameters.CarrierAccounts.CreateFedEx(data);
63+
Parameters.CarrierAccount.CreateFedEx parameters = Fixtures.Parameters.CarrierAccounts.CreateFedEx(data);
6464

6565
try
6666
{
@@ -92,7 +92,7 @@ public async Task TestPreventUsersUsingGenericParameterSetWithCustomWorkflow()
9292
Dictionary<string, object> data = Fixtures.BasicCarrierAccount;
9393

9494
// Override the type to be a custom type
95-
data["type"] = Constants.CarrierAccountTypes.FedExAccount;
95+
data["type"] = CarrierAccountType.FedEx.Name;
9696
data["registration_data"] = new Dictionary<string, object>();
9797

9898
Parameters.CarrierAccount.Create parameters = Fixtures.Parameters.CarrierAccounts.Create(data);

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

Lines changed: 28 additions & 26 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_with_parameters/create_with_custom_workflow.json

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

0 commit comments

Comments
 (0)