From 7a6b3b7ce0d44de435a3ab7c4f3b51d89a4cf10e Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Mon, 15 Jul 2024 14:35:52 -0600 Subject: [PATCH] [chore] Support new UPS carrier account create/update endpoint (#574) - Consolidate dictionary serialization process for easier re-usability - Add UPS-specific carrier account creation parameters - Mark legacy (dictionary) carrier account creation function as deprecated (does not support FedEx and UPS registrations) - Introduce new error type raised if invalid function called (guard clause for legacy carrier account creation function) - Add and update unit tests for carrier account creation + FedEx and UPS-specific tests - Add support for UPS carrier account update deviating flow - New parameter sets for UPS update - Add and update unit tests for carrier account updates - Add/re-record cassettes as needed - Add init-examples-submodule Make step - Update examples submodule --- EasyPost.Tests/Fixture.cs | 16 +- .../CarrierAccountServiceTest.cs | 51 ++++- .../CarrierAccountServiceTest.cs | 122 +++++++++-- .../net/carrier_account_service/all.json | 18 +- .../net/carrier_account_service/create.json | 52 ++--- .../create_with_custom_workflow.json | 52 ----- .../net/carrier_account_service/delete.json | 32 +-- .../net/carrier_account_service/retrieve.json | 46 ++--- .../net/carrier_account_service/update.json | 90 ++++---- .../create.json | 53 ++--- ...custom_workflow.json => create_fedex.json} | 14 +- .../create_ups.json | 143 +++++++++++++ .../update.json | 90 ++++---- .../update_ups.json | 193 ++++++++++++++++++ .../carrier_account_service/all.json | 18 +- .../carrier_account_service/create.json | 52 ++--- .../create_with_custom_workflow.json | 51 ----- .../carrier_account_service/delete.json | 34 +-- .../carrier_account_service/retrieve.json | 51 ++--- .../carrier_account_service/update.json | 90 ++++---- .../create.json | 51 +++-- ...custom_workflow.json => create_fedex.json} | 14 +- .../create_ups.json | 143 +++++++++++++ .../update.json | 91 ++++----- .../update_ups.json | 193 ++++++++++++++++++ EasyPost/Constants.cs | 56 ++++- .../General/InvalidFunctionError.cs | 19 ++ EasyPost/Models/API/CarrierAccountType.cs | 10 + EasyPost/Parameters/BaseParameters.cs | 60 +----- EasyPost/Parameters/CarrierAccount/Create.cs | 41 ++-- .../Parameters/CarrierAccount/CreateFedEx.cs | 20 +- .../CarrierAccount/CreateFedExSmartPost.cs | 32 ++- .../Parameters/CarrierAccount/CreateUps.cs | 122 +++-------- .../CreateUpsMailInnovations.cs | 62 ++++++ .../CarrierAccount/CreateUpsSurePost.cs | 62 ++++++ EasyPost/Parameters/CarrierAccount/Update.cs | 35 +++- .../Parameters/CarrierAccount/UpdateUps.cs | 40 ++++ .../UpdateUpsMailInnovations.cs | 40 ++++ .../CarrierAccount/UpdateUpsSurePost.cs | 40 ++++ EasyPost/Services/CarrierAccountService.cs | 56 ++++- .../Internal/Extensions/Dictionaries.cs | 61 +++++- Makefile | 9 +- examples | 2 +- 43 files changed, 1800 insertions(+), 727 deletions(-) delete mode 100644 EasyPost.Tests/cassettes/net/carrier_account_service/create_with_custom_workflow.json rename EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/{create_with_custom_workflow.json => create_fedex.json} (86%) create mode 100644 EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_ups.json create mode 100644 EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update_ups.json delete mode 100644 EasyPost.Tests/cassettes/netstandard/carrier_account_service/create_with_custom_workflow.json rename EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/{create_with_custom_workflow.json => create_fedex.json} (86%) create mode 100644 EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_ups.json create mode 100644 EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update_ups.json create mode 100644 EasyPost/Exceptions/General/InvalidFunctionError.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateUpsMailInnovations.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateUpsSurePost.cs create mode 100644 EasyPost/Parameters/CarrierAccount/UpdateUps.cs create mode 100644 EasyPost/Parameters/CarrierAccount/UpdateUpsMailInnovations.cs create mode 100644 EasyPost/Parameters/CarrierAccount/UpdateUpsSurePost.cs diff --git a/EasyPost.Tests/Fixture.cs b/EasyPost.Tests/Fixture.cs index b6874fb28..925c7f845 100644 --- a/EasyPost.Tests/Fixture.cs +++ b/EasyPost.Tests/Fixture.cs @@ -56,8 +56,8 @@ internal static Dictionary BasicPickup const string pickupDate = "2024-04-08"; - fixture!.AddOrUpdate("min_datetime", pickupDate); - fixture!.AddOrUpdate("max_datetime", pickupDate); + fixture!.AddOrUpdate(pickupDate, "min_datetime"); + fixture!.AddOrUpdate(pickupDate, "max_datetime"); return fixture; } @@ -258,6 +258,18 @@ internal static ParameterSets.CarrierAccount.CreateFedEx CreateFedEx(Dictionary< ShippingAddressStreet = "345 California St", }; } + + internal static ParameterSets.CarrierAccount.CreateUps CreateUps(Dictionary? fixture) + { + fixture ??= new Dictionary(); + + return new ParameterSets.CarrierAccount.CreateUps + { + Description = fixture.GetOrNull("description"), + Reference = fixture.GetOrNull("reference"), + AccountNumber = "123456789", + }; + } } internal static class CustomsInfo diff --git a/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs b/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs index bd87b4873..b761d963c 100644 --- a/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs +++ b/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs @@ -3,6 +3,7 @@ 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; @@ -56,24 +57,20 @@ public async Task TestCreateWithCustomWorkflow() { UseVCR("create_with_custom_workflow"); - // Carriers like FedEx and UPS should hit the `/carrier_accounts/register` endpoint + // FedEx or UPS should trigger a function error since not supported by legacy parameter method try { Dictionary parameters = Fixtures.BasicCarrierAccount; - parameters["type"] = "FedexAccount"; + parameters["type"] = CarrierAccountType.FedEx.Name; parameters["registration_data"] = new Dictionary(); CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); CleanUpAfterTest(carrierAccount.Id); } - catch (InvalidRequestError e) + catch (InvalidFunctionError e) { - // the data we're sending is invalid, we want to check that the API error is because of malformed data and not due to the endpoint - Assert.Equal(422, e.StatusCode); // 422 is fine. We don't want a 404 not found - Assert.NotNull(e.Errors); - Assert.Contains(e.Errors, error => error is { Field: "account_number", Message: "must be present and a string" }); - - // Check the cassette to make sure the endpoint is correct (it should be carrier_accounts/register) + // Function should have been halted due to incompatible carrier account type + Assert.NotNull(e); } } @@ -128,6 +125,39 @@ public async Task TestUpdate() Assert.Equal(testDescription, carrierAccount.Description); } + [Fact] + [CrudOperations.Create] + [Testing.Parameters] + public async Task TestUpdateWithCustomWorkflow() + { + UseMockClient(new List + { + // 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 parameters = new Dictionary(); + 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] @@ -203,8 +233,7 @@ public async Task TestCarrierFieldsJsonSerialization() Credentials = new Dictionary { { - "account_number", - new CarrierField + "account_number", new CarrierField { Visibility = "visible", Label = "DHL Account Number", diff --git a/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs b/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs index 42802210d..4f74e02c9 100644 --- a/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs +++ b/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs @@ -1,7 +1,9 @@ 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; @@ -53,18 +55,18 @@ public async Task TestCreate() [Fact] [CrudOperations.Create] [Testing.Parameters] - public async Task TestCreateWithCustomWorkflow() + public async Task TestCreateFedEx() { - UseVCR("create_with_custom_workflow"); + UseVCR("create_fedex"); - // Carriers like FedEx and UPS should hit the `/carrier_accounts/register` endpoint + // FedEx should hit the `/carrier_accounts/register` endpoint Dictionary data = Fixtures.BasicCarrierAccount; Parameters.CarrierAccount.CreateFedEx parameters = Fixtures.Parameters.CarrierAccounts.CreateFedEx(data); try { - // confirms we can pass in CreateFedEx and CreateUps parameters to the same Create method because they are children of the generic Create class + // confirms we can pass in CreateFedEx parameters to the same Create method because they are children of the generic Create class CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); CleanUpAfterTest(carrierAccount.Id); } @@ -81,24 +83,52 @@ public async Task TestCreateWithCustomWorkflow() } } + [Fact] + [CrudOperations.Create] + [Testing.Parameters] + public async Task TestCreateUps() + { + UseVCR("create_ups"); + + // UPS should hit the `/ups_oauth_registrations` endpoint + Dictionary data = Fixtures.BasicCarrierAccount; + + Parameters.CarrierAccount.CreateUps parameters = Fixtures.Parameters.CarrierAccounts.CreateUps(data); + + // confirms we can pass in CreateUps parameters to the same Create method because they are children of the generic Create class + CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); + CleanUpAfterTest(carrierAccount.Id); + + Assert.IsType(carrierAccount); + Assert.StartsWith("ca_", carrierAccount.Id); + } + [Fact] [CrudOperations.Create] [Testing.Exception] - public async Task TestPreventUsersUsingGenericParameterSetWithCustomWorkflow() + public async Task TestPreventUsersUsingGenericParameterSetWithCustomCreateWorkflow() { - UseVCR("prevent_users_using_generic_parameter_set_with_custom_workflow"); + UseVCR("prevent_users_using_generic_parameter_set_with_custom_create_workflow"); - // Generic Create parameter set configured for DHL Dictionary data = Fixtures.BasicCarrierAccount; - // Override the type to be a custom type - data["type"] = CarrierAccountType.FedEx.Name; - data["registration_data"] = new Dictionary(); + // Generic Create parameter set configured for DHL + Parameters.CarrierAccount.Create standardParameters = Fixtures.Parameters.CarrierAccounts.Create(data); - Parameters.CarrierAccount.Create parameters = Fixtures.Parameters.CarrierAccounts.Create(data); + // Override the type to be a custom type + standardParameters.Type = CarrierAccountType.FedEx.Name; // should raise an exception because we're using a generic Create set with a custom workflow type (FedExAccount) - await Assert.ThrowsAsync(async () => await Client.CarrierAccount.Create(parameters)); + await Assert.ThrowsAsync(async () => await Client.CarrierAccount.Create(standardParameters)); + + // Specialized CreateFedEx parameter set configured for FedEx + Parameters.CarrierAccount.CreateFedEx fedExParameters = Fixtures.Parameters.CarrierAccounts.CreateFedEx(data); + + // Override the type to be a standard type + fedExParameters.Type = "DhlExpressAccount"; + + // should raise an exception because we're using a FedEx-specific Create set with a standard workflow type (DhlExpressAccount) + await Assert.ThrowsAsync(async () => await Client.CarrierAccount.Create(fedExParameters)); } [Fact] @@ -112,7 +142,7 @@ public async Task TestUpdate() Parameters.CarrierAccount.Create createParameters = Fixtures.Parameters.CarrierAccounts.Create(data); - CarrierAccount carrierAccount = await Client.CarrierAccount.Create(createParameters); + CarrierAccount carrierAccount = await Client.CarrierAccount.Create(createParameters); // DHL Express CleanUpAfterTest(carrierAccount.Id); const string testDescription = "my custom description"; @@ -129,6 +159,72 @@ public async Task TestUpdate() Assert.Equal(testDescription, carrierAccount.Description); } + [Fact] + [CrudOperations.Update] + [Testing.Parameters] + public async Task TestUpdateUps() + { + UseVCR("update_ups"); + + Dictionary data = Fixtures.BasicCarrierAccount; + + Parameters.CarrierAccount.CreateUps createParameters = Fixtures.Parameters.CarrierAccounts.CreateUps(data); + + CarrierAccount carrierAccount = await Client.CarrierAccount.Create(createParameters); + CleanUpAfterTest(carrierAccount.Id); + + const string testDescription = "my custom description"; + + Parameters.CarrierAccount.UpdateUps updateParameters = new() + { + Description = testDescription, + }; + + carrierAccount = await Client.CarrierAccount.Update(carrierAccount.Id, updateParameters); + + Assert.IsType(carrierAccount); + Assert.StartsWith("ca_", carrierAccount.Id); + // 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 + { + // 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(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(async () => await Client.CarrierAccount.Update("ca_456", upsParameters)); + } + #endregion #endregion diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/all.json b/EasyPost.Tests/cassettes/net/carrier_account_service/all.json index 135ab6d30..14cf6849e 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/all.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service/all.json @@ -1,7 +1,7 @@ [ { - "Duration": 301, - "RecordedAt": "2024-04-05T13:24:56.010106-06:00", + "Duration": 369, + "RecordedAt": "2024-07-08T17:59:34.383282-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -14,12 +14,12 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "[{\"id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"object\":\"CarrierAccount\",\"type\":\"UspsAccount\",\"clone\":false,\"created_at\":\"2018-04-20T16:42:21Z\",\"updated_at\":\"2018-04-20T17:05:01Z\",\"description\":\"USPS Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_fd8b148e541d4163b02cc21afe2aaac8\",\"object\":\"CarrierAccount\",\"type\":\"DhlExpressDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:02Z\",\"updated_at\":\"2022-05-25T18:59:02Z\",\"description\":\"DHL Express Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"DHL Express\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_06c27c7bc8484ff299ec84bdc2a5be38\",\"object\":\"CarrierAccount\",\"type\":\"LsoDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:04Z\",\"updated_at\":\"2022-05-25T18:59:04Z\",\"description\":\"LSO Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"LSO\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_ba94eaaacddb4bf2b135953b3067e817\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:31Z\",\"updated_at\":\"2022-05-26T19:03:31Z\",\"description\":\"UPS Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_0b351eb47cac405dadaf54c659c0a0eb\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:32Z\",\"updated_at\":\"2022-05-26T19:03:33Z\",\"description\":\"My custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_34d97dc9d5df46e48c088455935bc518\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-06-04T00:17:14Z\",\"updated_at\":\"2022-06-04T00:17:15Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_591d414609684bada7f2a2c6a1734bf7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:53Z\",\"updated_at\":\"2022-10-13T23:02:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45999a4724c44dfcbd69483ee174502a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:54Z\",\"updated_at\":\"2022-10-13T23:02:54Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45bdeb10ddbe45d4a74330c744000d36\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:55Z\",\"updated_at\":\"2022-10-13T23:03:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_d85d6d6612ee4de1b27e32ead463e1f0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:56Z\",\"updated_at\":\"2022-10-13T23:03:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}]", + "Body": "[{\"id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"object\":\"CarrierAccount\",\"type\":\"UspsAccount\",\"clone\":false,\"created_at\":\"2018-04-20T16:42:21Z\",\"updated_at\":\"2018-04-20T17:05:01Z\",\"description\":\"USPS Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_fd8b148e541d4163b02cc21afe2aaac8\",\"object\":\"CarrierAccount\",\"type\":\"DhlExpressDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:02Z\",\"updated_at\":\"2022-05-25T18:59:02Z\",\"description\":\"DHL Express Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"DHL Express\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_06c27c7bc8484ff299ec84bdc2a5be38\",\"object\":\"CarrierAccount\",\"type\":\"LsoDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:04Z\",\"updated_at\":\"2022-05-25T18:59:04Z\",\"description\":\"LSO Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"LSO\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_ba94eaaacddb4bf2b135953b3067e817\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:31Z\",\"updated_at\":\"2022-05-26T19:03:31Z\",\"description\":\"UPS Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_0b351eb47cac405dadaf54c659c0a0eb\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:32Z\",\"updated_at\":\"2022-05-26T19:03:33Z\",\"description\":\"My custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_34d97dc9d5df46e48c088455935bc518\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-06-04T00:17:14Z\",\"updated_at\":\"2022-06-04T00:17:15Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_591d414609684bada7f2a2c6a1734bf7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:53Z\",\"updated_at\":\"2022-10-13T23:02:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45999a4724c44dfcbd69483ee174502a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:54Z\",\"updated_at\":\"2022-10-13T23:02:54Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45bdeb10ddbe45d4a74330c744000d36\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:55Z\",\"updated_at\":\"2022-10-13T23:03:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_d85d6d6612ee4de1b27e32ead463e1f0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:56Z\",\"updated_at\":\"2022-10-13T23:03:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_791e2b3f2bff43e298d6dd803ab41569\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:39:32Z\",\"updated_at\":\"2024-07-08T23:39:33Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}]", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", "Content-Type": "application/json; charset=utf-8", - "Content-Length": "9071" + "Content-Length": "11154" }, "HttpVersion": "1.1", "ResponseHeaders": { @@ -29,14 +29,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a466105008f42b6b8f000fa565", + "x-ep-request-uuid": "df6fc7b8668c7d66f42bebd00049ac78", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.129930", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.187613", + "x-node": "bigweb42nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/create.json b/EasyPost.Tests/cassettes/net/carrier_account_service/create.json index ef0ddce3b..5c6807b49 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/create.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service/create.json @@ -1,7 +1,7 @@ [ { - "Duration": 319, - "RecordedAt": "2024-04-05T13:24:55.168985-06:00", + "Duration": 250, + "RecordedAt": "2024-07-08T17:59:33.771956-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_45e451d95da84af79acc2975e631a0e7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:55Z\",\"updated_at\":\"2024-04-05T19:24:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_b777a9e7ee2d44ab90f2eae61c1a30e0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:33Z\",\"updated_at\":\"2024-07-08T23:59:33Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,15 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a666105007f4501c29000fa4b4", + "x-ep-request-uuid": "df6fc7b3668c7d65f020723d0049ac1e", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.136809", - "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.065559", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -50,8 +49,8 @@ } }, { - "Duration": 71, - "RecordedAt": "2024-04-05T13:24:55.265781-06:00", + "Duration": 79, + "RecordedAt": "2024-07-08T17:59:33.865595-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -61,10 +60,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_45e451d95da84af79acc2975e631a0e7" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_b777a9e7ee2d44ab90f2eae61c1a30e0" }, "Response": { - "Body": "{\"id\":\"ca_45e451d95da84af79acc2975e631a0e7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:55Z\",\"updated_at\":\"2024-04-05T19:24:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_b777a9e7ee2d44ab90f2eae61c1a30e0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:33Z\",\"updated_at\":\"2024-07-08T23:59:33Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -79,14 +78,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a666105007f4501c29000fa4e6", + "x-ep-request-uuid": "df6fc7b3668c7d65f020723d0049ac2d", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.030692", - "x-node": "bigweb39nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.042849", + "x-node": "bigweb43nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -96,8 +96,8 @@ } }, { - "Duration": 156, - "RecordedAt": "2024-04-05T13:24:55.433404-06:00", + "Duration": 100, + "RecordedAt": "2024-07-08T17:59:33.980131-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -107,7 +107,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_45e451d95da84af79acc2975e631a0e7" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_b777a9e7ee2d44ab90f2eae61c1a30e0" }, "Response": { "Body": "{}", @@ -125,14 +125,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a666105007f4501c29000fa4fa", + "x-ep-request-uuid": "df6fc7b3668c7d66f020723d0049ac3d", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.118257", - "x-node": "bigweb35nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.061128", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/create_with_custom_workflow.json b/EasyPost.Tests/cassettes/net/carrier_account_service/create_with_custom_workflow.json deleted file mode 100644 index 3eae0478c..000000000 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/create_with_custom_workflow.json +++ /dev/null @@ -1,52 +0,0 @@ -[ - { - "Duration": 205, - "RecordedAt": "2024-04-05T13:24:55.653375-06:00", - "Request": { - "Body": "{\"carrier_account\":{\"type\":\"FedexAccount\",\"credentials\":{},\"test_credentials\":{},\"registration_data\":{}}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "299" - }, - "Method": "POST", - "RequestHeaders": { - "Authorization": "", - "User-Agent": "" - }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/register" - }, - "Response": { - "Body": "{\"error\":{\"code\":\"UNPROCESSABLE_ENTITY\",\"message\":\"The request was understood, but cannot be processed.\",\"errors\":[{\"field\":\"shipping_streets\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_city\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_state\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_postal_code\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_country_code\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_first_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_last_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_job_title\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_company_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_phone_number\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_email_address\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_streets\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_city\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_state\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_postal_code\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_country_code\",\"message\":\"must be present and a string\"},{\"field\":\"account_number\",\"message\":\"must be present and a string\"}]}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Expires": "0", - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "1347" - }, - "HttpVersion": "1.1", - "ResponseHeaders": { - "X-Frame-Options": "SAMEORIGIN", - "X-XSS-Protection": "1; mode=block", - "X-Content-Type-Options": "nosniff", - "x-download-options": "noopen", - "x-permitted-cross-domain-policies": "none", - "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a066105007f42d0032000fa53b", - "Cache-Control": "no-store, no-cache, private", - "Pragma": "no-cache", - "x-runtime": "0.040778", - "x-node": "bigweb32nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", - "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" - }, - "Status": { - "Code": 422, - "Message": "Unprocessable Entity" - } - } - } -] diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/delete.json b/EasyPost.Tests/cassettes/net/carrier_account_service/delete.json index bb0de52ed..406a70fc1 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/delete.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service/delete.json @@ -1,7 +1,7 @@ [ { - "Duration": 316, - "RecordedAt": "2024-04-05T13:24:57.043091-06:00", + "Duration": 251, + "RecordedAt": "2024-07-08T17:59:35.297322-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_608a5969297c4a6d980262bde1e9ff71\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:57Z\",\"updated_at\":\"2024-04-05T19:24:57Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_5b27232b2d9e42cb9eed936a6693ebc3\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:35Z\",\"updated_at\":\"2024-07-08T23:59:35Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a266105009f4096c6b000fa646", + "x-ep-request-uuid": "b98ca9f2668c7d67f023337c004a8a6f", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.132506", - "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.075165", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +49,8 @@ } }, { - "Duration": 150, - "RecordedAt": "2024-04-05T13:24:57.208403-06:00", + "Duration": 104, + "RecordedAt": "2024-07-08T17:59:35.414904-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,7 +60,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_608a5969297c4a6d980262bde1e9ff71" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_5b27232b2d9e42cb9eed936a6693ebc3" }, "Response": { "Body": "{}", @@ -78,15 +78,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a266105009f4096c6b000fa66a", + "x-ep-request-uuid": "b98ca9f2668c7d67f023337c004a8a86", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.109302", - "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.064282", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/retrieve.json b/EasyPost.Tests/cassettes/net/carrier_account_service/retrieve.json index bcf40d455..d904bb3ae 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/retrieve.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service/retrieve.json @@ -1,7 +1,7 @@ [ { - "Duration": 285, - "RecordedAt": "2024-04-05T13:24:56.315824-06:00", + "Duration": 258, + "RecordedAt": "2024-07-08T17:59:34.702174-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_00535cf93a8d41b4962e957e3881b0c4\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:56Z\",\"updated_at\":\"2024-04-05T19:24:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_5b56c449724c4372af0ac59c810163a1\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:34Z\",\"updated_at\":\"2024-07-08T23:59:34Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105008f41d2dcc000fa5aa", + "x-ep-request-uuid": "df6fc7b6668c7d66f41a5b270049acdb", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.124469", - "x-node": "bigweb53nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.079848", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +49,8 @@ } }, { - "Duration": 67, - "RecordedAt": "2024-04-05T13:24:56.500361-06:00", + "Duration": 74, + "RecordedAt": "2024-07-08T17:59:34.9083-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,10 +60,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_00535cf93a8d41b4962e957e3881b0c4" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_5b56c449724c4372af0ac59c810163a1" }, "Response": { - "Body": "{\"id\":\"ca_00535cf93a8d41b4962e957e3881b0c4\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:56Z\",\"updated_at\":\"2024-04-05T19:24:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_5b56c449724c4372af0ac59c810163a1\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:34Z\",\"updated_at\":\"2024-07-08T23:59:34Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -78,15 +78,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105008f41d2dcc000fa5e5", + "x-ep-request-uuid": "df6fc7b6668c7d66f41a5b270049ad0c", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.029418", + "x-runtime": "0.034197", "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", "x-canary": "direct", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -96,8 +96,8 @@ } }, { - "Duration": 160, - "RecordedAt": "2024-04-05T13:24:56.69807-06:00", + "Duration": 103, + "RecordedAt": "2024-07-08T17:59:35.024422-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -107,7 +107,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_00535cf93a8d41b4962e957e3881b0c4" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_5b56c449724c4372af0ac59c810163a1" }, "Response": { "Body": "{}", @@ -125,14 +125,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105008f41d2dcc000fa5f1", + "x-ep-request-uuid": "df6fc7b6668c7d67f41a5b270049ad1a", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.111219", + "x-runtime": "0.061805", "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service/update.json b/EasyPost.Tests/cassettes/net/carrier_account_service/update.json index 9c2b38196..6ab1d7ed1 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service/update.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service/update.json @@ -1,7 +1,7 @@ [ { - "Duration": 496, - "RecordedAt": "2024-04-05T13:24:53.924767-06:00", + "Duration": 549, + "RecordedAt": "2024-07-08T17:59:32.805029-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_721a699079914d58b2f7baead8b308b3\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:53Z\",\"updated_at\":\"2024-04-05T19:24:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_fe2931558a5d4eeaa46ec5ff7b865fa1\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:32Z\",\"updated_at\":\"2024-07-08T23:59:32Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105005f440ca0f000fa331", + "x-ep-request-uuid": "b98ca9f1668c7d64f3f526f0004a8896", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.132309", - "x-node": "bigweb39nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.181271", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,24 +49,21 @@ } }, { - "Duration": 350, - "RecordedAt": "2024-04-05T13:24:54.443131-06:00", + "Duration": 187, + "RecordedAt": "2024-07-08T17:59:33.381826-06:00", "Request": { - "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "59" - }, - "Method": "PUT", + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_721a699079914d58b2f7baead8b308b3" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_fe2931558a5d4eeaa46ec5ff7b865fa1" }, "Response": { - "Body": "{\"id\":\"ca_721a699079914d58b2f7baead8b308b3\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:53Z\",\"updated_at\":\"2024-04-05T19:24:54Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_fe2931558a5d4eeaa46ec5ff7b865fa1\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:32Z\",\"updated_at\":\"2024-07-08T23:59:33Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -81,14 +78,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105006f440ca0f000fa3bc", + "x-ep-request-uuid": "b98ca9f1668c7d65f3f526f0004a8935", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.163236", - "x-node": "bigweb42nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.147098", + "x-node": "bigweb36nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -98,21 +95,24 @@ } }, { - "Duration": 79, - "RecordedAt": "2024-04-05T13:24:54.626474-06:00", + "Duration": 145, + "RecordedAt": "2024-07-08T17:59:33.160922-06:00", "Request": { - "Body": "", - "BodyContentType": "Text", - "ContentHeaders": {}, - "Method": "GET", + "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "59" + }, + "Method": "PUT", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_721a699079914d58b2f7baead8b308b3" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_fe2931558a5d4eeaa46ec5ff7b865fa1" }, "Response": { - "Body": "{\"id\":\"ca_721a699079914d58b2f7baead8b308b3\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:53Z\",\"updated_at\":\"2024-04-05T19:24:54Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_fe2931558a5d4eeaa46ec5ff7b865fa1\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:32Z\",\"updated_at\":\"2024-07-08T23:59:33Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -127,14 +127,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105006f440ca0f000fa428", + "x-ep-request-uuid": "b98ca9f1668c7d65f3f526f0004a8914", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.038675", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.108669", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -144,8 +144,8 @@ } }, { - "Duration": 157, - "RecordedAt": "2024-04-05T13:24:54.794648-06:00", + "Duration": 96, + "RecordedAt": "2024-07-08T17:59:33.496008-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -155,7 +155,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_721a699079914d58b2f7baead8b308b3" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_fe2931558a5d4eeaa46ec5ff7b865fa1" }, "Response": { "Body": "{}", @@ -173,14 +173,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a366105006f440ca0f000fa446", + "x-ep-request-uuid": "b98ca9f1668c7d65f3f526f0004a8962", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.110938", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.056660", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create.json b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create.json index 7611c8563..b9bd849eb 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create.json @@ -1,7 +1,7 @@ [ { - "Duration": 322, - "RecordedAt": "2024-04-05T13:24:55.238244-06:00", + "Duration": 353, + "RecordedAt": "2024-07-08T17:58:58.582466-06:00", "Request": { "Body": "{\"carrier_account\":{\"credentials\":{},\"test_credentials\":{},\"type\":\"DhlEcsAccount\"}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_44f6e60d3a594e7ab16c566054e96d99\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:55Z\",\"updated_at\":\"2024-04-05T19:24:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_10dbd6c5acd7443e9a27e9cbec30ee47\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:58Z\",\"updated_at\":\"2024-07-08T23:58:58Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a066105007f3f6c2e7000fa4c6", + "x-ep-request-uuid": "b98ca9f1668c7d42f3f84aef004a6f50", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.143444", - "x-node": "bigweb36nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.162201", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +50,8 @@ } }, { - "Duration": 70, - "RecordedAt": "2024-04-05T13:24:55.322436-06:00", + "Duration": 77, + "RecordedAt": "2024-07-08T17:58:58.670935-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,10 +61,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_44f6e60d3a594e7ab16c566054e96d99" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_10dbd6c5acd7443e9a27e9cbec30ee47" }, "Response": { - "Body": "{\"id\":\"ca_44f6e60d3a594e7ab16c566054e96d99\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:55Z\",\"updated_at\":\"2024-04-05T19:24:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_10dbd6c5acd7443e9a27e9cbec30ee47\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:58Z\",\"updated_at\":\"2024-07-08T23:58:58Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -78,14 +79,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a066105007f3f6c2e7000fa4f0", + "x-ep-request-uuid": "b98ca9f1668c7d42f3f84aef004a6f64", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.032042", - "x-node": "bigweb34nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.036139", + "x-node": "bigweb43nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -95,8 +97,8 @@ } }, { - "Duration": 153, - "RecordedAt": "2024-04-05T13:24:55.501856-06:00", + "Duration": 103, + "RecordedAt": "2024-07-08T17:58:58.785476-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -106,7 +108,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_44f6e60d3a594e7ab16c566054e96d99" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_10dbd6c5acd7443e9a27e9cbec30ee47" }, "Response": { "Body": "{}", @@ -124,15 +126,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a066105007f3f6c2e7000fa50e", + "x-ep-request-uuid": "b98ca9f1668c7d42f3f84aef004a6f72", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.111598", - "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.066303", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_with_custom_workflow.json b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_fedex.json similarity index 86% rename from EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_with_custom_workflow.json rename to EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_fedex.json index 8446b1c1d..c792f788c 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_with_custom_workflow.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_fedex.json @@ -1,7 +1,7 @@ [ { - "Duration": 636, - "RecordedAt": "2024-04-05T13:24:56.180147-06:00", + "Duration": 515, + "RecordedAt": "2024-07-08T17:58:58.194025-06:00", "Request": { "Body": "{\"carrier_account\":{\"registration_data\":{\"account_number\":\"123456789\",\"corporate_city\":\"San Francisco\",\"corporate_country_code\":\"US\",\"corporate_postal_code\":\"94105\",\"corporate_state\":\"CA\",\"corporate_streets\":\"345 California St\",\"corporate_company_name\":\"EasyPost\",\"corporate_email_address\":\"me@example.com\",\"corporate_first_name\":\"Demo\",\"corporate_job_title\":\"Developer\",\"corporate_last_name\":\"User\",\"corporate_phone_number\":\"5555555555\",\"shipping_city\":\"San Francisco\",\"shipping_country_code\":\"US\",\"shipping_postal_code\":\"94105\",\"shipping_state\":\"CA\",\"shipping_streets\":\"345 California St\"},\"type\":\"FedexAccount\"}}", "BodyContentType": "Json", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a766105007f43045ec000fa549", + "x-ep-request-uuid": "df6fc7b3668c7d41f3f974d10049937c", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.464939", - "x-node": "bigweb53nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.331076", + "x-node": "bigweb38nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_ups.json b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_ups.json new file mode 100644 index 000000000..53ed14f5c --- /dev/null +++ b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/create_ups.json @@ -0,0 +1,143 @@ +[ + { + "Duration": 278, + "RecordedAt": "2024-07-08T17:58:57.440062-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsAccount\"},\"type\":\"UpsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "98" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations" + }, + "Response": { + "Body": "{\"id\":\"ca_1064fca3f13e4a97bf7acc8a90312b3d\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:57Z\",\"updated_at\":\"2024-07-08T23:58:57Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1396" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b5668c7d41f0220e3b0049933e", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.105226", + "x-node": "bigweb38nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + }, + { + "Duration": 77, + "RecordedAt": "2024-07-08T17:58:57.532776-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_1064fca3f13e4a97bf7acc8a90312b3d" + }, + "Response": { + "Body": "{\"id\":\"ca_1064fca3f13e4a97bf7acc8a90312b3d\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:57Z\",\"updated_at\":\"2024-07-08T23:58:57Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1396" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b5668c7d41f0220e3b00499356", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.037664", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 105, + "RecordedAt": "2024-07-08T17:58:57.653122-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "DELETE", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_1064fca3f13e4a97bf7acc8a90312b3d" + }, + "Response": { + "Body": "{}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b5668c7d41f0220e3b00499361", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.064331", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update.json b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update.json index 0e5265068..57c29658a 100644 --- a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update.json +++ b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update.json @@ -1,7 +1,7 @@ [ { - "Duration": 605, - "RecordedAt": "2024-04-05T13:24:54.074066-06:00", + "Duration": 415, + "RecordedAt": "2024-07-08T17:58:56.310932-06:00", "Request": { "Body": "{\"carrier_account\":{\"credentials\":{},\"test_credentials\":{},\"type\":\"DhlEcsAccount\"}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_3b8f215c6bda42cabb5a7d737be3f7cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:54Z\",\"updated_at\":\"2024-04-05T19:24:54Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_32826247048b4be49cb58346b9a38db2\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:56Z\",\"updated_at\":\"2024-07-08T23:58:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a766105006f42e0f89000fa369", + "x-ep-request-uuid": "b98ca9ef668c7d40f41af7ee004a6dfb", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.125375", - "x-node": "bigweb39nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.072904", + "x-node": "bigweb41nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,24 +49,21 @@ } }, { - "Duration": 266, - "RecordedAt": "2024-04-05T13:24:54.501717-06:00", + "Duration": 82, + "RecordedAt": "2024-07-08T17:58:56.86012-06:00", "Request": { - "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "59" - }, - "Method": "PUT", + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3b8f215c6bda42cabb5a7d737be3f7cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_32826247048b4be49cb58346b9a38db2" }, "Response": { - "Body": "{\"id\":\"ca_3b8f215c6bda42cabb5a7d737be3f7cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:54Z\",\"updated_at\":\"2024-04-05T19:24:54Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_32826247048b4be49cb58346b9a38db2\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:56Z\",\"updated_at\":\"2024-07-08T23:58:56Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -81,14 +78,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a766105006f42e0f89000fa3d6", + "x-ep-request-uuid": "b98ca9ef668c7d40f41af7ee004a6e5d", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.139887", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.040132", + "x-node": "bigweb42nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -98,21 +95,24 @@ } }, { - "Duration": 73, - "RecordedAt": "2024-04-05T13:24:54.670706-06:00", + "Duration": 251, + "RecordedAt": "2024-07-08T17:58:56.746541-06:00", "Request": { - "Body": "", - "BodyContentType": "Text", - "ContentHeaders": {}, - "Method": "GET", + "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "59" + }, + "Method": "PUT", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3b8f215c6bda42cabb5a7d737be3f7cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_32826247048b4be49cb58346b9a38db2" }, "Response": { - "Body": "{\"id\":\"ca_3b8f215c6bda42cabb5a7d737be3f7cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:24:54Z\",\"updated_at\":\"2024-04-05T19:24:54Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_32826247048b4be49cb58346b9a38db2\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:56Z\",\"updated_at\":\"2024-07-08T23:58:56Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -127,14 +127,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a766105006f42e0f89000fa433", + "x-ep-request-uuid": "b98ca9ef668c7d40f41af7ee004a6e31", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.027985", - "x-node": "bigweb34nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.210394", + "x-node": "bigweb41nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -144,8 +144,8 @@ } }, { - "Duration": 150, - "RecordedAt": "2024-04-05T13:24:54.871908-06:00", + "Duration": 219, + "RecordedAt": "2024-07-08T17:58:57.097815-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -155,7 +155,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3b8f215c6bda42cabb5a7d737be3f7cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_32826247048b4be49cb58346b9a38db2" }, "Response": { "Body": "{}", @@ -173,14 +173,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "Referrer-Policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "1f0ae7a766105006f42e0f89000fa458", + "x-ep-request-uuid": "b98ca9ef668c7d41f41af7ee004a6e68", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.110635", - "x-node": "bigweb36nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.175134", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb2nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update_ups.json b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update_ups.json new file mode 100644 index 000000000..31f01ae85 --- /dev/null +++ b/EasyPost.Tests/cassettes/net/carrier_account_service_with_parameters/update_ups.json @@ -0,0 +1,193 @@ +[ + { + "Duration": 258, + "RecordedAt": "2024-07-08T17:58:59.060854-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsAccount\"},\"type\":\"UpsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "98" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations" + }, + "Response": { + "Body": "{\"id\":\"ca_3b854e3a5196439fb74bed3154af158d\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:59Z\",\"updated_at\":\"2024-07-08T23:58:59Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1408" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "b98ca9f2668c7d43f42c8408004a6f9b", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.083009", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + }, + { + "Duration": 186, + "RecordedAt": "2024-07-08T17:58:59.518461-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3b854e3a5196439fb74bed3154af158d" + }, + "Response": { + "Body": "{\"id\":\"ca_3b854e3a5196439fb74bed3154af158d\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:59Z\",\"updated_at\":\"2024-07-08T23:58:59Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1400" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "b98ca9f2668c7d43f42c8408004a6fe0", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.145103", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 112, + "RecordedAt": "2024-07-08T17:58:59.320402-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "67" + }, + "Method": "PUT", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations/ca_3b854e3a5196439fb74bed3154af158d" + }, + "Response": { + "Body": "{\"id\":\"ca_3b854e3a5196439fb74bed3154af158d\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:58:59Z\",\"updated_at\":\"2024-07-08T23:58:59Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1400" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "b98ca9f2668c7d43f42c8408004a6fcd", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.073381", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb4nuq fa152d4755,extlb2nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 110, + "RecordedAt": "2024-07-08T17:58:59.643299-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "DELETE", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3b854e3a5196439fb74bed3154af158d" + }, + "Response": { + "Body": "{}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "X-XSS-Protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "Referrer-Policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "b98ca9f2668c7d43f42c8408004a6ffa", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.064923", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb3nuq fa152d4755,extlb2nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/all.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/all.json index 4c1916e98..0469a5321 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/all.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/all.json @@ -1,7 +1,7 @@ [ { - "Duration": 295, - "RecordedAt": "2024-04-05T13:23:51.903395-06:00", + "Duration": 352, + "RecordedAt": "2024-07-08T17:59:47.643767-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -14,12 +14,12 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "[{\"id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"object\":\"CarrierAccount\",\"type\":\"UspsAccount\",\"clone\":false,\"created_at\":\"2018-04-20T16:42:21Z\",\"updated_at\":\"2018-04-20T17:05:01Z\",\"description\":\"USPS Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_fd8b148e541d4163b02cc21afe2aaac8\",\"object\":\"CarrierAccount\",\"type\":\"DhlExpressDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:02Z\",\"updated_at\":\"2022-05-25T18:59:02Z\",\"description\":\"DHL Express Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"DHL Express\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_06c27c7bc8484ff299ec84bdc2a5be38\",\"object\":\"CarrierAccount\",\"type\":\"LsoDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:04Z\",\"updated_at\":\"2022-05-25T18:59:04Z\",\"description\":\"LSO Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"LSO\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_ba94eaaacddb4bf2b135953b3067e817\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:31Z\",\"updated_at\":\"2022-05-26T19:03:31Z\",\"description\":\"UPS Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_0b351eb47cac405dadaf54c659c0a0eb\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:32Z\",\"updated_at\":\"2022-05-26T19:03:33Z\",\"description\":\"My custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_34d97dc9d5df46e48c088455935bc518\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-06-04T00:17:14Z\",\"updated_at\":\"2022-06-04T00:17:15Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_591d414609684bada7f2a2c6a1734bf7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:53Z\",\"updated_at\":\"2022-10-13T23:02:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45999a4724c44dfcbd69483ee174502a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:54Z\",\"updated_at\":\"2022-10-13T23:02:54Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45bdeb10ddbe45d4a74330c744000d36\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:55Z\",\"updated_at\":\"2022-10-13T23:03:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_d85d6d6612ee4de1b27e32ead463e1f0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:56Z\",\"updated_at\":\"2022-10-13T23:03:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}]", + "Body": "[{\"id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"object\":\"CarrierAccount\",\"type\":\"UspsAccount\",\"clone\":false,\"created_at\":\"2018-04-20T16:42:21Z\",\"updated_at\":\"2018-04-20T17:05:01Z\",\"description\":\"USPS Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_fd8b148e541d4163b02cc21afe2aaac8\",\"object\":\"CarrierAccount\",\"type\":\"DhlExpressDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:02Z\",\"updated_at\":\"2022-05-25T18:59:02Z\",\"description\":\"DHL Express Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"DHL Express\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_06c27c7bc8484ff299ec84bdc2a5be38\",\"object\":\"CarrierAccount\",\"type\":\"LsoDefaultAccount\",\"clone\":false,\"created_at\":\"2022-05-25T18:59:04Z\",\"updated_at\":\"2022-05-25T18:59:04Z\",\"description\":\"LSO Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"LSO\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_ba94eaaacddb4bf2b135953b3067e817\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:31Z\",\"updated_at\":\"2022-05-26T19:03:31Z\",\"description\":\"UPS Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_0b351eb47cac405dadaf54c659c0a0eb\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-05-26T19:03:32Z\",\"updated_at\":\"2022-05-26T19:03:33Z\",\"description\":\"My custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_34d97dc9d5df46e48c088455935bc518\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-06-04T00:17:14Z\",\"updated_at\":\"2022-06-04T00:17:15Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}},{\"id\":\"ca_591d414609684bada7f2a2c6a1734bf7\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:53Z\",\"updated_at\":\"2022-10-13T23:02:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45999a4724c44dfcbd69483ee174502a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:02:54Z\",\"updated_at\":\"2022-10-13T23:02:54Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_45bdeb10ddbe45d4a74330c744000d36\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:55Z\",\"updated_at\":\"2022-10-13T23:03:55Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_d85d6d6612ee4de1b27e32ead463e1f0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2022-10-13T23:03:56Z\",\"updated_at\":\"2022-10-13T23:03:56Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}},{\"id\":\"ca_791e2b3f2bff43e298d6dd803ab41569\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:39:32Z\",\"updated_at\":\"2024-07-08T23:39:33Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}]", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", "Content-Type": "application/json; charset=utf-8", - "Content-Length": "9071" + "Content-Length": "11154" }, "HttpVersion": "1.1", "ResponseHeaders": { @@ -29,14 +29,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7866104fc7f44020af00100b26", + "x-ep-request-uuid": "df6fc7b4668c7d73f44042160049b7b5", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.119293", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.168713", + "x-node": "bigweb39nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create.json index 26ccd07b1..11c2d6c5a 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create.json @@ -1,7 +1,7 @@ [ { - "Duration": 326, - "RecordedAt": "2024-04-05T13:23:51.039403-06:00", + "Duration": 244, + "RecordedAt": "2024-07-08T17:59:47.017214-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_5801010c88a743f79dcbb37185dc8cdb\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:51Z\",\"updated_at\":\"2024-04-05T19:23:51Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_d091e2366b0547ebb7d4f6193142491a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:47Z\",\"updated_at\":\"2024-07-08T23:59:47Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f408db6e00100a4d", + "x-ep-request-uuid": "df6fc7b2668c7d73f3f500c60049b73d", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.133351", - "x-node": "bigweb34nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.067214", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +50,8 @@ } }, { - "Duration": 75, - "RecordedAt": "2024-04-05T13:23:51.151495-06:00", + "Duration": 80, + "RecordedAt": "2024-07-08T17:59:47.122949-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,10 +61,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_5801010c88a743f79dcbb37185dc8cdb" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_d091e2366b0547ebb7d4f6193142491a" }, "Response": { - "Body": "{\"id\":\"ca_5801010c88a743f79dcbb37185dc8cdb\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:51Z\",\"updated_at\":\"2024-04-05T19:23:51Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_d091e2366b0547ebb7d4f6193142491a\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:47Z\",\"updated_at\":\"2024-07-08T23:59:47Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -78,14 +79,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f408db6e00100a88", + "x-ep-request-uuid": "df6fc7b2668c7d73f3f500c60049b75b", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.030780", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.041349", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -95,8 +97,8 @@ } }, { - "Duration": 147, - "RecordedAt": "2024-04-05T13:23:51.317521-06:00", + "Duration": 104, + "RecordedAt": "2024-07-08T17:59:47.244723-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -106,7 +108,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_5801010c88a743f79dcbb37185dc8cdb" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_d091e2366b0547ebb7d4f6193142491a" }, "Response": { "Body": "{}", @@ -124,14 +126,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f408db6e00100a9b", + "x-ep-request-uuid": "df6fc7b2668c7d73f3f500c60049b772", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.112589", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.061311", + "x-node": "bigweb42nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create_with_custom_workflow.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create_with_custom_workflow.json deleted file mode 100644 index d494a6ab3..000000000 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/create_with_custom_workflow.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "Duration": 214, - "RecordedAt": "2024-04-05T13:23:51.573561-06:00", - "Request": { - "Body": "{\"carrier_account\":{\"type\":\"FedexAccount\",\"credentials\":{},\"test_credentials\":{},\"registration_data\":{}}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "299" - }, - "Method": "POST", - "RequestHeaders": { - "Authorization": "", - "User-Agent": "" - }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/register" - }, - "Response": { - "Body": "{\"error\":{\"code\":\"UNPROCESSABLE_ENTITY\",\"message\":\"The request was understood, but cannot be processed.\",\"errors\":[{\"field\":\"shipping_streets\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_city\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_state\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_postal_code\",\"message\":\"must be present and a string\"},{\"field\":\"shipping_country_code\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_first_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_last_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_job_title\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_company_name\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_phone_number\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_email_address\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_streets\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_city\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_state\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_postal_code\",\"message\":\"must be present and a string\"},{\"field\":\"corporate_country_code\",\"message\":\"must be present and a string\"},{\"field\":\"account_number\",\"message\":\"must be present and a string\"}]}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Expires": "0", - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "1347" - }, - "HttpVersion": "1.1", - "ResponseHeaders": { - "X-Frame-Options": "SAMEORIGIN", - "x-xss-protection": "1; mode=block", - "X-Content-Type-Options": "nosniff", - "x-download-options": "noopen", - "x-permitted-cross-domain-policies": "none", - "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc7f41a5a6900100aef", - "Cache-Control": "no-store, no-cache, private", - "Pragma": "no-cache", - "x-runtime": "0.035200", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", - "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" - }, - "Status": { - "Code": 422, - "Message": "Unprocessable Entity" - } - } - } -] diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/delete.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/delete.json index 46fd1d978..df5990db6 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/delete.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/delete.json @@ -1,7 +1,7 @@ [ { - "Duration": 327, - "RecordedAt": "2024-04-05T13:23:52.973698-06:00", + "Duration": 243, + "RecordedAt": "2024-07-08T17:59:48.696934-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_c59750e502e1406d9e52b27a6db9661d\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:53Z\",\"updated_at\":\"2024-04-05T19:23:53Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_bed16aa9c8ca459e86a1a099094a689e\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:48Z\",\"updated_at\":\"2024-07-08T23:59:48Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc9f451248f00100c14", + "x-ep-request-uuid": "df6fc7b6668c7d74f42d800e0049b8d7", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.156210", - "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.071277", + "x-node": "bigweb43nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +50,8 @@ } }, { - "Duration": 272, - "RecordedAt": "2024-04-05T13:23:53.260539-06:00", + "Duration": 96, + "RecordedAt": "2024-07-08T17:59:48.81399-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,7 +61,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_c59750e502e1406d9e52b27a6db9661d" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_bed16aa9c8ca459e86a1a099094a689e" }, "Response": { "Body": "{}", @@ -78,15 +79,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc9f451248f00100c38", + "x-ep-request-uuid": "df6fc7b6668c7d74f42d800e0049b8f4", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.231357", - "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.057943", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/retrieve.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/retrieve.json index 6dc4d981e..def5c26cb 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/retrieve.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/retrieve.json @@ -1,7 +1,7 @@ [ { - "Duration": 291, - "RecordedAt": "2024-04-05T13:23:52.225123-06:00", + "Duration": 365, + "RecordedAt": "2024-07-08T17:59:48.099731-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_e2024946a06f45b8af4f00d6fa65f6fa\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:52Z\",\"updated_at\":\"2024-04-05T19:23:52Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_3259df15d68c408a867585c2edfbe604\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:48Z\",\"updated_at\":\"2024-07-08T23:59:48Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc8f3f73acd00100b88", + "x-ep-request-uuid": "df6fc7b9668c7d74f0229e5d0049b81f", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.127727", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.184032", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +49,8 @@ } }, { - "Duration": 67, - "RecordedAt": "2024-04-05T13:23:52.412826-06:00", + "Duration": 76, + "RecordedAt": "2024-07-08T17:59:48.304944-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,10 +60,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_e2024946a06f45b8af4f00d6fa65f6fa" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3259df15d68c408a867585c2edfbe604" }, "Response": { - "Body": "{\"id\":\"ca_e2024946a06f45b8af4f00d6fa65f6fa\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:52Z\",\"updated_at\":\"2024-04-05T19:23:52Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_3259df15d68c408a867585c2edfbe604\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:48Z\",\"updated_at\":\"2024-07-08T23:59:48Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -78,14 +78,15 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc8f3f73acd00100bcb", + "x-ep-request-uuid": "df6fc7b9668c7d74f0229e5d0049b876", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.028768", - "x-node": "bigweb33nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.036430", + "x-node": "bigweb32nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-canary": "direct", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -95,8 +96,8 @@ } }, { - "Duration": 150, - "RecordedAt": "2024-04-05T13:23:52.600214-06:00", + "Duration": 106, + "RecordedAt": "2024-07-08T17:59:48.431721-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -106,7 +107,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_e2024946a06f45b8af4f00d6fa65f6fa" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_3259df15d68c408a867585c2edfbe604" }, "Response": { "Body": "{}", @@ -124,14 +125,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc8f3f73acd00100bda", + "x-ep-request-uuid": "df6fc7b9668c7d74f0229e5d0049b891", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.109980", - "x-node": "bigweb53nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.066551", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/update.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/update.json index c6ed4d590..817f79fd3 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service/update.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service/update.json @@ -1,7 +1,7 @@ [ { - "Duration": 821, - "RecordedAt": "2024-04-05T13:23:49.325608-06:00", + "Duration": 480, + "RecordedAt": "2024-07-08T17:59:46.169796-06:00", "Request": { "Body": "{\"carrier_account\":{\"type\":\"DhlEcsAccount\",\"credentials\":{},\"test_credentials\":{}}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_8918f383012648ca9e5651f3da6de82d\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_760511ab4c0c40fa9feae5e98a095cbe\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:46Z\",\"updated_at\":\"2024-07-08T23:59:46Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc5f3f5a64d001007d5", + "x-ep-request-uuid": "df6fc7b5668c7d72f42e07ef0049b67f", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.139873", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.070416", + "x-node": "bigweb41nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,24 +49,21 @@ } }, { - "Duration": 207, - "RecordedAt": "2024-04-05T13:23:49.850135-06:00", + "Duration": 78, + "RecordedAt": "2024-07-08T17:59:46.607327-06:00", "Request": { - "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "59" - }, - "Method": "PUT", + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_8918f383012648ca9e5651f3da6de82d" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_760511ab4c0c40fa9feae5e98a095cbe" }, "Response": { - "Body": "{\"id\":\"ca_8918f383012648ca9e5651f3da6de82d\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_760511ab4c0c40fa9feae5e98a095cbe\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:46Z\",\"updated_at\":\"2024-07-08T23:59:46Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -81,14 +78,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc5f3f5a64d00100899", + "x-ep-request-uuid": "df6fc7b5668c7d72f42e07ef0049b6ea", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.163688", - "x-node": "bigweb38nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.037807", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -98,21 +95,24 @@ } }, { - "Duration": 70, - "RecordedAt": "2024-04-05T13:23:50.184174-06:00", + "Duration": 123, + "RecordedAt": "2024-07-08T17:59:46.500029-06:00", "Request": { - "Body": "", - "BodyContentType": "Text", - "ContentHeaders": {}, - "Method": "GET", + "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "59" + }, + "Method": "PUT", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_8918f383012648ca9e5651f3da6de82d" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_760511ab4c0c40fa9feae5e98a095cbe" }, "Response": { - "Body": "{\"id\":\"ca_8918f383012648ca9e5651f3da6de82d\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_760511ab4c0c40fa9feae5e98a095cbe\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:46Z\",\"updated_at\":\"2024-07-08T23:59:46Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -127,14 +127,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc6f3f5a64d00100904", + "x-ep-request-uuid": "df6fc7b5668c7d72f42e07ef0049b6cc", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.032421", - "x-node": "bigweb34nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.084881", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -144,8 +144,8 @@ } }, { - "Duration": 168, - "RecordedAt": "2024-04-05T13:23:50.578206-06:00", + "Duration": 100, + "RecordedAt": "2024-07-08T17:59:46.739542-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -155,7 +155,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_8918f383012648ca9e5651f3da6de82d" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_760511ab4c0c40fa9feae5e98a095cbe" }, "Response": { "Body": "{}", @@ -173,14 +173,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc6f3f5a64d0010096e", + "x-ep-request-uuid": "df6fc7b5668c7d72f42e07ef0049b70a", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.130769", - "x-node": "bigweb34nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.058824", + "x-node": "bigweb39nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create.json index 9a5ee3efc..cefd2c137 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create.json @@ -1,7 +1,7 @@ [ { - "Duration": 324, - "RecordedAt": "2024-04-05T13:23:50.994326-06:00", + "Duration": 309, + "RecordedAt": "2024-07-08T17:59:13.769519-06:00", "Request": { "Body": "{\"carrier_account\":{\"credentials\":{},\"test_credentials\":{},\"type\":\"DhlEcsAccount\"}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_6ea8073477f14e2cbb32baecb6457f0b\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:51Z\",\"updated_at\":\"2024-04-05T19:23:51Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_e23a903970504078b9d4e26b6a62ef93\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:13Z\",\"updated_at\":\"2024-07-08T23:59:13Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f41e288900100a3b", + "x-ep-request-uuid": "df6fc7b6668c7d51f02291fa00499df5", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.128290", - "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.111119", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,8 +49,8 @@ } }, { - "Duration": 63, - "RecordedAt": "2024-04-05T13:23:51.091937-06:00", + "Duration": 80, + "RecordedAt": "2024-07-08T17:59:13.867635-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -60,10 +60,10 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_6ea8073477f14e2cbb32baecb6457f0b" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_e23a903970504078b9d4e26b6a62ef93" }, "Response": { - "Body": "{\"id\":\"ca_6ea8073477f14e2cbb32baecb6457f0b\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:51Z\",\"updated_at\":\"2024-04-05T19:23:51Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_e23a903970504078b9d4e26b6a62ef93\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:13Z\",\"updated_at\":\"2024-07-08T23:59:13Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -78,15 +78,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f41e288900100a77", + "x-ep-request-uuid": "df6fc7b6668c7d51f02291fa00499e15", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.028209", - "x-node": "bigweb32nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.040895", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -96,8 +95,8 @@ } }, { - "Duration": 152, - "RecordedAt": "2024-04-05T13:23:51.263488-06:00", + "Duration": 97, + "RecordedAt": "2024-07-08T17:59:13.98332-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -107,7 +106,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_6ea8073477f14e2cbb32baecb6457f0b" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_e23a903970504078b9d4e26b6a62ef93" }, "Response": { "Body": "{}", @@ -125,14 +124,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc7f41e288900100a92", + "x-ep-request-uuid": "df6fc7b6668c7d52f02291fa00499e25", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.113302", - "x-node": "bigweb35nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.060136", + "x-node": "bigweb36nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_with_custom_workflow.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_fedex.json similarity index 86% rename from EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_with_custom_workflow.json rename to EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_fedex.json index f52540c70..6f81601b9 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_with_custom_workflow.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_fedex.json @@ -1,7 +1,7 @@ [ { - "Duration": 675, - "RecordedAt": "2024-04-05T13:23:51.967737-06:00", + "Duration": 518, + "RecordedAt": "2024-07-08T17:59:13.409396-06:00", "Request": { "Body": "{\"carrier_account\":{\"registration_data\":{\"account_number\":\"123456789\",\"corporate_city\":\"San Francisco\",\"corporate_country_code\":\"US\",\"corporate_postal_code\":\"94105\",\"corporate_state\":\"CA\",\"corporate_streets\":\"345 California St\",\"corporate_company_name\":\"EasyPost\",\"corporate_email_address\":\"me@example.com\",\"corporate_first_name\":\"Demo\",\"corporate_job_title\":\"Developer\",\"corporate_last_name\":\"User\",\"corporate_phone_number\":\"5555555555\",\"shipping_city\":\"San Francisco\",\"shipping_country_code\":\"US\",\"shipping_postal_code\":\"94105\",\"shipping_state\":\"CA\",\"shipping_streets\":\"345 California St\"},\"type\":\"FedexAccount\"}}", "BodyContentType": "Json", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7a66104fc7f41adaa600100adf", + "x-ep-request-uuid": "df6fc7b4668c7d51f40c0c6800499da3", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.493596", - "x-node": "bigweb35nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.328739", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_ups.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_ups.json new file mode 100644 index 000000000..99633d519 --- /dev/null +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/create_ups.json @@ -0,0 +1,143 @@ +[ + { + "Duration": 268, + "RecordedAt": "2024-07-08T17:59:12.538611-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsAccount\"},\"type\":\"UpsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "98" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations" + }, + "Response": { + "Body": "{\"id\":\"ca_113f0eca021d46cfb0fb14c72fb44ea4\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:12Z\",\"updated_at\":\"2024-07-08T23:59:12Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1384" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b7668c7d50f3f74faa00499d35", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.092540", + "x-node": "bigweb42nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + }, + { + "Duration": 178, + "RecordedAt": "2024-07-08T17:59:12.733611-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_113f0eca021d46cfb0fb14c72fb44ea4" + }, + "Response": { + "Body": "{\"id\":\"ca_113f0eca021d46cfb0fb14c72fb44ea4\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:12Z\",\"updated_at\":\"2024-07-08T23:59:12Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1384" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b7668c7d50f3f74faa00499d4b", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.138103", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 103, + "RecordedAt": "2024-07-08T17:59:12.854349-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "DELETE", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_113f0eca021d46cfb0fb14c72fb44ea4" + }, + "Response": { + "Body": "{}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b7668c7d50f3f74faa00499d7c", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.062997", + "x-node": "bigweb53nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update.json index 3f6b5624a..56ecad715 100644 --- a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update.json +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update.json @@ -1,7 +1,7 @@ [ { - "Duration": 723, - "RecordedAt": "2024-04-05T13:23:49.169308-06:00", + "Duration": 487, + "RecordedAt": "2024-07-08T17:59:11.597972-06:00", "Request": { "Body": "{\"carrier_account\":{\"credentials\":{},\"test_credentials\":{},\"type\":\"DhlEcsAccount\"}}", "BodyContentType": "Json", @@ -17,7 +17,7 @@ "Uri": "https://api.easypost.com/v2/carrier_accounts" }, "Response": { - "Body": "{\"id\":\"ca_98df4b1a49c14f63a10089f5a71236cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_64cf93f1e919421db3ea0fbb533419b0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:11Z\",\"updated_at\":\"2024-07-08T23:59:11Z\",\"description\":\"DHL eCommerce Solutions Account\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -32,14 +32,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc5f3f84a8700100791", + "x-ep-request-uuid": "df6fc7b8668c7d4ff3f9859400499c7b", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.271027", - "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.074811", + "x-node": "bigweb34nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -49,24 +49,21 @@ } }, { - "Duration": 210, - "RecordedAt": "2024-04-05T13:23:49.633154-06:00", + "Duration": 91, + "RecordedAt": "2024-07-08T17:59:12.055793-06:00", "Request": { - "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", - "BodyContentType": "Json", - "ContentHeaders": { - "Content-Type": "application/json; charset=utf-8", - "Content-Length": "59" - }, - "Method": "PUT", + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_98df4b1a49c14f63a10089f5a71236cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_64cf93f1e919421db3ea0fbb533419b0" }, "Response": { - "Body": "{\"id\":\"ca_98df4b1a49c14f63a10089f5a71236cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_64cf93f1e919421db3ea0fbb533419b0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:11Z\",\"updated_at\":\"2024-07-08T23:59:12Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -81,14 +78,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc5f3f84a8700100874", + "x-ep-request-uuid": "df6fc7b8668c7d50f3f9859400499cdd", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.141330", - "x-node": "bigweb35nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.051584", + "x-node": "bigweb40nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -98,21 +95,24 @@ } }, { - "Duration": 79, - "RecordedAt": "2024-04-05T13:23:50.029684-06:00", + "Duration": 127, + "RecordedAt": "2024-07-08T17:59:11.937277-06:00", "Request": { - "Body": "", - "BodyContentType": "Text", - "ContentHeaders": {}, - "Method": "GET", + "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "59" + }, + "Method": "PUT", "RequestHeaders": { "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_98df4b1a49c14f63a10089f5a71236cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_64cf93f1e919421db3ea0fbb533419b0" }, "Response": { - "Body": "{\"id\":\"ca_98df4b1a49c14f63a10089f5a71236cf\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-04-05T19:23:49Z\",\"updated_at\":\"2024-04-05T19:23:49Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", + "Body": "{\"id\":\"ca_64cf93f1e919421db3ea0fbb533419b0\",\"object\":\"CarrierAccount\",\"type\":\"DhlEcsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:11Z\",\"updated_at\":\"2024-07-08T23:59:12Z\",\"description\":\"my custom description\",\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{},\"test_credentials\":{}},\"credentials\":{},\"test_credentials\":{}}", "BodyContentType": "Json", "ContentHeaders": { "Expires": "0", @@ -127,15 +127,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc6f3f84a87001008e2", + "x-ep-request-uuid": "df6fc7b8668c7d4ff3f9859400499cbf", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.035122", - "x-node": "bigweb43nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.086834", + "x-node": "bigweb39nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-canary": "direct", - "x-proxied": "intlb3nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { @@ -145,8 +144,8 @@ } }, { - "Duration": 185, - "RecordedAt": "2024-04-05T13:23:50.508507-06:00", + "Duration": 132, + "RecordedAt": "2024-07-08T17:59:12.219172-06:00", "Request": { "Body": "", "BodyContentType": "Text", @@ -156,7 +155,7 @@ "Authorization": "", "User-Agent": "" }, - "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_98df4b1a49c14f63a10089f5a71236cf" + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_64cf93f1e919421db3ea0fbb533419b0" }, "Response": { "Body": "{}", @@ -174,14 +173,14 @@ "x-download-options": "noopen", "x-permitted-cross-domain-policies": "none", "referrer-policy": "strict-origin-when-cross-origin", - "x-ep-request-uuid": "f5042d7966104fc6f3f84a870010093d", + "x-ep-request-uuid": "df6fc7b8668c7d50f3f9859400499cfc", "Cache-Control": "no-store, no-cache, private", "Pragma": "no-cache", - "x-runtime": "0.143007", - "x-node": "bigweb41nuq", - "x-version-label": "easypost-202404051854-b9502cad97-master", + "x-runtime": "0.089497", + "x-node": "bigweb36nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", "x-backend": "easypost", - "x-proxied": "intlb4nuq 39c21b8207,extlb1nuq 60566a9ec2", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" }, "Status": { diff --git a/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update_ups.json b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update_ups.json new file mode 100644 index 000000000..c2f99ca5e --- /dev/null +++ b/EasyPost.Tests/cassettes/netstandard/carrier_account_service_with_parameters/update_ups.json @@ -0,0 +1,193 @@ +[ + { + "Duration": 269, + "RecordedAt": "2024-07-08T17:59:14.276731-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsAccount\"},\"type\":\"UpsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "98" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations" + }, + "Response": { + "Body": "{\"id\":\"ca_58f06a81193d4985be1b305f9d5a5299\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:14Z\",\"updated_at\":\"2024-07-08T23:59:14Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1444" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b6668c7d52f45128f100499e56", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.097673", + "x-node": "bigweb39nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + }, + { + "Duration": 87, + "RecordedAt": "2024-07-08T17:59:14.617392-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "GET", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_58f06a81193d4985be1b305f9d5a5299" + }, + "Response": { + "Body": "{\"id\":\"ca_58f06a81193d4985be1b305f9d5a5299\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:14Z\",\"updated_at\":\"2024-07-08T23:59:14Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1404" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b6668c7d52f45128f100499ea0", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.045780", + "x-node": "bigweb43nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb3nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 104, + "RecordedAt": "2024-07-08T17:59:14.504984-06:00", + "Request": { + "Body": "{\"ups_oauth_registrations\":{\"description\":\"my custom description\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "67" + }, + "Method": "PUT", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/ups_oauth_registrations/ca_58f06a81193d4985be1b305f9d5a5299" + }, + "Response": { + "Body": "{\"id\":\"ca_58f06a81193d4985be1b305f9d5a5299\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2024-07-08T23:59:14Z\",\"updated_at\":\"2024-07-08T23:59:14Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{}},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1404" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b6668c7d52f45128f100499e89", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.066042", + "x-node": "bigweb33nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + }, + { + "Duration": 100, + "RecordedAt": "2024-07-08T17:59:14.735553-06:00", + "Request": { + "Body": "", + "BodyContentType": "Text", + "ContentHeaders": {}, + "Method": "DELETE", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/ca_58f06a81193d4985be1b305f9d5a5299" + }, + "Response": { + "Body": "{}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "HttpVersion": "1.1", + "ResponseHeaders": { + "X-Frame-Options": "SAMEORIGIN", + "x-xss-protection": "1; mode=block", + "X-Content-Type-Options": "nosniff", + "x-download-options": "noopen", + "x-permitted-cross-domain-policies": "none", + "referrer-policy": "strict-origin-when-cross-origin", + "x-ep-request-uuid": "df6fc7b6668c7d52f45128f100499eb1", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.060600", + "x-node": "bigweb35nuq", + "x-version-label": "easypost-202407082200-ece3ee3827-master", + "x-backend": "easypost", + "x-proxied": "intlb4nuq fa152d4755,extlb1nuq fa152d4755", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 200, + "Message": "OK" + } + } + } +] diff --git a/EasyPost/Constants.cs b/EasyPost/Constants.cs index 620b2ec03..4e9d921fc 100644 --- a/EasyPost/Constants.cs +++ b/EasyPost/Constants.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Net; using EasyPost.Exceptions.API; using EasyPost.Models.API; @@ -98,6 +99,7 @@ public static class ErrorMessages #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member public const string InvalidApiKeyType = "Invalid API key type."; public const string InvalidParameter = "Invalid parameter: {0}."; + public const string InvalidFunction = "Invalid function call."; public const string InvalidParameterPair = "Invalid parameter pair: '{0}' and '{1}'."; public const string InvalidWebhookSignature = "Webhook does not contain a valid HMAC signature."; public const string JsonDeserializationError = "Error deserializing JSON into object of type {0}."; @@ -136,19 +138,67 @@ public static class CarrierAccounts public const string UpsAccount = "UpsAccount"; /// - /// Carrier account types that support custom workflows. + /// Carrier account types that support custom creation workflows. /// - private static List CarrierTypesWithCustomWorkflows => new() + private static List CarrierTypesWithCustomCreateWorkflows => new() { CarrierAccountType.FedEx.Name, CarrierAccountType.FedExSmartPost.Name, CarrierAccountType.Ups.Name, + CarrierAccountType.UpsMailInnovations.Name, + CarrierAccountType.UpsSurePost.Name, }; - internal static bool IsCustomWorkflowType(string carrierType) => CarrierTypesWithCustomWorkflows.Contains(carrierType); + /// + /// Carrier account types that support custom update workflows. + /// + private static List CarrierTypesWithCustomUpdateWorkflows => new() + { + CarrierAccountType.Ups.Name, + CarrierAccountType.UpsMailInnovations.Name, + CarrierAccountType.UpsSurePost.Name, + }; + + internal static string DeriveCreateEndpoint(string carrierType) + { + string endpoint = StandardCreateEndpoint; + + var @switch = new SwitchCase + { + { new List { CarrierAccountType.FedEx.Name, CarrierAccountType.FedExSmartPost.Name }.Contains(carrierType), () => endpoint = CustomCreateEndpoint }, + { new List { CarrierAccountType.Ups.Name, CarrierAccountType.UpsMailInnovations.Name, CarrierAccountType.UpsSurePost.Name }.Contains(carrierType), () => endpoint = UpsOAuthCreateEndpoint }, + { SwitchCaseScenario.Default, () => endpoint = StandardCreateEndpoint }, + }; + + @switch.MatchFirstTrue(); + + return endpoint; + } + + internal static string DeriveUpdateEndpoint(string carrierType, string id) + { + string endpoint = string.Format(CultureInfo.InvariantCulture, StandardUpdateEndpoint, id); + + var @switch = new SwitchCase + { + { new List { CarrierAccountType.Ups.Name, CarrierAccountType.UpsMailInnovations.Name, CarrierAccountType.UpsSurePost.Name }.Contains(carrierType), () => endpoint = string.Format(CultureInfo.InvariantCulture, UpsOAuthUpdateEndpoint, id) }, + { SwitchCaseScenario.Default, () => endpoint = string.Format(CultureInfo.InvariantCulture, StandardUpdateEndpoint, id) }, + }; + + @switch.MatchFirstTrue(); + + return endpoint; + } + + internal static bool IsCustomWorkflowCreate(string carrierType) => CarrierTypesWithCustomCreateWorkflows.Contains(carrierType); + + internal static bool IsCustomWorkflowUpdate(string carrierType) => CarrierTypesWithCustomUpdateWorkflows.Contains(carrierType); internal const string StandardCreateEndpoint = "carrier_accounts"; internal const string CustomCreateEndpoint = "carrier_accounts/register"; + internal const string UpsOAuthCreateEndpoint = "ups_oauth_registrations"; + internal const string StandardUpdateEndpoint = "carrier_accounts/{0}"; + internal const string UpsOAuthUpdateEndpoint = "ups_oauth_registrations/{0}"; } } } diff --git a/EasyPost/Exceptions/General/InvalidFunctionError.cs b/EasyPost/Exceptions/General/InvalidFunctionError.cs new file mode 100644 index 000000000..b6dfb698c --- /dev/null +++ b/EasyPost/Exceptions/General/InvalidFunctionError.cs @@ -0,0 +1,19 @@ +using System.Globalization; + +namespace EasyPost.Exceptions.General +{ + /// + /// Represents an error that occurs due to an invalid function call. + /// + public class InvalidFunctionError : ValidationError + { + /// + /// Initializes a new instance of the class. + /// + /// Additional message to include in error message. + internal InvalidFunctionError(string? followUpMessage = "") + : base($"{string.Format(CultureInfo.InvariantCulture, Constants.ErrorMessages.InvalidFunction)} {followUpMessage}") + { + } + } +} diff --git a/EasyPost/Models/API/CarrierAccountType.cs b/EasyPost/Models/API/CarrierAccountType.cs index f3ceb8145..76c3a3e77 100644 --- a/EasyPost/Models/API/CarrierAccountType.cs +++ b/EasyPost/Models/API/CarrierAccountType.cs @@ -23,6 +23,16 @@ public class CarrierAccountType : ValueEnum /// public static readonly CarrierAccountType Ups = new CarrierAccountType(59, "UpsAccount"); + /// + /// Represents a UPS Mail Innovations carrier account. + /// + public static readonly CarrierAccountType UpsMailInnovations = new CarrierAccountType(60, "UpsMailInnovationsAccount"); + + /// + /// Represents a UPS SurePost carrier account. + /// + public static readonly CarrierAccountType UpsSurePost = new CarrierAccountType(61, "UpsSurepostAccount"); + /// /// Initializes a new instance of the class. /// diff --git a/EasyPost/Parameters/BaseParameters.cs b/EasyPost/Parameters/BaseParameters.cs index b888fc4d8..00c542399 100644 --- a/EasyPost/Parameters/BaseParameters.cs +++ b/EasyPost/Parameters/BaseParameters.cs @@ -1,8 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; using System.Reflection; using EasyPost._base; using EasyPost.Exceptions.General; @@ -186,7 +184,7 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va value = SerializeObject(value); } - _parameterDictionary = UpdateDictionary(_parameterDictionary, requestParameterAttribute.JsonPath, value); + _parameterDictionary.AddOrUpdate(value, requestParameterAttribute.JsonPath); } private object? SerializeObject(object? obj) @@ -222,61 +220,5 @@ private void Add(RequestParameterAttribute requestParameterAttribute, object? va return obj; } - - /// - /// Update a dictionary with a new value. - /// - /// Dictionary to update. - /// Path of new value to add. - /// New value to add. - /// Updated dictionary. - /// Could not add value to dictionary. - [SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "Harder to read")] - private static Dictionary UpdateDictionary(Dictionary? dictionary, string[] keys, object? value) - { - dictionary ??= new Dictionary(); - - switch (keys.Length) - { - // Don't need to go down - case 0: - return dictionary; - - // Last key left - case 1: - dictionary.AddOrUpdate(keys[0], value); - - return dictionary; - - // ReSharper disable once RedundantEmptySwitchSection - default: - break; - } - - // Need to go down another level - // Get the key and update the list of keys - string key = keys[0]; - keys = keys.Skip(1).ToArray(); -#pragma warning disable CA1854 // Don't want to use TryGetValue because no need for value - if (!dictionary.ContainsKey(key)) - { - dictionary[key] = UpdateDictionary(new Dictionary(), keys, value); - } -#pragma warning restore CA1854 - - object? subDirectory = dictionary[key]; - if (subDirectory is Dictionary subDictionary) - { - dictionary[key] = UpdateDictionary(subDictionary, keys, value); - } - else - { -#pragma warning disable CA2201 // Don't throw base Exception class - throw new Exception("Found a non-dictionary while traversing the dictionary"); -#pragma warning restore CA2201 // Don't throw base Exception class - } - - return dictionary; - } } } diff --git a/EasyPost/Parameters/CarrierAccount/Create.cs b/EasyPost/Parameters/CarrierAccount/Create.cs index a6a13739a..a4712825c 100644 --- a/EasyPost/Parameters/CarrierAccount/Create.cs +++ b/EasyPost/Parameters/CarrierAccount/Create.cs @@ -3,6 +3,7 @@ using System.Diagnostics.CodeAnalysis; using EasyPost.Models.API; using EasyPost.Utilities.Internal.Attributes; +// ReSharper disable VirtualMemberCallInConstructor - Virtual member allowed during base class construction despite not being sealed namespace EasyPost.Parameters.CarrierAccount { @@ -28,12 +29,28 @@ public class Create : ACreate public Dictionary? TestCredentials { get; set; } /// - /// The endpoint to hit to create this carrier account. + /// Description for the new . /// - internal override string Endpoint => Constants.CarrierAccounts.StandardCreateEndpoint; + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "description")] + public string? Description { get; set; } + + /// + /// Reference name for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "reference")] + public string? Reference { get; set; } + + /// + [TopLevelRequestParameter(Necessity.Required, "carrier_account", "type")] + public override string? Type { get; set; } #endregion + /// + /// The endpoint to hit to create this carrier account. + /// + internal override string Endpoint => Constants.CarrierAccounts.StandardCreateEndpoint; + /// /// Initializes a new instance of the class. /// @@ -67,25 +84,10 @@ public Create(CarrierAccountType type) [ExcludeFromCodeCoverage] public abstract class ACreate : BaseParameters, ICarrierAccountParameter { - #region Request Parameters - - /// - /// Description for the new . - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "description")] - public string? Description { get; set; } - - /// - /// Reference name for the new . - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "reference")] - public string? Reference { get; set; } - /// /// Type of to create. /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "type")] - public string? Type { get; set; } + public abstract string? Type { get; set; } /// /// The endpoint to hit to create this carrier account. @@ -95,6 +97,7 @@ public abstract class ACreate : BaseParameters, ICarr /// /// Initializes a new instance of the class. /// + [Obsolete("Use ACreate(CarrierAccountType type) or ACreate(string type) instead.")] protected ACreate() { } @@ -116,7 +119,5 @@ protected ACreate(CarrierAccountType type) { Type = type.Name; } - - #endregion } } diff --git a/EasyPost/Parameters/CarrierAccount/CreateFedEx.cs b/EasyPost/Parameters/CarrierAccount/CreateFedEx.cs index 67d259152..0dcf80a2a 100644 --- a/EasyPost/Parameters/CarrierAccount/CreateFedEx.cs +++ b/EasyPost/Parameters/CarrierAccount/CreateFedEx.cs @@ -114,11 +114,27 @@ public class CreateFedEx : ACreate [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "shipping_streets")] public string? ShippingAddressStreet { get; set; } - /// - internal override string Endpoint => Constants.CarrierAccounts.CustomCreateEndpoint; + /// + /// Description for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "description")] + public string? Description { get; set; } + + /// + /// Reference name for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "reference")] + public string? Reference { get; set; } + + /// + [TopLevelRequestParameter(Necessity.Required, "carrier_account", "type")] + public override string? Type { get; set; } #endregion + /// + internal override string Endpoint => Constants.CarrierAccounts.CustomCreateEndpoint; + /// /// Initializes a new instance of the class. /// diff --git a/EasyPost/Parameters/CarrierAccount/CreateFedExSmartPost.cs b/EasyPost/Parameters/CarrierAccount/CreateFedExSmartPost.cs index fe8d80a92..6983a93cf 100644 --- a/EasyPost/Parameters/CarrierAccount/CreateFedExSmartPost.cs +++ b/EasyPost/Parameters/CarrierAccount/CreateFedExSmartPost.cs @@ -1,5 +1,7 @@ +using System.Collections.Generic; using EasyPost.Models.API; using EasyPost.Utilities.Internal.Attributes; +using EasyPost.Utilities.Internal.Extensions; namespace EasyPost.Parameters.CarrierAccount; @@ -118,11 +120,27 @@ public class CreateFedExSmartPost : ACreate [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "shipping_streets")] public string? ShippingAddressStreet { get; set; } - /// - internal override string Endpoint => Constants.CarrierAccounts.CustomCreateEndpoint; + /// + /// Description for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "description")] + public string? Description { get; set; } + + /// + /// Reference name for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "reference")] + public string? Reference { get; set; } + + /// + [TopLevelRequestParameter(Necessity.Required, "carrier_account", "type")] + public override string? Type { get; set; } #endregion + /// + internal override string Endpoint => Constants.CarrierAccounts.CustomCreateEndpoint; + /// /// Initializes a new instance of the class. /// @@ -130,4 +148,14 @@ public CreateFedExSmartPost() : base(CarrierAccountType.FedExSmartPost) { } + + /// + public override Dictionary ToDictionary() + { + Dictionary dictionary = base.ToDictionary(); + + dictionary!.AddOrUpdate(Type, "carrier_account", "type"); // Need to add "type" since excluded from serialization + + return dictionary; + } } diff --git a/EasyPost/Parameters/CarrierAccount/CreateUps.cs b/EasyPost/Parameters/CarrierAccount/CreateUps.cs index 2a5b38acf..e5b9adc96 100644 --- a/EasyPost/Parameters/CarrierAccount/CreateUps.cs +++ b/EasyPost/Parameters/CarrierAccount/CreateUps.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using EasyPost.Models.API; using EasyPost.Utilities.Internal.Attributes; +using EasyPost.Utilities.Internal.Extensions; namespace EasyPost.Parameters.CarrierAccount { @@ -15,115 +17,29 @@ public class CreateUps : ACreate /// /// The UPS account number. /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "account_number")] + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "account_number")] public string? AccountNumber { get; set; } /// - /// The city of the address of the shipping origin. + /// Description for the new . /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "city")] - public string? City { get; set; } + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } /// - /// The company name of the corporate contact. + /// Reference name for the new . /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "company")] - public string? CompanyName { get; set; } + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } - /// - /// The country code of the address of the shipping origin. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "country")] - public string? Country { get; set; } - - /// - /// The email address of the corporate contact. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "email")] - public string? Email { get; set; } - - /// - /// The amount of the invoice. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "invoice_amount")] - public string? InvoiceAmount { get; set; } - - /// - /// The control ID of the invoice. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "invoice_control_id")] - public string? InvoiceControlId { get; set; } - - /// - /// The currency of the invoice. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "invoice_currency")] - public string? InvoiceCurrency { get; set; } - - /// - /// The date of the invoice. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "invoice_date")] - public string? InvoiceDate { get; set; } - - /// - /// The invoice number. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "invoice_number")] - public string? InvoiceNumber { get; set; } - - /// - /// The phone number of the corporate contact. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "phone")] - public string? PhoneNumber { get; set; } - - /// - /// The postal code of the address of the shipping origin. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "postal_code")] - public string? PostalCode { get; set; } + /// + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "type")] + public override string? Type { get; set; } - /// - /// The job title of the corporate contact. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "title")] - public string? RegistrarJobTitle { get; set; } - - /// - /// The full name of the corporate contact. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "name")] - public string? RegistrarName { get; set; } - - /// - /// The state of the address of the shipping origin. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "state")] - public string? State { get; set; } - - /// - /// The street of the address of the shipping origin. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "street1")] - public string? Street { get; set; } - - /// - /// The second street line of the address of the shipping origin. - /// - [TopLevelRequestParameter(Necessity.Optional, "carrier_account", "registration_data", "street2")] - public string? Street2 { get; set; } - - /// - /// The website of the company. - /// - [TopLevelRequestParameter(Necessity.Required, "carrier_account", "registration_data", "website")] - public string? Website { get; set; } + #endregion /// - internal override string Endpoint => Constants.CarrierAccounts.CustomCreateEndpoint; - - #endregion + internal override string Endpoint => Constants.CarrierAccounts.UpsOAuthCreateEndpoint; /// /// Initializes a new instance of the class. @@ -132,5 +48,15 @@ public CreateUps() : base(CarrierAccountType.Ups) { } + + /// + public override Dictionary ToDictionary() + { + Dictionary dictionary = base.ToDictionary(); + + dictionary!.AddOrUpdate(Type, "type"); // Need to add "type" top-level (added sub-level by serialization) + + return dictionary; + } } } diff --git a/EasyPost/Parameters/CarrierAccount/CreateUpsMailInnovations.cs b/EasyPost/Parameters/CarrierAccount/CreateUpsMailInnovations.cs new file mode 100644 index 000000000..1717e18f4 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateUpsMailInnovations.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; +using EasyPost.Utilities.Internal.Attributes; +using EasyPost.Utilities.Internal.Extensions; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateUpsMailInnovations : ACreate + { + #region Request Parameters + + /// + /// The UPS account number. + /// + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "account_number")] + public string? AccountNumber { get; set; } + + /// + /// Description for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } + + /// + /// Reference name for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } + + /// + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "type")] + public override string? Type { get; set; } + + #endregion + + /// + internal override string Endpoint => Constants.CarrierAccounts.UpsOAuthCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateUpsMailInnovations() + : base(CarrierAccountType.UpsMailInnovations) + { + } + + /// + public override Dictionary ToDictionary() + { + Dictionary dictionary = base.ToDictionary(); + + dictionary!.AddOrUpdate(Type, "type"); // Need to add "type" top-level (added sub-level by serialization) + + return dictionary; + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/CreateUpsSurePost.cs b/EasyPost/Parameters/CarrierAccount/CreateUpsSurePost.cs new file mode 100644 index 000000000..39a47706d --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateUpsSurePost.cs @@ -0,0 +1,62 @@ +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; +using EasyPost.Utilities.Internal.Attributes; +using EasyPost.Utilities.Internal.Extensions; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateUpsSurePost : ACreate + { + #region Request Parameters + + /// + /// The UPS account number. + /// + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "account_number")] + public string? AccountNumber { get; set; } + + /// + /// Description for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } + + /// + /// Reference name for the new . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } + + /// + [TopLevelRequestParameter(Necessity.Required, "ups_oauth_registrations", "type")] + public override string? Type { get; set; } + + #endregion + + /// + internal override string Endpoint => Constants.CarrierAccounts.UpsOAuthCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateUpsSurePost() + : base(CarrierAccountType.UpsSurePost) + { + } + + /// + public override Dictionary ToDictionary() + { + Dictionary dictionary = base.ToDictionary(); + + dictionary!.AddOrUpdate(Type, "type"); // Need to add "type" top-level (added sub-level by serialization) + + return dictionary; + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/Update.cs b/EasyPost/Parameters/CarrierAccount/Update.cs index 1fdd84a21..6a62aaca2 100644 --- a/EasyPost/Parameters/CarrierAccount/Update.cs +++ b/EasyPost/Parameters/CarrierAccount/Update.cs @@ -5,10 +5,10 @@ namespace EasyPost.Parameters.CarrierAccount { /// - /// Parameters for API calls. + /// Parameters for API calls. /// [ExcludeFromCodeCoverage] - public class Update : BaseParameters + public class Update : AUpdate { #region Request Parameters @@ -38,5 +38,36 @@ public class Update : BaseParameters public Dictionary? TestCredentials { get; set; } #endregion + + /// + internal override bool ValidCarrierAccountType(string type) => !Constants.CarrierAccounts.IsCustomWorkflowUpdate(type); + + /// + internal override string Endpoint(string id) => $"carrier_accounts/{id}"; + } + + /// + /// The base class for all carrier-account update parameter sets. + /// + [ExcludeFromCodeCoverage] + public abstract class AUpdate : BaseParameters + { + #region Request Parameters + + /// + /// Check if the provided carrier account type is valid for this parameter set. + /// + /// The carrier account type to check. + /// True if the carrier account type is valid; otherwise, false. + internal abstract bool ValidCarrierAccountType(string type); + + /// + /// Get the endpoint for the carrier account update. + /// + /// The ID of the carrier account to update. + /// The endpoint for the carrier account update. + internal abstract string Endpoint(string id); + + #endregion } } diff --git a/EasyPost/Parameters/CarrierAccount/UpdateUps.cs b/EasyPost/Parameters/CarrierAccount/UpdateUps.cs new file mode 100644 index 000000000..eab5bd277 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/UpdateUps.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Utilities.Internal.Attributes; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class UpdateUps : AUpdate + { + #region Request Parameters + + /// + /// Credentials to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "account_number")] + public string? AccountNumber { get; set; } + + /// + /// Description to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } + + /// + /// Reference name to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } + + #endregion + + /// + internal override bool ValidCarrierAccountType(string type) => Constants.CarrierAccounts.IsCustomWorkflowUpdate(type); + + /// + internal override string Endpoint(string id) => $"ups_oauth_registrations/{id}"; + } +} diff --git a/EasyPost/Parameters/CarrierAccount/UpdateUpsMailInnovations.cs b/EasyPost/Parameters/CarrierAccount/UpdateUpsMailInnovations.cs new file mode 100644 index 000000000..7cce29ee9 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/UpdateUpsMailInnovations.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Utilities.Internal.Attributes; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class UpdateUpsMailInnovations : AUpdate + { + #region Request Parameters + + /// + /// Credentials to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "account_number")] + public string? AccountNumber { get; set; } + + /// + /// Description to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } + + /// + /// Reference name to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } + + #endregion + + /// + internal override bool ValidCarrierAccountType(string type) => Constants.CarrierAccounts.IsCustomWorkflowUpdate(type); + + /// + internal override string Endpoint(string id) => $"ups_oauth_registrations/{id}"; + } +} diff --git a/EasyPost/Parameters/CarrierAccount/UpdateUpsSurePost.cs b/EasyPost/Parameters/CarrierAccount/UpdateUpsSurePost.cs new file mode 100644 index 000000000..0de1671f1 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/UpdateUpsSurePost.cs @@ -0,0 +1,40 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Utilities.Internal.Attributes; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class UpdateUpsSurePost : AUpdate + { + #region Request Parameters + + /// + /// Credentials to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "account_number")] + public string? AccountNumber { get; set; } + + /// + /// Description to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "description")] + public string? Description { get; set; } + + /// + /// Reference name to update for the . + /// + [TopLevelRequestParameter(Necessity.Optional, "ups_oauth_registrations", "reference")] + public string? Reference { get; set; } + + #endregion + + /// + internal override bool ValidCarrierAccountType(string type) => Constants.CarrierAccounts.IsCustomWorkflowUpdate(type); + + /// + internal override string Endpoint(string id) => $"ups_oauth_registrations/{id}"; + } +} diff --git a/EasyPost/Services/CarrierAccountService.cs b/EasyPost/Services/CarrierAccountService.cs index 0b17ab402..d0b16f74d 100644 --- a/EasyPost/Services/CarrierAccountService.cs +++ b/EasyPost/Services/CarrierAccountService.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -37,6 +38,7 @@ internal CarrierAccountService(EasyPostClient client) /// to use for the HTTP request. /// A object. [CrudOperations.Create] + [Obsolete("This function does not support FedEx or UPS account registrations. Please use the Create(Parameters.CarrierAccount.ACreate) function instead for all carrier account registrations.")] public async Task Create(Dictionary parameters, CancellationToken cancellationToken = default) { if (parameters["type"] is not string carrierType) @@ -44,12 +46,14 @@ public async Task Create(Dictionary parameters, throw new MissingParameterError("CarrierAccount type is required."); } - string endpoint = Constants.CarrierAccounts.StandardCreateEndpoint; - if (Constants.CarrierAccounts.IsCustomWorkflowType(carrierType)) + // Stop users from using this function for non-standard carrier account creation workflows (FedEx, UPS, etc.) + if (Constants.CarrierAccounts.IsCustomWorkflowCreate(carrierType)) { - endpoint = Constants.CarrierAccounts.CustomCreateEndpoint; + throw new InvalidFunctionError($"This function does not support non-standard carrier accounts, including FedEx and UPS. Use Create(Parameters.CarrierAccount.ACreate) instead."); } + string endpoint = Constants.CarrierAccounts.DeriveCreateEndpoint(carrierType); // Should always be "carrier_accounts" due to guard clause above, but just in case + parameters = parameters.Wrap("carrier_account"); return await RequestAsync(Method.Post, endpoint, cancellationToken, parameters); @@ -71,12 +75,18 @@ public async Task Create(Parameters.CarrierAccount.ACreate param throw new MissingParameterError(nameof(parameters.Type)); } - // stop the user from using a generic Create parameter set when creating a carrier account with a custom workflow (e.g. FedExAccount) - if (parameters.GetType() == typeof(Parameters.CarrierAccount.Create) && Constants.CarrierAccounts.IsCustomWorkflowType(parameters.Type)) + // Stop users from using a generic Create parameter set when creating a carrier account with a custom workflow (e.g. FedExAccount or UpsAccount) + if (parameters.GetType() == typeof(Parameters.CarrierAccount.Create) && Constants.CarrierAccounts.IsCustomWorkflowCreate(parameters.Type)) { throw new InvalidParameterError("parameters", $"Use a {parameters.Type} custom workflow parameter set instead."); } + // Stop users from using a custom Create parameter set when creating a carrier account with a standard workflow + if (parameters.GetType() != typeof(Parameters.CarrierAccount.Create) && !Constants.CarrierAccounts.IsCustomWorkflowCreate(parameters.Type)) + { + throw new InvalidParameterError("parameters", "Use a standard Create parameter set instead."); + } + string endpoint = parameters.Endpoint; return await RequestAsync(Method.Post, endpoint, cancellationToken, parameters.ToDictionary()); @@ -110,10 +120,23 @@ public async Task Create(Parameters.CarrierAccount.ACreate param /// to use for the HTTP request. /// The updated . [CrudOperations.Update] + [Obsolete("This function does not support UPS accounts. Please use the Update(string, Parameters.CarrierAccount.AUpdate) function instead for all carrier account updates.")] public async Task Update(string id, Dictionary parameters, CancellationToken cancellationToken = default) { + // Need to retrieve account first to check type + CarrierAccount account = await Retrieve(id, cancellationToken); + + // Stop users from using this function for non-standard carrier account update workflows (UPS, etc.) + if (Constants.CarrierAccounts.IsCustomWorkflowUpdate(account.Type!)) + { + throw new InvalidFunctionError($"This function does not support non-standard carrier accounts, including UPS. Use Update(string, Parameters.CarrierAccount.Update) instead."); + } + + string endpoint = Constants.CarrierAccounts.DeriveUpdateEndpoint(account.Type!, id); // Should always be "carrier_accounts/{ID}" due to guard clause above, but just in case + parameters = parameters.Wrap("carrier_account"); - return await RequestAsync(Method.Put, $"carrier_accounts/{id}", cancellationToken, parameters); + + return await RequestAsync(Method.Put, endpoint, cancellationToken, parameters); } /// @@ -125,9 +148,26 @@ public async Task Update(string id, Dictionary p /// to use for the HTTP request. /// The updated . [CrudOperations.Update] - public async Task Update(string id, Parameters.CarrierAccount.Update parameters, CancellationToken cancellationToken = default) + public async Task Update(string id, Parameters.CarrierAccount.AUpdate parameters, CancellationToken cancellationToken = default) { - return await RequestAsync(Method.Put, $"carrier_accounts/{id}", cancellationToken, parameters.ToDictionary()); + // Need to retrieve account first to check type + CarrierAccount account = await Retrieve(id, cancellationToken); + + // Stop users from using a generic Update parameter set when updating a carrier account with a custom workflow (e.g. UpsAccount) + if (parameters.GetType() == typeof(Parameters.CarrierAccount.Update) && Constants.CarrierAccounts.IsCustomWorkflowUpdate(account.Type!)) + { + throw new InvalidParameterError("parameters", $"Use a {account.Type} custom workflow parameter set instead."); + } + + // Stop users from using a custom Update parameter set when updating a carrier account with a standard workflow + if (parameters.GetType() != typeof(Parameters.CarrierAccount.Update) && !Constants.CarrierAccounts.IsCustomWorkflowUpdate(account.Type!)) + { + throw new InvalidParameterError("parameters", "Use a standard Update parameter set instead."); + } + + string endpoint = parameters.Endpoint(id); + + return await RequestAsync(Method.Put, endpoint, cancellationToken, parameters.ToDictionary()); } /// diff --git a/EasyPost/Utilities/Internal/Extensions/Dictionaries.cs b/EasyPost/Utilities/Internal/Extensions/Dictionaries.cs index 58e83cd84..045ae4014 100644 --- a/EasyPost/Utilities/Internal/Extensions/Dictionaries.cs +++ b/EasyPost/Utilities/Internal/Extensions/Dictionaries.cs @@ -47,14 +47,14 @@ public static Dictionary ToStringNonNullableObjectDictionary(thi } /// - /// Add a key-value pair to a dictionary if the key does not exist, otherwise update the value. + /// Add a key-value pair to a dictionary if the key path does not exist, otherwise update the value. /// This is a workaround for the fact that does not have an AddOrUpdate method. /// This update runs in-place, so the dictionary is not copied and a new dictionary is not returned. /// /// The dictionary to add/update the key-value pair in. - /// The key to add/update. /// The value to add/update. - public static void AddOrUpdate(this IDictionary dictionary, string key, object? value) + /// The key path to add/update. + public static void AddOrUpdate(this IDictionary dictionary, object? value, string key) { try { @@ -66,6 +66,59 @@ public static void AddOrUpdate(this IDictionary dictionary, str } } + /// + /// Add a key-value pair to a dictionary if the key path does not exist, otherwise update the value. + /// This is a workaround for the fact that does not have an AddOrUpdate method. + /// This update runs in-place, so the dictionary is not copied and a new dictionary is not returned. + /// + /// The dictionary to add/update the key-value pair in. + /// The value to add/update. + /// The key path to add/update. + public static void AddOrUpdate(this IDictionary dictionary, object? value, params string[] path) + { + switch (path.Length) + { + // Don't need to go down + case 0: + return; + + // Last key left + case 1: + dictionary.AddOrUpdate(value, path[0]); + return; + + // ReSharper disable once RedundantEmptySwitchSection + default: + break; + } + + // Need to go down another level + // Get the key and update the list of keys + string key = path[0]; + path = path.Skip(1).ToArray(); +#pragma warning disable CA1854 // Don't want to use TryGetValue because no need for value + if (!dictionary.ContainsKey(key)) + { + var newDictionary = new Dictionary(); + newDictionary.AddOrUpdate(value, path); + dictionary[key] = newDictionary; + } +#pragma warning restore CA1854 + + object? subDirectory = dictionary[key]; + if (subDirectory is Dictionary subDictionary) + { + subDictionary.AddOrUpdate(value, path); + dictionary[key] = subDictionary; + } + else + { +#pragma warning disable CA2201 // Don't throw base Exception class + throw new Exception("Found a non-dictionary while traversing the dictionary"); +#pragma warning restore CA2201 // Don't throw base Exception class + } + } + /// /// Merge another dictionary into this dictionary. /// @@ -76,7 +129,7 @@ internal static Dictionary MergeIn(this Dictionary item in other) { - dictionary!.AddOrUpdate(item.Key, item.Value); + dictionary!.AddOrUpdate(item.Value, item.Key); } return dictionary; diff --git a/Makefile b/Makefile index 4c90d2063..6face86c1 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,11 @@ coverage-check: docs: dotnet tool run docfx docs/docfx.json +## init-examples-submodule - Initialize the examples submodule +init-examples-submodule: + git submodule init + git submodule update + ## install-tools - Install required dotnet tools install-tools: dotnet new tool-manifest || exit 0 @@ -48,7 +53,7 @@ install-styleguide: | update-examples-submodule sh examples/symlink_directory_files.sh examples/style_guides/csharp . ## install - Install requirements -install: | install-tools update-examples-submodule +install: | install-tools init-examples-submodule ## lint - Lints the solution (EasyPost + Tests + Integration + F#/VB compatibilities) (check IDE and SA rule violations) lint: @@ -131,4 +136,4 @@ fs-compat-test: vb-compat-test: dotnet test EasyPost.Compatibility.VB/EasyPost.Compatibility.VB.vbproj -f ${fw} -restore -.PHONY: help analyze build build-fw build-prod clean coverage coverage-check docs format install-styleguide install-tools install lint lint-scripts release restore scan setup-win setup-unix test update-examples-submodule unit-test integration-test fs-compat-test vb-compat-test +.PHONY: help analyze build build-fw build-prod clean coverage coverage-check docs format init-examples-submodule install-styleguide install-tools install lint lint-scripts release restore scan setup-win setup-unix test update-examples-submodule unit-test integration-test fs-compat-test vb-compat-test diff --git a/examples b/examples index b9fde9bea..b79c16ee6 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit b9fde9bead7750256bc986802841ce7576eee0a4 +Subproject commit b79c16ee6c3ea1e9da707b95c0a67157fa906519