From 5e8c9f01a99a5d767dc435429b564cc381316dfb Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Thu, 15 Oct 2026 14:29:49 -0600 Subject: [PATCH 1/2] feat: add support for carrier open endpoint Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- CHANGELOG.md | 1 + .../CarrierAccountServiceTest.cs | 67 +++++++++++++++++++ EasyPost/Constants.cs | 61 +++++++++++------ EasyPost/Models/API/CarrierAccountType.cs | 25 +++++++ .../CarrierAccount/CreateFedExDefault.cs | 23 +++++++ .../CarrierAccount/CreateGofoWallet.cs | 23 +++++++ .../CarrierAccount/CreateUniUniWallet.cs | 23 +++++++ .../Parameters/CarrierAccount/CreateUpsDap.cs | 23 +++++++ .../CarrierAccount/CreateVehoWallet.cs | 23 +++++++ 9 files changed, 249 insertions(+), 20 deletions(-) create mode 100644 EasyPost/Parameters/CarrierAccount/CreateFedExDefault.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateGofoWallet.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateUniUniWallet.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateUpsDap.cs create mode 100644 EasyPost/Parameters/CarrierAccount/CreateVehoWallet.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f4b41588..441e67396 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Makes `ReferralCustomer.RetrieveEasypostStripeApiKey` public to help facilitate adding credit cards using Stripe.js - Correctly passes `end_shipper_id` param instead of `end_shipper` in shipment buy calls (closes [669](https://github.com/EasyPost/easypost-csharp/issues/669)) - Add `Surcharge` model and `Surcharges` property to `Rate` class +- Adds support for `FedexDefaultAccount`, `GofoWalletAccount`, `UpsDapAccount`, `UniUniWalletAccount`, and `VehoWalletAccount` by properly routing carrier-account create requests to the `/carrier_accounts/open` endpoint ## v7.10.0 (2026-07-24) diff --git a/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs b/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs index 221ec3550..6c7dc78a5 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; @@ -110,6 +112,30 @@ public async Task TestCreateUps() Assert.StartsWith("ca_", carrierAccount.Id); } + [Theory] + [CrudOperations.Create] + [Testing.Parameters] + [MemberData(nameof(CreateUrlRoutingData))] + public async Task TestCreateUrlRouting(Parameters.CarrierAccount.ACreate parameters, string expectedEndpoint) + { + string endpointRegex = $@"v2\/{expectedEndpoint.Replace("/", @"\/")}$"; + string responseType = parameters.Type ?? string.Empty; + + UseMockClient(new List + { + new( + new TestUtils.MockRequestMatchRules(Method.Post, endpointRegex), + new TestUtils.MockRequestResponseInfo(HttpStatusCode.Created, content: $"{{\"id\":\"ca_123\",\"object\":\"CarrierAccount\",\"type\":\"{responseType}\"}}") + ) + }); + + CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); + + Assert.IsType(carrierAccount); + Assert.StartsWith("ca_", carrierAccount.Id); + Assert.Equal(responseType, carrierAccount.Type); + } + [Fact] [CrudOperations.Create] [Testing.Exception] @@ -196,6 +222,47 @@ public async Task TestUpdateUps() #endregion + public static IEnumerable CreateUrlRoutingData() + { + yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateFedEx(new Dictionary()), "carrier_accounts/register" }; + yield return new object[] { CreateFedExSmartPostParameters(), "carrier_accounts/register" }; + yield return new object[] { new Parameters.CarrierAccount.CreateFedExDefault(), "carrier_accounts/open" }; + yield return new object[] { new Parameters.CarrierAccount.CreateGofoWallet(), "carrier_accounts/open" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsDap(), "carrier_accounts/open" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUniUniWallet(), "carrier_accounts/open" }; + yield return new object[] { new Parameters.CarrierAccount.CreateVehoWallet(), "carrier_accounts/open" }; + yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.AmazonShippingAccount.Name }, "carrier_accounts/register_oauth" }; + yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateUps(new Dictionary()), "carrier_accounts/register_oauth" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsMailInnovations { AccountNumber = "123456789" }, "carrier_accounts/register_oauth" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsSurePost { AccountNumber = "123456789" }, "carrier_accounts/register_oauth" }; + yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.UspsShipAccount.Name }, "carrier_accounts/register_oauth" }; + } + + private static Parameters.CarrierAccount.CreateFedExSmartPost CreateFedExSmartPostParameters() + { + return new Parameters.CarrierAccount.CreateFedExSmartPost + { + AccountNumber = "123456789", + HubId = "1234", + CorporateAddressCity = "San Francisco", + CorporateAddressCountryCode = "US", + CorporateAddressPostalCode = "94105", + CorporateAddressState = "CA", + CorporateAddressStreet = "345 California St", + CorporateCompanyName = "EasyPost", + CorporateEmailAddress = "me@example.com", + CorporateFirstName = "Demo", + CorporateLastName = "User", + CorporateJobTitle = "Developer", + CorporatePhoneNumber = "5555555555", + ShippingAddressCity = "San Francisco", + ShippingAddressCountryCode = "US", + ShippingAddressPostalCode = "94105", + ShippingAddressState = "CA", + ShippingAddressStreet = "345 California St", + }; + } + #endregion } } diff --git a/EasyPost/Constants.cs b/EasyPost/Constants.cs index 986f8d4fb..56360c6ea 100644 --- a/EasyPost/Constants.cs +++ b/EasyPost/Constants.cs @@ -124,38 +124,59 @@ public static class ErrorMessages public static class CarrierAccounts { /// - /// Carrier account types that support custom creation workflows. + /// Carrier account type mappings by create endpoint. /// - private static List CarrierTypesWithCustomCreateWorkflows => new() + private static readonly Dictionary> CarrierTypesByCreateEndpoint = new() { - CarrierAccountType.AmazonShippingAccount.Name, - CarrierAccountType.FedEx.Name, - CarrierAccountType.FedExSmartPost.Name, - CarrierAccountType.Ups.Name, - CarrierAccountType.UpsMailInnovations.Name, - CarrierAccountType.UpsSurePost.Name, - CarrierAccountType.UspsShipAccount.Name, + { + OpenCreateEndpoint, + new List + { + CarrierAccountType.FedExDefaultAccount.Name, + CarrierAccountType.GofoWalletAccount.Name, + CarrierAccountType.UpsDapAccount.Name, + CarrierAccountType.UniUniWalletAccount.Name, + CarrierAccountType.VehoWalletAccount.Name, + } + }, + { + CustomCreateEndpoint, + new List + { + CarrierAccountType.FedEx.Name, + CarrierAccountType.FedExSmartPost.Name, + } + }, + { + OauthCreateEndpoint, + new List + { + CarrierAccountType.AmazonShippingAccount.Name, + CarrierAccountType.Ups.Name, + CarrierAccountType.UpsMailInnovations.Name, + CarrierAccountType.UpsSurePost.Name, + CarrierAccountType.UspsShipAccount.Name, + } + }, }; internal static string DeriveCreateEndpoint(string carrierType) { - string endpoint = StandardCreateEndpoint; - - var @switch = new SwitchCase + foreach (KeyValuePair> endpointMapping in CarrierTypesByCreateEndpoint) { - { new List { CarrierAccountType.FedEx.Name, CarrierAccountType.FedExSmartPost.Name }.Contains(carrierType), () => endpoint = CustomCreateEndpoint }, - { new List { CarrierAccountType.AmazonShippingAccount.Name, CarrierAccountType.Ups.Name, CarrierAccountType.UpsMailInnovations.Name, CarrierAccountType.UpsSurePost.Name, CarrierAccountType.UspsShipAccount.Name, }.Contains(carrierType), () => endpoint = OauthCreateEndpoint }, - { SwitchCaseScenario.Default, () => endpoint = StandardCreateEndpoint }, - }; - - @switch.MatchFirstTrue(); + if (endpointMapping.Value.Contains(carrierType)) + { + return endpointMapping.Key; + } + } - return endpoint; + return StandardCreateEndpoint; } - internal static bool IsCustomWorkflowCreate(string carrierType) => CarrierTypesWithCustomCreateWorkflows.Contains(carrierType); + internal static bool IsCustomWorkflowCreate(string carrierType) => DeriveCreateEndpoint(carrierType) != StandardCreateEndpoint; internal const string StandardCreateEndpoint = "carrier_accounts"; + internal const string OpenCreateEndpoint = "carrier_accounts/open"; internal const string CustomCreateEndpoint = "carrier_accounts/register"; internal const string OauthCreateEndpoint = "carrier_accounts/register_oauth"; internal const string StandardUpdateEndpoint = "carrier_accounts/{0}"; diff --git a/EasyPost/Models/API/CarrierAccountType.cs b/EasyPost/Models/API/CarrierAccountType.cs index fae0988bf..e07876d08 100644 --- a/EasyPost/Models/API/CarrierAccountType.cs +++ b/EasyPost/Models/API/CarrierAccountType.cs @@ -43,6 +43,31 @@ public class CarrierAccountType : ValueEnum /// public static readonly CarrierAccountType UspsShipAccount = new CarrierAccountType(63, "UspsShipAccount"); + /// + /// Represents a FedEx Default carrier account. + /// + public static readonly CarrierAccountType FedExDefaultAccount = new CarrierAccountType(64, "FedexDefaultAccount"); + + /// + /// Represents a GOFO Wallet carrier account. + /// + public static readonly CarrierAccountType GofoWalletAccount = new CarrierAccountType(65, "GofoWalletAccount"); + + /// + /// Represents a UPS DAP carrier account. + /// + public static readonly CarrierAccountType UpsDapAccount = new CarrierAccountType(66, "UpsDapAccount"); + + /// + /// Represents a UniUni Wallet carrier account. + /// + public static readonly CarrierAccountType UniUniWalletAccount = new CarrierAccountType(67, "UniUniWalletAccount"); + + /// + /// Represents a Veho Wallet carrier account. + /// + public static readonly CarrierAccountType VehoWalletAccount = new CarrierAccountType(68, "VehoWalletAccount"); + /// /// Initializes a new instance of the class. /// diff --git a/EasyPost/Parameters/CarrierAccount/CreateFedExDefault.cs b/EasyPost/Parameters/CarrierAccount/CreateFedExDefault.cs new file mode 100644 index 000000000..16f915581 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateFedExDefault.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateFedExDefault : Create + { + /// + internal override string Endpoint => Constants.CarrierAccounts.OpenCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateFedExDefault() + : base(CarrierAccountType.FedExDefaultAccount) + { + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/CreateGofoWallet.cs b/EasyPost/Parameters/CarrierAccount/CreateGofoWallet.cs new file mode 100644 index 000000000..b77c82e99 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateGofoWallet.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateGofoWallet : Create + { + /// + internal override string Endpoint => Constants.CarrierAccounts.OpenCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateGofoWallet() + : base(CarrierAccountType.GofoWalletAccount) + { + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/CreateUniUniWallet.cs b/EasyPost/Parameters/CarrierAccount/CreateUniUniWallet.cs new file mode 100644 index 000000000..36fb8a456 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateUniUniWallet.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateUniUniWallet : Create + { + /// + internal override string Endpoint => Constants.CarrierAccounts.OpenCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateUniUniWallet() + : base(CarrierAccountType.UniUniWalletAccount) + { + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/CreateUpsDap.cs b/EasyPost/Parameters/CarrierAccount/CreateUpsDap.cs new file mode 100644 index 000000000..b80398d72 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateUpsDap.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateUpsDap : Create + { + /// + internal override string Endpoint => Constants.CarrierAccounts.OpenCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateUpsDap() + : base(CarrierAccountType.UpsDapAccount) + { + } + } +} diff --git a/EasyPost/Parameters/CarrierAccount/CreateVehoWallet.cs b/EasyPost/Parameters/CarrierAccount/CreateVehoWallet.cs new file mode 100644 index 000000000..4e1429544 --- /dev/null +++ b/EasyPost/Parameters/CarrierAccount/CreateVehoWallet.cs @@ -0,0 +1,23 @@ +using System.Diagnostics.CodeAnalysis; +using EasyPost.Models.API; + +namespace EasyPost.Parameters.CarrierAccount +{ + /// + /// Parameters for API calls. + /// + [ExcludeFromCodeCoverage] + public class CreateVehoWallet : Create + { + /// + internal override string Endpoint => Constants.CarrierAccounts.OpenCreateEndpoint; + + /// + /// Initializes a new instance of the class. + /// + public CreateVehoWallet() + : base(CarrierAccountType.VehoWalletAccount) + { + } + } +} From aeff53d422d398ca9ad13b3599d292a2814c5797 Mon Sep 17 00:00:00 2001 From: Justintime50 <39606064+Justintime50@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:18:33 -0600 Subject: [PATCH 2/2] test: use VCR for carrier routing coverage Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../CarrierAccountServiceTest.cs | 33 ++++----- .../CarrierAccountServiceTest.cs | 71 +++++++++++-------- .../create_url_routing_amazon_shipping.json | 53 ++++++++++++++ .../create_url_routing_fedex.json | 53 ++++++++++++++ .../create_url_routing_fedex_default.json | 53 ++++++++++++++ .../create_url_routing_fedex_smartpost.json | 53 ++++++++++++++ .../create_url_routing_gofo_wallet.json | 53 ++++++++++++++ .../create_url_routing_uniuni_wallet.json | 53 ++++++++++++++ .../create_url_routing_ups.json | 53 ++++++++++++++ .../create_url_routing_ups_dap.json | 53 ++++++++++++++ ...eate_url_routing_ups_mail_innovations.json | 53 ++++++++++++++ .../create_url_routing_ups_surepost.json | 54 ++++++++++++++ .../create_url_routing_usps_ship.json | 53 ++++++++++++++ .../create_url_routing_veho_wallet.json | 53 ++++++++++++++ 14 files changed, 697 insertions(+), 44 deletions(-) create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_amazon_shipping.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_default.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_smartpost.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_gofo_wallet.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_uniuni_wallet.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_dap.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_mail_innovations.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_surepost.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_usps_ship.json create mode 100644 EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_veho_wallet.json diff --git a/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs b/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs index 2d1e6c188..652c17094 100644 --- a/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs +++ b/EasyPost.Tests/ServicesTests/CarrierAccountServiceTest.cs @@ -50,28 +50,29 @@ public async Task TestCreate() Assert.Equal("DhlEcsAccount", carrierAccount.Type); } - [Fact] + [Theory] [CrudOperations.Create] [Testing.Parameters] - public async Task TestCreateWithCustomWorkflow() + [InlineData("FedexAccount")] + [InlineData("FedexSmartpostAccount")] + [InlineData("AmazonShippingAccount")] + [InlineData("UpsAccount")] + [InlineData("UpsMailInnovationsAccount")] + [InlineData("UpsSurepostAccount")] + [InlineData("UspsShipAccount")] + [InlineData("FedexDefaultAccount")] + [InlineData("GofoWalletAccount")] + [InlineData("UpsDapAccount")] + [InlineData("UniUniWalletAccount")] + [InlineData("VehoWalletAccount")] + public async Task TestCreateWithCustomWorkflow(string carrierType) { UseVCR("create_with_custom_workflow"); - // FedEx or UPS should trigger a function error since not supported by legacy parameter method - try - { - Dictionary parameters = Fixtures.BasicCarrierAccount; - parameters["type"] = CarrierAccountType.FedEx.Name; - parameters["registration_data"] = new Dictionary(); + Dictionary parameters = Fixtures.BasicCarrierAccount; + parameters["type"] = carrierType; - CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); - CleanUpAfterTest(carrierAccount.Id); - } - catch (InvalidFunctionError e) - { - // Function should have been halted due to incompatible carrier account type - Assert.NotNull(e); - } + await Assert.ThrowsAsync(async () => await Client.CarrierAccount.Create(parameters)); } [Fact] diff --git a/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs b/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs index 6c7dc78a5..dd625c9bc 100644 --- a/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs +++ b/EasyPost.Tests/ServicesTests/WithParameters/CarrierAccountServiceTest.cs @@ -1,13 +1,14 @@ using System.Collections.Generic; -using System.Net; +using System.IO; +using System.Linq; 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; using EasyPost.Utilities.Internal.Attributes; +using Newtonsoft.Json.Linq; using Xunit; namespace EasyPost.Tests.ServicesTests.WithParameters @@ -116,24 +117,22 @@ public async Task TestCreateUps() [CrudOperations.Create] [Testing.Parameters] [MemberData(nameof(CreateUrlRoutingData))] - public async Task TestCreateUrlRouting(Parameters.CarrierAccount.ACreate parameters, string expectedEndpoint) + public async Task TestCreateUrlRouting(Parameters.CarrierAccount.ACreate parameters, string cassetteName, string expectedEndpoint, string expectedBodyKey) { - string endpointRegex = $@"v2\/{expectedEndpoint.Replace("/", @"\/")}$"; - string responseType = parameters.Type ?? string.Empty; + UseVCR(cassetteName); - UseMockClient(new List + try { - new( - new TestUtils.MockRequestMatchRules(Method.Post, endpointRegex), - new TestUtils.MockRequestResponseInfo(HttpStatusCode.Created, content: $"{{\"id\":\"ca_123\",\"object\":\"CarrierAccount\",\"type\":\"{responseType}\"}}") - ) - }); - - CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); + CarrierAccount carrierAccount = await Client.CarrierAccount.Create(parameters); + CleanUpAfterTest(carrierAccount.Id); + } + catch (ApiError error) + { + Assert.NotEqual(404, error.StatusCode); + Assert.NotEqual(500, error.StatusCode); + } - Assert.IsType(carrierAccount); - Assert.StartsWith("ca_", carrierAccount.Id); - Assert.Equal(responseType, carrierAccount.Type); + AssertCassetteRequest(cassetteName, expectedEndpoint, expectedBodyKey); } [Fact] @@ -224,18 +223,18 @@ public async Task TestUpdateUps() public static IEnumerable CreateUrlRoutingData() { - yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateFedEx(new Dictionary()), "carrier_accounts/register" }; - yield return new object[] { CreateFedExSmartPostParameters(), "carrier_accounts/register" }; - yield return new object[] { new Parameters.CarrierAccount.CreateFedExDefault(), "carrier_accounts/open" }; - yield return new object[] { new Parameters.CarrierAccount.CreateGofoWallet(), "carrier_accounts/open" }; - yield return new object[] { new Parameters.CarrierAccount.CreateUpsDap(), "carrier_accounts/open" }; - yield return new object[] { new Parameters.CarrierAccount.CreateUniUniWallet(), "carrier_accounts/open" }; - yield return new object[] { new Parameters.CarrierAccount.CreateVehoWallet(), "carrier_accounts/open" }; - yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.AmazonShippingAccount.Name }, "carrier_accounts/register_oauth" }; - yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateUps(new Dictionary()), "carrier_accounts/register_oauth" }; - yield return new object[] { new Parameters.CarrierAccount.CreateUpsMailInnovations { AccountNumber = "123456789" }, "carrier_accounts/register_oauth" }; - yield return new object[] { new Parameters.CarrierAccount.CreateUpsSurePost { AccountNumber = "123456789" }, "carrier_accounts/register_oauth" }; - yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.UspsShipAccount.Name }, "carrier_accounts/register_oauth" }; + yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateFedEx(new Dictionary()), "create_url_routing_fedex", "/carrier_accounts/register", "carrier_account" }; + yield return new object[] { CreateFedExSmartPostParameters(), "create_url_routing_fedex_smartpost", "/carrier_accounts/register", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateFedExDefault(), "create_url_routing_fedex_default", "/carrier_accounts/open", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateGofoWallet(), "create_url_routing_gofo_wallet", "/carrier_accounts/open", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsDap(), "create_url_routing_ups_dap", "/carrier_accounts/open", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUniUniWallet(), "create_url_routing_uniuni_wallet", "/carrier_accounts/open", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateVehoWallet(), "create_url_routing_veho_wallet", "/carrier_accounts/open", "carrier_account" }; + yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.AmazonShippingAccount.Name }, "create_url_routing_amazon_shipping", "/carrier_accounts/register_oauth", "carrier_account_oauth_registrations" }; + yield return new object[] { Fixtures.Parameters.CarrierAccounts.CreateUps(new Dictionary()), "create_url_routing_ups", "/carrier_accounts/register_oauth", "carrier_account_oauth_registrations" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsMailInnovations { AccountNumber = "123456789" }, "create_url_routing_ups_mail_innovations", "/carrier_accounts/register_oauth", "carrier_account_oauth_registrations" }; + yield return new object[] { new Parameters.CarrierAccount.CreateUpsSurePost { AccountNumber = "123456789" }, "create_url_routing_ups_surepost", "/carrier_accounts/register_oauth", "carrier_account_oauth_registrations" }; + yield return new object[] { new Parameters.CarrierAccount.CreateOauth { Type = CarrierAccountType.UspsShipAccount.Name }, "create_url_routing_usps_ship", "/carrier_accounts/register_oauth", "carrier_account_oauth_registrations" }; } private static Parameters.CarrierAccount.CreateFedExSmartPost CreateFedExSmartPostParameters() @@ -263,6 +262,22 @@ private static Parameters.CarrierAccount.CreateFedExSmartPost CreateFedExSmartPo }; } + private static void AssertCassetteRequest(string cassetteName, string expectedEndpoint, string expectedBodyKey) + { + string cassettePath = Path.GetFullPath(Path.Combine(TestUtils.GetSourceFileDirectory(), "..", "..", "cassettes", "carrier_account_service_with_parameters", $"{cassetteName}.json")); + string cassetteJson = File.ReadAllText(cassettePath); + JArray interactions = JArray.Parse(cassetteJson); + JToken? interaction = interactions.FirstOrDefault(); + + Assert.NotNull(interaction); + + string? requestUri = interaction!["Request"]?["Uri"]?.Value(); + string? requestBody = interaction["Request"]?["Body"]?.Value(); + + Assert.EndsWith(expectedEndpoint, requestUri); + Assert.Contains(expectedBodyKey, requestBody); + } + #endregion } } diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_amazon_shipping.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_amazon_shipping.json new file mode 100644 index 000000000..5cc7e7d86 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_amazon_shipping.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 247, + "RecordedAt": "2026-10-15T15:17:51.26568-06:00", + "Request": { + "Body": "{\"carrier_account_oauth_registrations\":{\"type\":\"AmazonShippingAccount\"},\"type\":\"AmazonShippingAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "103" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register_oauth" + }, + "Response": { + "Body": "{\"id\":\"ca_04368dc8fe934d5abe05f5605cc3bee7\",\"object\":\"CarrierAccount\",\"type\":\"AmazonShippingAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:51Z\",\"updated_at\":\"2026-10-15T21:17:51Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"Amazon Shipping\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1737" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "aebfacb46ad142ffe2b7d14f0072e027", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.125611", + "x-node": "web105azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb1azw f29267e751,extlb3azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex.json new file mode 100644 index 000000000..1084889e0 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 245, + "RecordedAt": "2026-10-15T15:17:49.878347-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", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "615" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register" + }, + "Response": { + "Body": "{\"error\":{\"code\":\"GONE\",\"message\":\"The requested resource is no longer available at the server and no forwarding address is known.\",\"errors\":[{\"message\":\"FedEx account registrations must use the multi-factor authentication (MFA) registration workflow. See: https://support.easypost.com/hc/en-us/articles/35262738410253-FedEx-Multi-Factor-Authentication\"}]}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "357" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "cdd585306ad142fde2b7d1480019b1b9", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.055219", + "x-node": "web102azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb4azw f29267e751,extlb2azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 410, + "Message": "Gone" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_default.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_default.json new file mode 100644 index 000000000..6732d1d0b --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_default.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 146, + "RecordedAt": "2026-10-15T15:17:50.223498-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"type\":\"FedexDefaultAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "50" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/open" + }, + "Response": { + "Body": "{\"error\":{\"code\":\"UNPROCESSABLE_ENTITY\",\"message\":\"The request was understood, but cannot be processed.\",\"errors\":[{\"field\":\"name\",\"message\":\"is missing\"},{\"field\":\"street1\",\"message\":\"is missing\"},{\"field\":\"city\",\"message\":\"is missing\"},{\"field\":\"state\",\"message\":\"is missing\"},{\"field\":\"postal_code\",\"message\":\"is missing\"},{\"field\":\"country\",\"message\":\"is missing\"},{\"field\":\"phone\",\"message\":\"is missing\"},{\"field\":\"email\",\"message\":\"is missing\"}]}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "453" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "ef2f756d6ad142fee2b7d14a0019995d", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.025967", + "x-node": "web120azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb1azw f29267e751,extlb1azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 422, + "Message": "Unprocessable Entity" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_smartpost.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_smartpost.json new file mode 100644 index 000000000..0e107bca7 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_fedex_smartpost.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 180, + "RecordedAt": "2026-10-15T15:17:50.070859-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"registration_data\":{\"account_number\":\"123456789\",\"hub_id\":\"1234\",\"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\":\"FedexSmartpostAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "640" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register" + }, + "Response": { + "Body": "{\"error\":{\"code\":\"GONE\",\"message\":\"The requested resource is no longer available at the server and no forwarding address is known.\",\"errors\":[{\"message\":\"FedEx account registrations must use the multi-factor authentication (MFA) registration workflow. See: https://support.easypost.com/hc/en-us/articles/35262738410253-FedEx-Multi-Factor-Authentication\"}]}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "357" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "add87ec66ad142fde2b7d1490072def4", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.054181", + "x-node": "web104azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb3azw f29267e751,extlb3azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 410, + "Message": "Gone" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_gofo_wallet.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_gofo_wallet.json new file mode 100644 index 000000000..5878e8a82 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_gofo_wallet.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 205, + "RecordedAt": "2026-10-15T15:17:50.437715-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"type\":\"GofoWalletAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "48" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/open" + }, + "Response": { + "Body": "{\"id\":\"ca_27a8dacab1604c568652115b849bc979\",\"object\":\"CarrierAccount\",\"type\":\"GofoWalletAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:50Z\",\"updated_at\":\"2026-10-15T21:17:50Z\",\"description\":\"GOFO Wallet Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"GOFO Wallet\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "460" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "cdd5852f6ad142fee2b7d14b0019b255", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.085065", + "x-node": "web118azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb1azw f29267e751,extlb2azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_uniuni_wallet.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_uniuni_wallet.json new file mode 100644 index 000000000..87652de4f --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_uniuni_wallet.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 183, + "RecordedAt": "2026-10-15T15:17:50.807036-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"type\":\"UniUniWalletAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "50" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/open" + }, + "Response": { + "Body": "{\"id\":\"ca_f5e26728d18e4e6c8f24398aff34d341\",\"object\":\"CarrierAccount\",\"type\":\"UniUniWalletAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:50Z\",\"updated_at\":\"2026-10-15T21:17:50Z\",\"description\":\"UniUni Wallet Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"UniUni Wallet\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "600" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "5218e5866ad142fee2b7d14d001999f7", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.066120", + "x-node": "web117azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb4azw f29267e751,extlb1azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups.json new file mode 100644 index 000000000..195bc918d --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 253, + "RecordedAt": "2026-10-15T15:17:51.525176-06:00", + "Request": { + "Body": "{\"carrier_account_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsAccount\"},\"type\":\"UpsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "110" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register_oauth" + }, + "Response": { + "Body": "{\"id\":\"ca_694ee1badda446e398214a212bf379b6\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:51Z\",\"updated_at\":\"2026-10-15T21:17:51Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1778" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "5218e5856ad142ffe2b7d15000199aa1", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.138910", + "x-node": "web127azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb3azw f29267e751,extlb1azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_dap.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_dap.json new file mode 100644 index 000000000..ea4247a42 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_dap.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 170, + "RecordedAt": "2026-10-15T15:17:50.615119-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"type\":\"UpsDapAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "44" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/open" + }, + "Response": { + "Body": "{\"error\":{\"code\":\"UNPROCESSABLE_ENTITY\",\"message\":\"The request was understood, but cannot be processed.\",\"errors\":[{\"field\":\"type\",\"message\":\"Cannot open a UPS DAP account for a user with an existing UPS account\"}]}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "216" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "add87ec56ad142fee2b7d14c0072df89", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.050158", + "x-node": "web122azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb2azw f29267e751,extlb3azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 422, + "Message": "Unprocessable Entity" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_mail_innovations.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_mail_innovations.json new file mode 100644 index 000000000..e14cdafef --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_mail_innovations.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 234, + "RecordedAt": "2026-10-15T15:17:51.766221-06:00", + "Request": { + "Body": "{\"carrier_account_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsMailInnovationsAccount\"},\"type\":\"UpsMailInnovationsAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "140" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register_oauth" + }, + "Response": { + "Body": "{\"id\":\"ca_3defeb282a944f6f948e4ae89aea4de8\",\"object\":\"CarrierAccount\",\"type\":\"UpsMailInnovationsAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:51Z\",\"updated_at\":\"2026-10-15T21:17:51Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS Mail Innovations\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2051" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "cdd5852e6ad142ffe2b7d1510019b39a", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.112951", + "x-node": "web125azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb2azw f29267e751,extlb2azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_surepost.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_surepost.json new file mode 100644 index 000000000..d2141a522 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_ups_surepost.json @@ -0,0 +1,54 @@ +[ + { + "Duration": 230, + "RecordedAt": "2026-10-15T15:17:52.001759-06:00", + "Request": { + "Body": "{\"carrier_account_oauth_registrations\":{\"account_number\":\"123456789\",\"type\":\"UpsSurepostAccount\"},\"type\":\"UpsSurepostAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "126" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register_oauth" + }, + "Response": { + "Body": "{\"id\":\"ca_5de944c6fa2f4f40820394533fd331e2\",\"object\":\"CarrierAccount\",\"type\":\"UpsSurepostAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:51Z\",\"updated_at\":\"2026-10-15T21:17:51Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"UPS SurePost\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1590" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "aebfacae6ad142ffe2b7d1690072e109", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.112177", + "x-node": "web100azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb4azw f29267e751,extlb3azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_usps_ship.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_usps_ship.json new file mode 100644 index 000000000..64d576ce8 --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_usps_ship.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 211, + "RecordedAt": "2026-10-15T15:17:52.222343-06:00", + "Request": { + "Body": "{\"carrier_account_oauth_registrations\":{\"type\":\"UspsShipAccount\"},\"type\":\"UspsShipAccount\"}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "91" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/register_oauth" + }, + "Response": { + "Body": "{\"id\":\"ca_11dc800d513f4b2185527910e584a182\",\"object\":\"CarrierAccount\",\"type\":\"UspsShipAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:52Z\",\"updated_at\":\"2026-10-15T21:17:52Z\",\"description\":null,\"reference\":null,\"billing_type\":\"carrier\",\"readable\":\"Usps Ship\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2573" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "ef2f756f6ad14300e2b7d16a00199b70", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.098394", + "x-node": "web127azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb4azw f29267e751,extlb1azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +] diff --git a/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_veho_wallet.json b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_veho_wallet.json new file mode 100644 index 000000000..6dec1e3fb --- /dev/null +++ b/EasyPost.Tests/cassettes/carrier_account_service_with_parameters/create_url_routing_veho_wallet.json @@ -0,0 +1,53 @@ +[ + { + "Duration": 196, + "RecordedAt": "2026-10-15T15:17:51.011485-06:00", + "Request": { + "Body": "{\"carrier_account\":{\"type\":\"VehoWalletAccount\"}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "48" + }, + "Method": "POST", + "RequestHeaders": { + "Authorization": "", + "User-Agent": "" + }, + "Uri": "https://api.easypost.com/v2/carrier_accounts/open" + }, + "Response": { + "Body": "{\"id\":\"ca_202f1c116cca404da6afb9775df0e3c3\",\"object\":\"CarrierAccount\",\"type\":\"VehoWalletAccount\",\"clone\":false,\"created_at\":\"2026-10-15T21:17:50Z\",\"updated_at\":\"2026-10-15T21:17:50Z\",\"description\":\"Veho Account\",\"reference\":null,\"billing_type\":\"easypost\",\"readable\":\"Veho\",\"logo\":null,\"fields\":{},\"credentials\":{}}", + "BodyContentType": "Json", + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "583" + }, + "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", + "easypost-api-version": "2015-01-01", + "Vary": "EasyPost-Api-Version", + "x-ep-request-uuid": "cdd5852e6ad142fee2b7d14e0019b2d9", + "Cache-Control": "no-store, no-cache, private", + "Pragma": "no-cache", + "x-runtime": "0.073283", + "x-node": "web125azw", + "x-version-label": "easypost-202610151955-b13716d895-main", + "x-backend": "easypost", + "x-proxied": "intlb1azw f29267e751,extlb2azw ff4cfe6eb5", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "Status": { + "Code": 201, + "Message": "Created" + } + } + } +]