From 88726861fba93fd348a76b99a851ecbdaf1c49d5 Mon Sep 17 00:00:00 2001 From: Nate Harris Date: Mon, 7 Feb 2022 16:42:45 -0700 Subject: [PATCH] Test suite updated, VCR implemented, minor patches - Add new tests to .NET (+ VCR, + recorded cassettes), uses env vars for keys, auth keys censored - Add new tests to .NET Framework (no VCR), uses env vars for keys - Note in README what does/does not use VCR, API key levels - Throw exception if URL parameter value is empty in .NET Framework - Set-and-forget returns boolean for success - Fix AddressCollection stores Address - Fix Address creation enforcing `verify` and `verify_strict` parameters - Fix User-Agent for requests (yes, .NET and .NET Framework look different, but after parsing, they'll come out the same) - All requests will have, i.e. `User-Agent: EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13` - Update CHANGELOG --- .github/workflows/ci.yml | 3 + CHANGELOG.md | 5 + EasyPost.Net/Address.cs | 20 + EasyPost.Net/AddressCollection.cs | 2 +- EasyPost.Net/Client.cs | 29 +- EasyPost.Net/Shipment.cs | 60 +- EasyPost.Net/Verification.cs | 1 + EasyPost.Net/WebhookList.cs | 2 +- EasyPost.NetFramework/Address.cs | 20 + EasyPost.NetFramework/AddressCollection.cs | 2 +- EasyPost.NetFramework/CarrierAccount.cs | 5 +- EasyPost.NetFramework/Client.cs | 25 +- EasyPost.NetFramework/Exception.cs | 2 +- EasyPost.NetFramework/Request.cs | 15 +- EasyPost.NetFramework/Shipment.cs | 60 +- EasyPost.NetFramework/User.cs | 5 +- EasyPost.NetFramework/Webhook.cs | 5 +- EasyPost.NetFramework/WebhookList.cs | 2 +- EasyPost.NetFramework/packages.config | 1 + EasyPost.Tests.Net/AddressTest.cs | 379 ++--------- EasyPost.Tests.Net/ApiKeyTest.cs | 19 - EasyPost.Tests.Net/BatchTest.cs | 283 ++++---- EasyPost.Tests.Net/CarrierAccountTest.cs | 110 +++- EasyPost.Tests.Net/CarrierTypeTest.cs | 20 - EasyPost.Tests.Net/ClientConfigurationTest.cs | 27 - EasyPost.Tests.Net/ClientManagerTest.cs | 47 -- EasyPost.Tests.Net/ClientTest.cs | 64 -- EasyPost.Tests.Net/CustomsInfoTest.cs | 89 +-- EasyPost.Tests.Net/CustomsItemTest.cs | 59 +- EasyPost.Tests.Net/EasyPost.Tests.Net.csproj | 19 +- EasyPost.Tests.Net/EasyPostTest.cs | 65 ++ EasyPost.Tests.Net/ErrorTest.cs | 28 +- EasyPost.Tests.Net/EventTest.cs | 65 +- EasyPost.Tests.Net/Fixture.cs | 555 ++++++++++++++++ EasyPost.Tests.Net/InsuranceTest.cs | 159 ++--- EasyPost.Tests.Net/OrderTest.cs | 221 ++----- EasyPost.Tests.Net/ParcelTest.cs | 60 +- EasyPost.Tests.Net/PickupTest.cs | 192 ++---- EasyPost.Tests.Net/RateTest.cs | 98 +-- EasyPost.Tests.Net/RefundTest.cs | 16 + EasyPost.Tests.Net/ReportTest.cs | 135 +++- EasyPost.Tests.Net/RequestTest.cs | 51 -- EasyPost.Tests.Net/ResourceTest.cs | 88 --- EasyPost.Tests.Net/ScanFormTest.cs | 63 +- EasyPost.Tests.Net/SecurityTest.cs | 15 - EasyPost.Tests.Net/ShipmentTest.cs | 616 ++++-------------- EasyPost.Tests.Net/TimeoutTest.cs | 23 - EasyPost.Tests.Net/TrackerTest.cs | 108 ++- EasyPost.Tests.Net/UserTest.cs | 167 +++-- EasyPost.Tests.Net/VCR.cs | 105 +++ EasyPost.Tests.Net/WebhookTest.cs | 142 +++- EasyPost.Tests.Net/cassettes/address/all.json | 50 ++ .../cassettes/address/create.json | 54 ++ .../cassettes/address/createVerifyStrict.json | 54 ++ .../cassettes/address/create_and_verify.json | 55 ++ .../cassettes/address/create_verify.json | 54 ++ .../cassettes/address/retrieve.json | 102 +++ .../cassettes/address/verify.json | 104 +++ .../cassettes/batch/add_remove_shipment.json | 208 ++++++ EasyPost.Tests.Net/cassettes/batch/all.json | 50 ++ EasyPost.Tests.Net/cassettes/batch/buy.json | 101 +++ .../cassettes/batch/create.json | 54 ++ .../cassettes/batch/create_scan_form.json | 149 +++++ EasyPost.Tests.Net/cassettes/batch/label.json | 149 +++++ .../cassettes/batch/retrieve.json | 101 +++ .../cassettes/carrier_account/all.json | 50 ++ .../cassettes/carrier_account/create.json | 53 ++ .../cassettes/carrier_account/delete.json | 101 +++ .../cassettes/carrier_account/retrieve.json | 101 +++ .../cassettes/carrier_account/types.json | 49 ++ .../cassettes/carrier_account/update.json | 104 +++ .../cassettes/customs_info/create.json | 54 ++ .../cassettes/customs_info/retrieve.json | 102 +++ .../cassettes/customs_item/create.json | 54 ++ .../cassettes/customs_item/retrieve.json | 102 +++ EasyPost.Tests.Net/cassettes/error/error.json | 52 ++ EasyPost.Tests.Net/cassettes/event/all.json | 51 ++ .../cassettes/event/retrieve.json | 98 +++ .../cassettes/event/retrieve_bad_input.json | 49 ++ .../cassettes/insurance/all.json | 50 ++ .../cassettes/insurance/create.json | 106 +++ .../cassettes/insurance/retrieve.json | 154 +++++ EasyPost.Tests.Net/cassettes/order/buy.json | 102 +++ .../cassettes/order/create.json | 54 ++ .../cassettes/order/get_rates.json | 102 +++ .../cassettes/order/retrieve.json | 102 +++ .../cassettes/parcel/create.json | 54 ++ .../cassettes/parcel/retrieve.json | 102 +++ EasyPost.Tests.Net/cassettes/pickup/buy.json | 154 +++++ .../cassettes/pickup/cancel.json | 201 ++++++ .../cassettes/pickup/create.json | 105 +++ .../cassettes/pickup/retrieve.json | 153 +++++ .../cassettes/rate/retrieve.json | 103 +++ EasyPost.Tests.Net/cassettes/report/all.json | 50 ++ .../report/create_payment_log_report.json | 50 ++ .../report/create_refund_report.json | 50 ++ .../create_shipment_invoice_report.json | 50 ++ .../report/create_shipment_report.json | 50 ++ .../report/create_tracker_report.json | 50 ++ .../report/retrieve_payment_log_report.json | 98 +++ .../report/retrieve_refund_report.json | 98 +++ .../retrieve_shipment_invoice_report.json | 98 +++ .../report/retrieve_shipment_report.json | 98 +++ .../report/retrieve_tracker_report.json | 98 +++ .../cassettes/scan_form/all.json | 50 ++ .../cassettes/scan_form/create.json | 105 +++ .../cassettes/scan_form/retrieve.json | 153 +++++ .../cassettes/shipment/all.json | 51 ++ .../cassettes/shipment/buy.json | 105 +++ .../cassettes/shipment/convert_label.json | 103 +++ .../cassettes/shipment/create.json | 54 ++ .../shipment/create_empty_objects.json | 54 ++ .../shipment/create_tax_identifiers.json | 54 ++ .../cassettes/shipment/insure.json | 102 +++ .../cassettes/shipment/refund.json | 102 +++ .../cassettes/shipment/regenerate_rates.json | 102 +++ .../cassettes/shipment/retrieve.json | 103 +++ .../cassettes/shipment/smartrate.json | 102 +++ EasyPost.Tests.Net/cassettes/tracker/all.json | 51 ++ .../cassettes/tracker/create.json | 54 ++ .../cassettes/tracker/create_list.json | 53 ++ .../cassettes/tracker/retrieve.json | 102 +++ .../cassettes/user/retrieve.json | 50 ++ .../cassettes/user/retrieve_me.json | 50 ++ EasyPost.Tests.Net/cassettes/user/update.json | 102 +++ .../cassettes/user/update_brand.json | 101 +++ EasyPost.Tests.Net/cassettes/webhook/all.json | 50 ++ .../cassettes/webhook/create.json | 149 +++++ .../cassettes/webhook/delete.json | 149 +++++ .../cassettes/webhook/retrieve.json | 149 +++++ .../EasyPost.Tests.Net50.csproj | 40 +- .../EasyPost.Tests.Net60.csproj | 40 +- .../EasyPost.Tests.NetCore31.csproj | 40 +- EasyPost.Tests.NetFramework/AddressTest.cs | 372 ++--------- EasyPost.Tests.NetFramework/ApiKeyTest.cs | 20 - EasyPost.Tests.NetFramework/BatchTest.cs | 275 +++----- .../CarrierAccountTest.cs | 97 ++- .../CarrierTypeTest.cs | 20 - .../ClientConfigurationTest.cs | 27 - .../ClientManagerTest.cs | 47 -- EasyPost.Tests.NetFramework/ClientTest.cs | 64 -- .../CustomsInfoTest.cs | 88 +-- .../CustomsItemTest.cs | 56 +- EasyPost.Tests.NetFramework/EasyPostTest.cs | 53 ++ EasyPost.Tests.NetFramework/ErrorTest.cs | 28 +- EasyPost.Tests.NetFramework/EventTest.cs | 60 +- EasyPost.Tests.NetFramework/Fixture.cs | 437 +++++++++++++ EasyPost.Tests.NetFramework/InsuranceTest.cs | 155 +---- EasyPost.Tests.NetFramework/OrderTest.cs | 213 ++---- EasyPost.Tests.NetFramework/ParcelTest.cs | 57 +- EasyPost.Tests.NetFramework/PickupTest.cs | 179 ++--- EasyPost.Tests.NetFramework/RateTest.cs | 98 +-- EasyPost.Tests.NetFramework/RefundTest.cs | 16 + EasyPost.Tests.NetFramework/ReportTest.cs | 130 +++- EasyPost.Tests.NetFramework/RequestTest.cs | 51 -- EasyPost.Tests.NetFramework/ResourceTest.cs | 88 --- EasyPost.Tests.NetFramework/ScanFormTest.cs | 58 +- EasyPost.Tests.NetFramework/SecurityTest.cs | 14 - EasyPost.Tests.NetFramework/ShipmentTest.cs | 608 +++-------------- EasyPost.Tests.NetFramework/TestSuite.cs | 45 ++ EasyPost.Tests.NetFramework/TimeoutTest.cs | 23 - EasyPost.Tests.NetFramework/TrackerTest.cs | 103 +-- EasyPost.Tests.NetFramework/UserTest.cs | 148 +++-- EasyPost.Tests.NetFramework/WebhookTest.cs | 126 +++- .../EasyPost.Tests.NetFramework35.csproj | 39 +- EasyPost.sln | 6 + README.md | 8 + Scotch/Cassette.cs | 53 ++ Scotch/HttpInteraction.cs | 145 +++++ Scotch/RecordingHandler.cs | 50 ++ Scotch/ReplayingHandler.cs | 46 ++ Scotch/Scotch.cs | 47 ++ Scotch/Scotch.csproj | 25 + Scotch/Tools.cs | 24 + Scotch/VCRException.cs | 11 + 175 files changed, 11024 insertions(+), 4595 deletions(-) delete mode 100644 EasyPost.Tests.Net/ApiKeyTest.cs delete mode 100644 EasyPost.Tests.Net/CarrierTypeTest.cs delete mode 100644 EasyPost.Tests.Net/ClientConfigurationTest.cs delete mode 100644 EasyPost.Tests.Net/ClientManagerTest.cs delete mode 100644 EasyPost.Tests.Net/ClientTest.cs create mode 100644 EasyPost.Tests.Net/EasyPostTest.cs create mode 100644 EasyPost.Tests.Net/Fixture.cs create mode 100644 EasyPost.Tests.Net/RefundTest.cs delete mode 100644 EasyPost.Tests.Net/RequestTest.cs delete mode 100644 EasyPost.Tests.Net/ResourceTest.cs delete mode 100644 EasyPost.Tests.Net/SecurityTest.cs delete mode 100644 EasyPost.Tests.Net/TimeoutTest.cs create mode 100644 EasyPost.Tests.Net/VCR.cs create mode 100644 EasyPost.Tests.Net/cassettes/address/all.json create mode 100644 EasyPost.Tests.Net/cassettes/address/create.json create mode 100644 EasyPost.Tests.Net/cassettes/address/createVerifyStrict.json create mode 100644 EasyPost.Tests.Net/cassettes/address/create_and_verify.json create mode 100644 EasyPost.Tests.Net/cassettes/address/create_verify.json create mode 100644 EasyPost.Tests.Net/cassettes/address/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/address/verify.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/add_remove_shipment.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/all.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/buy.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/create.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/create_scan_form.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/label.json create mode 100644 EasyPost.Tests.Net/cassettes/batch/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/all.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/create.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/delete.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/types.json create mode 100644 EasyPost.Tests.Net/cassettes/carrier_account/update.json create mode 100644 EasyPost.Tests.Net/cassettes/customs_info/create.json create mode 100644 EasyPost.Tests.Net/cassettes/customs_info/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/customs_item/create.json create mode 100644 EasyPost.Tests.Net/cassettes/customs_item/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/error/error.json create mode 100644 EasyPost.Tests.Net/cassettes/event/all.json create mode 100644 EasyPost.Tests.Net/cassettes/event/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/event/retrieve_bad_input.json create mode 100644 EasyPost.Tests.Net/cassettes/insurance/all.json create mode 100644 EasyPost.Tests.Net/cassettes/insurance/create.json create mode 100644 EasyPost.Tests.Net/cassettes/insurance/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/order/buy.json create mode 100644 EasyPost.Tests.Net/cassettes/order/create.json create mode 100644 EasyPost.Tests.Net/cassettes/order/get_rates.json create mode 100644 EasyPost.Tests.Net/cassettes/order/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/parcel/create.json create mode 100644 EasyPost.Tests.Net/cassettes/parcel/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/pickup/buy.json create mode 100644 EasyPost.Tests.Net/cassettes/pickup/cancel.json create mode 100644 EasyPost.Tests.Net/cassettes/pickup/create.json create mode 100644 EasyPost.Tests.Net/cassettes/pickup/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/rate/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/report/all.json create mode 100644 EasyPost.Tests.Net/cassettes/report/create_payment_log_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/create_refund_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/create_shipment_invoice_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/create_shipment_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/create_tracker_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/retrieve_payment_log_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/retrieve_refund_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/retrieve_shipment_invoice_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/retrieve_shipment_report.json create mode 100644 EasyPost.Tests.Net/cassettes/report/retrieve_tracker_report.json create mode 100644 EasyPost.Tests.Net/cassettes/scan_form/all.json create mode 100644 EasyPost.Tests.Net/cassettes/scan_form/create.json create mode 100644 EasyPost.Tests.Net/cassettes/scan_form/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/all.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/buy.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/convert_label.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/create.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/create_empty_objects.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/create_tax_identifiers.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/insure.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/refund.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/regenerate_rates.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/shipment/smartrate.json create mode 100644 EasyPost.Tests.Net/cassettes/tracker/all.json create mode 100644 EasyPost.Tests.Net/cassettes/tracker/create.json create mode 100644 EasyPost.Tests.Net/cassettes/tracker/create_list.json create mode 100644 EasyPost.Tests.Net/cassettes/tracker/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/user/retrieve.json create mode 100644 EasyPost.Tests.Net/cassettes/user/retrieve_me.json create mode 100644 EasyPost.Tests.Net/cassettes/user/update.json create mode 100644 EasyPost.Tests.Net/cassettes/user/update_brand.json create mode 100644 EasyPost.Tests.Net/cassettes/webhook/all.json create mode 100644 EasyPost.Tests.Net/cassettes/webhook/create.json create mode 100644 EasyPost.Tests.Net/cassettes/webhook/delete.json create mode 100644 EasyPost.Tests.Net/cassettes/webhook/retrieve.json delete mode 100644 EasyPost.Tests.NetFramework/ApiKeyTest.cs delete mode 100644 EasyPost.Tests.NetFramework/CarrierTypeTest.cs delete mode 100644 EasyPost.Tests.NetFramework/ClientConfigurationTest.cs delete mode 100644 EasyPost.Tests.NetFramework/ClientManagerTest.cs delete mode 100644 EasyPost.Tests.NetFramework/ClientTest.cs create mode 100644 EasyPost.Tests.NetFramework/EasyPostTest.cs create mode 100644 EasyPost.Tests.NetFramework/Fixture.cs create mode 100644 EasyPost.Tests.NetFramework/RefundTest.cs delete mode 100644 EasyPost.Tests.NetFramework/RequestTest.cs delete mode 100644 EasyPost.Tests.NetFramework/ResourceTest.cs delete mode 100644 EasyPost.Tests.NetFramework/SecurityTest.cs create mode 100644 EasyPost.Tests.NetFramework/TestSuite.cs delete mode 100644 EasyPost.Tests.NetFramework/TimeoutTest.cs create mode 100644 Scotch/Cassette.cs create mode 100644 Scotch/HttpInteraction.cs create mode 100644 Scotch/RecordingHandler.cs create mode 100644 Scotch/ReplayingHandler.cs create mode 100644 Scotch/Scotch.cs create mode 100644 Scotch/Scotch.csproj create mode 100644 Scotch/Tools.cs create mode 100644 Scotch/VCRException.cs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a3832db2..cf69cf3ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: NET_Tests: # derived from https://dev.to/felipetofoli/github-actions-for-net-full-framework-build-and-test-299h runs-on: windows-2022 + env: + EASYPOST_TEST_API_KEY: ${{ secrets.EASYPOST_TEST_API_KEY }} + EASYPOST_PROD_API_KEY: ${{ secrets.EASYPOST_PROD_API_KEY }} strategy: matrix: dotnet-version: [ 'NetFramework35', 'NetCore31', 'Net50', 'Net60' ] diff --git a/CHANGELOG.md b/CHANGELOG.md index 332357356..12fa7efc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,8 +4,13 @@ * Rename method from List() to All() to make our library consistent * Remove `Rating` class since it's not being used in anywhere +* Removes `shipment.GetRates()` method since the shipment object already has rates. If you need to get new rates for a shipment, please use the `shipment.RegenerateRates()` method. * Add `RetrieveMe()` convenience function that allow users to retrieve without specifying an ID. * Adds missing `billing_ref` and `dropoff_type` options +* Adds full test suite for .NET/.NET Core (using VCR) and .NET Framework versions +* Fix bug where AddressCollection was storing Batch objects rather than Address objects +* Adds option to pass in a custom `HttpClient` to the Client constructor (.NET/.NET Core only) +* Fix Address creation respecting `verify` and `verify_strict` parameters ## v2.8.1 (2022-02-17) diff --git a/EasyPost.Net/Address.cs b/EasyPost.Net/Address.cs index 765b9c9a8..547ff5e3c 100644 --- a/EasyPost.Net/Address.cs +++ b/EasyPost.Net/Address.cs @@ -138,12 +138,32 @@ public static Address Create(Dictionary parameters = null) verifications = (List)parameters["verifications"]; parameters.Remove("verifications"); } + else if (parameters.ContainsKey("verify")) + { + verifications = new List(); + foreach (bool val in (List)parameters["verify"]) + { + verifications.Add(val.ToString()); + } + + parameters.Remove("verify"); + } if (parameters.ContainsKey("strict_verifications")) { strictVerifications = (List)parameters["strict_verifications"]; parameters.Remove("strict_verifications"); } + else if (parameters.ContainsKey("verify_strict")) + { + strictVerifications = new List(); + foreach (bool val in (List)parameters["verify_strict"]) + { + strictVerifications.Add(val.ToString()); + } + + parameters.Remove("verify_strict"); + } return SendCreate(parameters, verifications, strictVerifications); } diff --git a/EasyPost.Net/AddressCollection.cs b/EasyPost.Net/AddressCollection.cs index 4531d08f0..f5d129021 100644 --- a/EasyPost.Net/AddressCollection.cs +++ b/EasyPost.Net/AddressCollection.cs @@ -6,7 +6,7 @@ namespace EasyPost public class AddressCollection : Resource { [JsonProperty("addresses")] - public List addresses { get; set; } + public List
addresses { get; set; } [JsonProperty("has_more")] public bool has_more { get; set; } } diff --git a/EasyPost.Net/Client.cs b/EasyPost.Net/Client.cs index 333815f19..3fce93770 100644 --- a/EasyPost.Net/Client.cs +++ b/EasyPost.Net/Client.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Net; +using System.Net.Http; using System.Reflection; using EasyPost.Utilities; using RestSharp; @@ -40,31 +41,40 @@ public int RequestTimeoutMilliseconds /// Constructor for the EasyPost client. /// /// EasyPost.ClientConfiguration object instance to use to configure this client. - public Client(ClientConfiguration clientConfiguration) + /// Custom HttpClient to pass into RestSharp if needed. Mostly for debug purposes, not advised for general use. + public Client(ClientConfiguration clientConfiguration, HttpClient? customHttpClient = null) { ServicePointManager.SecurityProtocol |= Security.GetProtocol(); _configuration = clientConfiguration ?? throw new ArgumentNullException(nameof(clientConfiguration)); - Assembly assembly = Assembly.GetExecutingAssembly(); - FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location); - _libraryVersion = info.FileVersion; + try + { + Assembly assembly = typeof(Client).Assembly; + FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location); + _libraryVersion = info.FileVersion; + } + catch (Exception) + { + _libraryVersion = "Unknown"; + } _dotNetVersion = Environment.Version.ToString(); - RestClientOptions clientOptions = new RestClientOptions() + RestClientOptions clientOptions = new RestClientOptions { Timeout = ConnectTimeoutMilliseconds, - BaseUrl = new Uri(clientConfiguration.ApiBase) + BaseUrl = new Uri(clientConfiguration.ApiBase), + UserAgent = UserAgent }; - _restClient = new RestClient(clientOptions); + _restClient = customHttpClient != null ? new RestClient(customHttpClient, clientOptions) : new RestClient(clientOptions); } /// /// Execute a request against the EasyPost API. /// /// EasyPost.Request object instance to execute. - /// RestSharp.RestResponse instance. + /// Whether request was successful. internal bool Execute(Request request) { RestResponse response = _restClient.ExecuteAsync(PrepareRequest(request)).GetAwaiter().GetResult(); @@ -81,7 +91,7 @@ internal bool Execute(Request request) /// An error occurred during the API request. internal T Execute(Request request, string rootElement = null) where T : new() { - RestResponse response = (RestResponse)_restClient.ExecuteAsync(PrepareRequest(request)).GetAwaiter().GetResult(); + RestResponse response = _restClient.ExecuteAsync(PrepareRequest(request)).GetAwaiter().GetResult(); int statusCode = Convert.ToInt32(response.StatusCode); List rootElements = null; @@ -129,7 +139,6 @@ private RestRequest PrepareRequest(Request request) { RestRequest restRequest = (RestRequest)request; restRequest.Timeout = RequestTimeoutMilliseconds; - restRequest.AddHeader("user_agent", UserAgent); restRequest.AddHeader("authorization", "Bearer " + _configuration.ApiKey); restRequest.AddHeader("content_type", "application/json"); diff --git a/EasyPost.Net/Shipment.cs b/EasyPost.Net/Shipment.cs index 6507b54e1..0e70d7c92 100644 --- a/EasyPost.Net/Shipment.cs +++ b/EasyPost.Net/Shipment.cs @@ -152,43 +152,6 @@ public void GenerateLabel(string fileFormat) Merge(request.Execute()); } - /// - /// Populate the rates property for this Shipment. - /// - public void GetRates() - { - if (id == null) - { - Create(); - } - - Request request = new Request("shipments/{id}/rates"); - request.AddUrlSegment("id", id); - - rates = request.Execute().rates; - } - - /// - /// Refresh the rates for this Shipment. - /// - /// Optional dictionary of parameters for the API request. - public void RegenerateRates(Dictionary parameters = null) - { - if (id == null) - { - Create(); - } - - Request request = new Request("shipments/{id}/rerate", Method.Post); - request.AddUrlSegment("id", id); - if (parameters != null) - { - request.AddBody(parameters); - } - - rates = request.Execute().rates; - } - /// /// Get the Smartrates for this shipment. /// @@ -238,7 +201,7 @@ public Rate LowestRate(IEnumerable includeCarriers = null, IEnumerable result = new List(rates); @@ -266,6 +229,27 @@ public Rate LowestRate(IEnumerable includeCarriers = null, IEnumerable double.Parse(rate.rate)).FirstOrDefault(); } + /// + /// Refresh the rates for this Shipment. + /// + /// Optional dictionary of parameters for the API request. + public void RegenerateRates(Dictionary parameters = null) + { + if (id == null) + { + Create(); + } + + Request request = new Request("shipments/{id}/rerate", Method.Post); + request.AddUrlSegment("id", id); + if (parameters != null) + { + request.AddBody(parameters); + } + + rates = request.Execute().rates; + } + /// /// Send a refund request to the carrier the shipment was purchased from. /// diff --git a/EasyPost.Net/Verification.cs b/EasyPost.Net/Verification.cs index 691756c63..95c8646c4 100644 --- a/EasyPost.Net/Verification.cs +++ b/EasyPost.Net/Verification.cs @@ -8,6 +8,7 @@ public class Verification : Resource [JsonProperty("details")] public VerificationDetails details { get; set; } [JsonProperty("errors")] + // TODO: handle refactor of Error public List errors { get; set; } [JsonProperty("success")] public bool success { get; set; } diff --git a/EasyPost.Net/WebhookList.cs b/EasyPost.Net/WebhookList.cs index e01e44915..c1ddad52f 100644 --- a/EasyPost.Net/WebhookList.cs +++ b/EasyPost.Net/WebhookList.cs @@ -3,7 +3,7 @@ namespace EasyPost { - public class WebhookList : Resource + internal class WebhookList : Resource { [JsonProperty("webhooks")] public List webhooks { get; set; } diff --git a/EasyPost.NetFramework/Address.cs b/EasyPost.NetFramework/Address.cs index 54fc5ade9..478e4c02b 100644 --- a/EasyPost.NetFramework/Address.cs +++ b/EasyPost.NetFramework/Address.cs @@ -138,12 +138,32 @@ public static Address Create(Dictionary parameters = null) verifications = (List)parameters["verifications"]; parameters.Remove("verifications"); } + else if (parameters.ContainsKey("verify")) + { + verifications = new List(); + foreach (bool val in (List)parameters["verify"]) + { + verifications.Add(val.ToString()); + } + + parameters.Remove("verify"); + } if (parameters.ContainsKey("strict_verifications")) { strictVerifications = (List)parameters["strict_verifications"]; parameters.Remove("strict_verifications"); } + else if (parameters.ContainsKey("verify_strict")) + { + strictVerifications = new List(); + foreach (bool val in (List)parameters["verify_strict"]) + { + strictVerifications.Add(val.ToString()); + } + + parameters.Remove("verify_strict"); + } return SendCreate(parameters, verifications, strictVerifications); } diff --git a/EasyPost.NetFramework/AddressCollection.cs b/EasyPost.NetFramework/AddressCollection.cs index 4531d08f0..f5d129021 100644 --- a/EasyPost.NetFramework/AddressCollection.cs +++ b/EasyPost.NetFramework/AddressCollection.cs @@ -6,7 +6,7 @@ namespace EasyPost public class AddressCollection : Resource { [JsonProperty("addresses")] - public List addresses { get; set; } + public List
addresses { get; set; } [JsonProperty("has_more")] public bool has_more { get; set; } } diff --git a/EasyPost.NetFramework/CarrierAccount.cs b/EasyPost.NetFramework/CarrierAccount.cs index 388771e38..ba016aedc 100644 --- a/EasyPost.NetFramework/CarrierAccount.cs +++ b/EasyPost.NetFramework/CarrierAccount.cs @@ -29,12 +29,13 @@ public class CarrierAccount : Resource /// /// Remove this CarrierAccount from your account. /// - public void Destroy() + /// Whether the request was successful or not. + public bool Destroy() { Request request = new Request("carrier_accounts/{id}", Method.DELETE); request.AddUrlSegment("id", id); - request.Execute(); + return request.Execute(); } /// diff --git a/EasyPost.NetFramework/Client.cs b/EasyPost.NetFramework/Client.cs index 6d967fb2a..470c46dff 100644 --- a/EasyPost.NetFramework/Client.cs +++ b/EasyPost.NetFramework/Client.cs @@ -34,7 +34,7 @@ public int RequestTimeoutMilliseconds set => _requestTimeoutMilliseconds = value; } - private string UserAgent => $"EasyPost/v2 CSharpClient/{_libraryVersion} .NET/{_dotNetVersion}"; + private string UserAgent => $"EasyPost/v2,CSharpClient/{_libraryVersion},.NET/{_dotNetVersion}"; /// /// Constructor for the EasyPost client. @@ -47,10 +47,18 @@ public Client(ClientConfiguration clientConfiguration) _restClient = new RestClient(clientConfiguration.ApiBase); _restClient.Timeout = ConnectTimeoutMilliseconds; + _restClient.UserAgent = UserAgent; - Assembly assembly = Assembly.GetExecutingAssembly(); - FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location); - _libraryVersion = info.FileVersion; + try + { + Assembly assembly = typeof(Client).Assembly; + FileVersionInfo info = FileVersionInfo.GetVersionInfo(assembly.Location); + _libraryVersion = info.FileVersion; + } + catch (Exception) + { + _libraryVersion = "Unknown"; + } string dotNetVersion = Environment.Version.ToString(); if (dotNetVersion == "4.0.30319.42000") @@ -69,8 +77,12 @@ public Client(ClientConfiguration clientConfiguration) /// Execute a request against the EasyPost API. /// /// EasyPost.Request object instance to execute. - /// RestSharp.IRestResponse instance. - internal IRestResponse Execute(Request request) => _restClient.Execute(PrepareRequest(request)); + /// Whether request was successful. + internal bool Execute(Request request) + { + IRestResponse response = _restClient.Execute(PrepareRequest(request)); + return response.ResponseStatus == ResponseStatus.Completed || response.ResponseStatus == ResponseStatus.None; + } /// /// Execute a request against the EasyPost API. @@ -120,7 +132,6 @@ private RestRequest PrepareRequest(Request request) { RestRequest restRequest = (RestRequest)request; restRequest.Timeout = RequestTimeoutMilliseconds; - restRequest.AddHeader("user_agent", UserAgent); restRequest.AddHeader("authorization", "Bearer " + _configuration.ApiKey); restRequest.AddHeader("content_type", "application/json"); diff --git a/EasyPost.NetFramework/Exception.cs b/EasyPost.NetFramework/Exception.cs index 9ecb64df7..cf91577b4 100644 --- a/EasyPost.NetFramework/Exception.cs +++ b/EasyPost.NetFramework/Exception.cs @@ -20,7 +20,7 @@ public class HttpException : Exception /// Status code. /// Error code. /// Error message. - /// A list of EasyPost.Error instances. + /// An EasyPost.Error instances. public HttpException(int statusCode, string code, string message, List errors) : base(message) { StatusCode = statusCode; diff --git a/EasyPost.NetFramework/Request.cs b/EasyPost.NetFramework/Request.cs index 2d69acd34..de7caebce 100644 --- a/EasyPost.NetFramework/Request.cs +++ b/EasyPost.NetFramework/Request.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Newtonsoft.Json; using RestSharp; +using RestSharp.Extensions; namespace EasyPost { @@ -53,7 +54,15 @@ public void AddQueryString(IDictionary parameters) /// /// Name of segment. /// Value of segment. - public void AddUrlSegment(string name, string value) => restRequest.AddUrlSegment(name, value); + public void AddUrlSegment(string name, string value) + { + if (!value.HasValue()) + { + throw new ArgumentNullException(name); + } + + restRequest.AddUrlSegment(name, value); + } /// /// Execute the request. @@ -69,8 +78,8 @@ public void AddQueryString(IDictionary parameters) /// /// Execute the request. /// - /// An IRestResponse object instance. - public IRestResponse Execute() + /// Whether the request was successful or not. + public bool Execute() { Client client = ClientManager.Build(); return client.Execute(this); diff --git a/EasyPost.NetFramework/Shipment.cs b/EasyPost.NetFramework/Shipment.cs index 8978598a8..5d896b70f 100644 --- a/EasyPost.NetFramework/Shipment.cs +++ b/EasyPost.NetFramework/Shipment.cs @@ -152,43 +152,6 @@ public void GenerateLabel(string fileFormat) Merge(request.Execute()); } - /// - /// Populate the rates property for this Shipment. - /// - public void GetRates() - { - if (id == null) - { - Create(); - } - - Request request = new Request("shipments/{id}/rates"); - request.AddUrlSegment("id", id); - - rates = request.Execute().rates; - } - - /// - /// Refresh the rates for this Shipment. - /// - /// Optional dictionary of parameters for the API request. - public void RegenerateRates(Dictionary parameters = null) - { - if (id == null) - { - Create(); - } - - Request request = new Request("shipments/{id}/rerate", Method.POST); - request.AddUrlSegment("id", id); - if (parameters != null) - { - request.AddBody(parameters); - } - - rates = request.Execute().rates; - } - /// /// Get the Smartrates for this shipment. /// @@ -238,7 +201,7 @@ public Rate LowestRate(IEnumerable includeCarriers = null, IEnumerable result = new List(rates); @@ -266,6 +229,27 @@ public Rate LowestRate(IEnumerable includeCarriers = null, IEnumerable double.Parse(rate.rate)).FirstOrDefault(); } + /// + /// Refresh the rates for this Shipment. + /// + /// Optional dictionary of parameters for the API request. + public void RegenerateRates(Dictionary parameters = null) + { + if (id == null) + { + Create(); + } + + Request request = new Request("shipments/{id}/rerate", Method.POST); + request.AddUrlSegment("id", id); + if (parameters != null) + { + request.AddBody(parameters); + } + + rates = request.Execute().rates; + } + /// /// Send a refund request to the carrier the shipment was purchased from. /// diff --git a/EasyPost.NetFramework/User.cs b/EasyPost.NetFramework/User.cs index bb044b4da..342a31df0 100644 --- a/EasyPost.NetFramework/User.cs +++ b/EasyPost.NetFramework/User.cs @@ -43,11 +43,12 @@ public class User : Resource /// /// Delete the user. /// - public void Destroy() + /// Whether the request was successful or not. + public bool Destroy() { Request request = new Request("users/{id}", Method.DELETE); request.AddUrlSegment("id", id); - request.Execute(); + return request.Execute(); } /// diff --git a/EasyPost.NetFramework/Webhook.cs b/EasyPost.NetFramework/Webhook.cs index a5f97fec8..daac4c032 100644 --- a/EasyPost.NetFramework/Webhook.cs +++ b/EasyPost.NetFramework/Webhook.cs @@ -19,11 +19,12 @@ public class Webhook : Resource /// /// Delete this webhook. /// - public void Destroy() + /// Whether the request was successful or not. + public bool Destroy() { Request request = new Request("webhooks/{id}", Method.DELETE); request.AddUrlSegment("id", id); - request.Execute(); + return request.Execute(); } /// diff --git a/EasyPost.NetFramework/WebhookList.cs b/EasyPost.NetFramework/WebhookList.cs index e01e44915..c1ddad52f 100644 --- a/EasyPost.NetFramework/WebhookList.cs +++ b/EasyPost.NetFramework/WebhookList.cs @@ -3,7 +3,7 @@ namespace EasyPost { - public class WebhookList : Resource + internal class WebhookList : Resource { [JsonProperty("webhooks")] public List webhooks { get; set; } diff --git a/EasyPost.NetFramework/packages.config b/EasyPost.NetFramework/packages.config index aaca90ea4..197555751 100644 --- a/EasyPost.NetFramework/packages.config +++ b/EasyPost.NetFramework/packages.config @@ -1,4 +1,5 @@  + diff --git a/EasyPost.Tests.Net/AddressTest.cs b/EasyPost.Tests.Net/AddressTest.cs index 32a0f7230..a88ce37fe 100644 --- a/EasyPost.Tests.Net/AddressTest.cs +++ b/EasyPost.Tests.Net/AddressTest.cs @@ -6,370 +6,127 @@ namespace EasyPost.Tests.Net [TestClass] public class AddressTest { - private Address _address; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - _address = new Address - { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; + VCR.SetUp(VCRApiKey.Test, "address", true); } - [TestMethod] - public void TestCreateAndRetrieve() + private static Address CreateBasicAddress() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Address address = Address.Create(parameters); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "Simpler Postage Inc"); - Assert.IsNull(address.name); - - Address retrieved = Address.Retrieve(address.id); - Assert.AreEqual(address.id, retrieved.id); + return Address.Create(Fixture.BasicAddress); } [TestMethod] - public void TestCreateAndVerify() + public void TestCreate() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Address address = Address.CreateAndVerify(parameters); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.IsNull(address.name); - Assert.AreEqual(address.verifications.delivery.success, true); - } + VCR.Replay("create"); - [TestMethod] - public void TestCreateInstance() - { - _address.Create(); - Assert.IsNotNull(_address.id); + Address address = CreateBasicAddress(); + + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 Townsend St", address.street1); } [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestCreateWithStrictVerifications() + public void TestCreateVerifyStrict() { - Dictionary parameters = new Dictionary + VCR.Replay("createVerifyStrict"); + + Dictionary addressData = Fixture.BasicAddress; + addressData.Add("verify_strict", new List { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "123 Fake Street" - }, - { - "zip", "94107" - }, - { - "strict_verifications", new List - { - "delivery", - "zip4" - } - } - }; + true + }); - Address address = Address.Create(parameters); + Address address = Address.Create(addressData); + + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } + [TestMethod] - public void TestCreateWithVerifications() + public void TestRetrieve() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "verifications", new List - { - "delivery", - "zip4" - } - } - }; + VCR.Replay("retrieve"); - Address address = Address.Create(parameters); - Assert.IsNotNull(address.verifications.delivery); - Assert.IsNotNull(address.verifications.zip4); - parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "123 Fake Street" - }, - { - "zip", "94107" - }, - { - "verifications", new List - { - "delivery", - "zip4" - } - } - }; + Address address = Address.Create(Fixture.BasicAddress); - address = Address.Create(parameters); - Assert.AreEqual(address.verifications.delivery.success, false); - } + Address retrievedAddress = Address.Retrieve(address.id); - [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestInstanceCreateWithStrictVerifications() - { - _address = new Address - { - company = "Simpler Postage Inc" - }; - _address.Create(strictVerifications: new List - { - "delivery", - "zip4" - }); + Assert.IsInstanceOfType(retrievedAddress, typeof(Address)); + Assert.AreEqual(address.id, retrievedAddress.id); } [TestMethod] - public void TestInstanceCreateWithVerificationParams() + public void TestAll() { - _address.Create(new List - { - "delivery", - "zip4" - }); - Assert.IsNotNull(_address.verifications.delivery); - Assert.IsNotNull(_address.verifications.zip4); - } + VCR.Replay("all"); - [TestMethod] - public void TestInstanceCreateWithVerifications() - { - Address address = new Address + AddressCollection addressCollection = Address.All(new Dictionary { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107", - verify = new List { - "delivery", - "zip4" + "page_size", Fixture.PageSize } - }; + }); - address.Create(); - Assert.IsNotNull(address.verifications.delivery); - Assert.IsNotNull(address.verifications.zip4); - } + List
addresses = addressCollection.addresses; - [TestMethod] - public void TestRetrieveAll() - { - AddressCollection addressCollection = Address.All(); - Assert.IsNotNull(addressCollection); - foreach (Batch address in addressCollection.addresses) + Assert.IsTrue(addresses.Count <= Fixture.PageSize); + Assert.IsNotNull(addressCollection.has_more); + foreach (var item in addresses) { - Assert.IsNotNull(address.id); - Assert.AreEqual(address.id.Substring(0, 4), "adr_"); + Assert.IsInstanceOfType(item, typeof(Address)); } } [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestRetrieveInvalidId() => Address.Retrieve("not-an-id"); - - [TestMethod] - public void TestVerificationFailure() + public void TestCreateVerify() { - Address address = new Address - { - company = "Simpler Postage Inc", - street1 = "1645456 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; + VCR.Replay("create_verify"); - address.Create(); + Address address = Address.Create(Fixture.IncorrectAddressToVerify); - try - { - address.Verify(); - } - catch (HttpException e) - { - Assert.AreEqual("ADDRESS.VERIFY.FAILURE", e.Code); - Assert.AreEqual("Unable to verify address.", e.Message); - Assert.AreEqual("E.ADDRESS.NOT_FOUND", e.Errors[0].code); - Assert.AreEqual("address", e.Errors[0].field); - Assert.AreEqual("Address not found", e.Errors[0].message); - } + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("417 MONTGOMERY ST STE 500", address.street1); } [TestMethod] - public void TestVerify() + public void TestCreateAndVerify() { - Dictionary parameters = new Dictionary + VCR.Replay("create_and_verify"); + + Dictionary addressData = Fixture.BasicAddress; + addressData.Add("verify_strict", new List { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "residential", true - } - }; - Address address = Address.Create(parameters); - address.Verify(); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.IsNull(address.name); - Assert.IsNotNull(address.residential); - Assert.IsFalse(address.residential); - } + true + }); - [TestMethod] - public void TestVerifyBeforeCreate() - { - _address.Verify(); - Assert.IsNotNull(_address.id); + Address address = Address.CreateAndVerify(addressData); + + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } [TestMethod] - public void TestVerifyCarrier() + public void TestVerify() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "residential", true - } - }; - Address address = Address.Create(parameters); - address.Verify("usps"); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.AreEqual(address.street1, "164 TOWNSEND ST UNIT 1"); - Assert.IsNull(address.name); + VCR.Replay("verify"); + + + Address address = CreateBasicAddress(); + + address.Verify(); + + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } } } diff --git a/EasyPost.Tests.Net/ApiKeyTest.cs b/EasyPost.Tests.Net/ApiKeyTest.cs deleted file mode 100644 index 44ff20cc1..000000000 --- a/EasyPost.Tests.Net/ApiKeyTest.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ApiKeyTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestAll() - { - List keys = ApiKey.All(); - Assert.AreEqual(keys.Count, 2); - } - } -} diff --git a/EasyPost.Tests.Net/BatchTest.cs b/EasyPost.Tests.Net/BatchTest.cs index f0934b701..21e39c999 100644 --- a/EasyPost.Tests.Net/BatchTest.cs +++ b/EasyPost.Tests.Net/BatchTest.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; -using System.Linq; - +using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,225 +7,167 @@ namespace EasyPost.Tests.Net [TestClass] public class BatchTest { - private Dictionary batchShipmentParameters; - private Dictionary fromAddress; - private Dictionary shipmentParameters; - private Dictionary toAddress; + [TestInitialize] + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "batch", true); + } - public Batch CreateBatch() + private static Batch CreateBasicBatch() { - Dictionary parameters = new Dictionary + return Batch.Create(new Dictionary { - { - "reference", "EasyPostCSharpTest" - }, { "shipments", new List> { - batchShipmentParameters + Fixture.BasicShipment } } - }; - - return Batch.Create(parameters); + }); } - [TestInitialize] - public void Initialize() + private static Batch CreateOneCallBuyBatch() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - toAddress = new Dictionary + return Batch.Create(new Dictionary { { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - shipmentParameters = new Dictionary - { - { - "parcel", new Dictionary + "shipments", new List> { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } + Fixture.OneCallBuyShipment } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress } - }; - batchShipmentParameters = new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "carrier", "USPS" - }, - { - "service", "Priority" - } - }; + }); } [TestMethod] - public void TestAddRemoveShipments() + public void TestCreate() { - Batch batch = Batch.Create(); - Shipment shipment = Shipment.Create(shipmentParameters); - Shipment otherShipment = Shipment.Create(shipmentParameters); + VCR.Replay("create"); - while (batch.state != "created") - { - batch = Batch.Retrieve(batch.id); - } + Batch batch = CreateBasicBatch(); - batch.AddShipments(new List + Assert.IsInstanceOfType(batch, typeof(Batch)); + Assert.IsTrue(batch.id.StartsWith("batch_")); + Assert.IsNotNull(batch.shipments); + } + + [TestMethod] + public void TestRetrieve() + { + VCR.Replay("retrieve"); + + + Batch batch = CreateBasicBatch(); + + Batch retrievedBatch = Batch.Retrieve(batch.id); + + Assert.IsInstanceOfType(retrievedBatch, typeof(Batch)); + Assert.AreEqual(batch.id, retrievedBatch.id); + } + + [TestMethod] + public void TestAll() + { + VCR.Replay("all"); + + BatchCollection batchCollection = Batch.All(new Dictionary { - shipment, - otherShipment + { + "page_size", Fixture.PageSize + } }); - while (batch.shipments == null) + List batches = batchCollection.batches; + + Assert.IsTrue(batches.Count <= Fixture.PageSize); + Assert.IsNotNull(batchCollection.has_more); + foreach (var item in batches) { - batch = Batch.Retrieve(batch.id); + Assert.IsInstanceOfType(item, typeof(Batch)); } + } - List shipmentIds = batch.shipments.Select(ship => ship.id).ToList(); - Assert.AreEqual(batch.num_shipments, 2); - CollectionAssert.Contains(shipmentIds, shipment.id); - CollectionAssert.Contains(shipmentIds, otherShipment.id); - - batch.RemoveShipments(new List - { - shipment, - otherShipment - }); - Assert.AreEqual(batch.num_shipments, 0); + // TODO: C# doesn't have a CreateAndBuy method for Batch + [Ignore] + [TestMethod] + public void TestCreateAndBuy() + { + VCR.Replay("create_and_buy"); } [TestMethod] - public void TestCreateThenBuyThenGenerateLabelAndScanForm() + public void TestBuy() { - Batch batch = CreateBatch(); + VCR.Replay("buy"); - Assert.IsNotNull(batch.id); - Assert.AreEqual(batch.reference, "EasyPostCSharpTest"); - Assert.AreEqual(batch.state, "creating"); + var data = Fixture.OneCallBuyShipment; - while (batch.state == "creating") - { - batch = Batch.Retrieve(batch.id); - } + Batch batch = CreateOneCallBuyBatch(); batch.Buy(); - while (batch.state == "created") - { - batch = Batch.Retrieve(batch.id); - } + Assert.IsInstanceOfType(batch, typeof(Batch)); + Assert.AreEqual(1, batch.num_shipments); + } - Assert.AreEqual(batch.state, "purchased"); + [TestMethod] + public void TestCreateScanForm() + { + VCR.Replay("create_scan_form"); - batch.GenerateLabel("pdf"); - Assert.AreEqual(batch.state, "label_generating"); + + Batch batch = CreateOneCallBuyBatch(); + batch.Buy(); + + // Uncomment the following line if you need to re-record the cassette + // Thread.Sleep(2000); // Wait enough time for the batch to process buying the shipment batch.GenerateScanForm(); + + // We can't assert anything meaningful here because the scanform gets queued for generation and may not be immediately available + Assert.IsInstanceOfType(batch, typeof(Batch)); } [TestMethod] - public void TestRetrieve() + public void TestAddRemoveShipment() { + VCR.Replay("add_remove_shipment"); + + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + Batch batch = Batch.Create(); - Batch retrieved = Batch.Retrieve(batch.id); - Assert.AreEqual(batch.id, retrieved.id); + + batch.AddShipments(new List + { + shipment + }); + + Assert.AreEqual(1, batch.num_shipments); + + batch.RemoveShipments(new List + { + shipment + }); + + Assert.AreEqual(0, batch.num_shipments); } [TestMethod] - public void TestRetrieveAll() + public void TestLabel() { - BatchCollection batchCollection = Batch.All(); - Assert.IsNotNull(batchCollection); - foreach (Batch batch in batchCollection.batches) - { - Assert.IsNotNull(batch.id); - Assert.AreEqual(batch.id.Substring(0, 6), "batch_"); - } + VCR.Replay("label"); + + + Batch batch = CreateOneCallBuyBatch(); + batch.Buy(); + + // Uncomment the following line if you need to re-record the cassette + // Thread.Sleep(2000); // Wait enough time for the batch to process buying the shipment + + batch.GenerateLabel("ZPL"); + + // We can't assert anything meaningful here because the label gets queued for generation and may not be immediately available + Assert.IsInstanceOfType(batch, typeof(Batch)); } } } diff --git a/EasyPost.Tests.Net/CarrierAccountTest.cs b/EasyPost.Tests.Net/CarrierAccountTest.cs index ebf2ad1cc..849b60157 100644 --- a/EasyPost.Tests.Net/CarrierAccountTest.cs +++ b/EasyPost.Tests.Net/CarrierAccountTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,56 +7,101 @@ namespace EasyPost.Tests.Net public class CarrierAccountTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Production, "carrier_account", true); + } + + private static CarrierAccount CreateBasicCarrierAccount() + { + return CarrierAccount.Create(Fixture.BasicCarrierAccount); + } + + [TestMethod] + public void TestCreate() + { + VCR.Replay("create"); + + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + Assert.IsInstanceOfType(carrierAccount, typeof(CarrierAccount)); + Assert.IsTrue(carrierAccount.id.StartsWith("ca_")); + } - [Ignore] [TestMethod] - public void TestCRUD() + public void TestRetrieve() + { + VCR.Replay("retrieve"); + + + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + CarrierAccount retrievedCarrierAccount = CarrierAccount.Retrieve(carrierAccount.id); + + Assert.IsInstanceOfType(retrievedCarrierAccount, typeof(CarrierAccount)); + Assert.AreEqual(carrierAccount.id, retrievedCarrierAccount.id); + } + + [TestMethod] + public void TestAll() { - CarrierAccount account = CarrierAccount.Create(new Dictionary + VCR.Replay("all"); + + List carrierAccounts = CarrierAccount.All(); + + foreach (var item in carrierAccounts) { - { - "type", "DhlExpressAccount" - }, - { - "description", "description" - } - }); + Assert.IsInstanceOfType(item, typeof(CarrierAccount)); + } + } + + [TestMethod] + public void TestUpdate() + { + VCR.Replay("update"); + - Assert.IsNotNull(account.id); - Assert.AreEqual(account.type, "DhlExpressAccount"); + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); - account.Update(new Dictionary + string testDescription = "my custom description"; + + Dictionary carrierAccountData = new Dictionary { { - "reference", "new-reference" + "description", testDescription } - }); - Assert.AreEqual("new-reference", account.reference); + }; + carrierAccount.Update(carrierAccountData); - account.Destroy(); - try - { - CarrierAccount.Retrieve(account.id); - Assert.Fail(); - } - catch (HttpException) - { - } + Assert.IsInstanceOfType(carrierAccount, typeof(CarrierAccount)); + Assert.IsTrue(carrierAccount.id.StartsWith("ca_")); + Assert.AreEqual(testDescription, carrierAccount.description); } [TestMethod] - public void TestAll() + public void TestDelete() { - List accounts = CarrierAccount.All(); - Assert.AreEqual(accounts[0].id, "ca_7642d249fdcf47bcb5da9ea34c96dfcf"); + VCR.Replay("delete"); + + + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + bool success = carrierAccount.Destroy(); + + Assert.IsTrue(success); } [TestMethod] - public void TestRetrieve() + public void TestTypes() { - CarrierAccount account = CarrierAccount.Retrieve("ca_7642d249fdcf47bcb5da9ea34c96dfcf"); - Assert.AreEqual("ca_7642d249fdcf47bcb5da9ea34c96dfcf", account.id); + VCR.Replay("types"); + + List types = CarrierType.All(); + + foreach (var item in types) + { + Assert.IsInstanceOfType(item, typeof(CarrierType)); + } } } } diff --git a/EasyPost.Tests.Net/CarrierTypeTest.cs b/EasyPost.Tests.Net/CarrierTypeTest.cs deleted file mode 100644 index bd9541897..000000000 --- a/EasyPost.Tests.Net/CarrierTypeTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class CarrierTypeTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestAll() - { - List types = CarrierType.All(); - Assert.AreNotEqual(0, types.Count); - } - } -} diff --git a/EasyPost.Tests.Net/ClientConfigurationTest.cs b/EasyPost.Tests.Net/ClientConfigurationTest.cs deleted file mode 100644 index 7d1ef143b..000000000 --- a/EasyPost.Tests.Net/ClientConfigurationTest.cs +++ /dev/null @@ -1,27 +0,0 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ClientConfigurationTest - { - [TestMethod] - public void TestApiKeyConstructor() - { - ClientConfiguration config = new ClientConfiguration("someApiKey"); - - Assert.AreEqual("someApiKey", config.ApiKey); - Assert.AreEqual("https://api.easypost.com/v2", config.ApiBase); - } - - [TestMethod] - public void TestApiKeyPlusBaseUrlConstructor() - { - ClientConfiguration config = new ClientConfiguration("someApiKey", "http://foobar.com"); - - Assert.AreEqual("someApiKey", config.ApiKey); - Assert.AreEqual("http://foobar.com", config.ApiBase); - } - } -} diff --git a/EasyPost.Tests.Net/ClientManagerTest.cs b/EasyPost.Tests.Net/ClientManagerTest.cs deleted file mode 100644 index 475257ae5..000000000 --- a/EasyPost.Tests.Net/ClientManagerTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// using Microsoft.VisualStudio.TestTools.UnitTesting; - -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class ClientManagerTest { -// [TestMethod] -// [ExpectedException(typeof(ClientNotConfigured))] -// public void TestNotConfigured() { -// ClientManager.Unconfigure(); -// ClientManager.Build(); -// } - -// [TestMethod] -// public void TestApiKey() { -// ClientManager.SetCurrent("apiKey"); -// Client client = ClientManager.Build(); -// Assert.AreEqual("apiKey", client.configuration.ApiKey); -// } - -// [TestMethod] -// public void TestApiKeyForUniqueObjects() { -// ClientManager.SetCurrent("apiKey"); -// Client client1 = ClientManager.Build(); -// Client client2 = ClientManager.Build(); - -// Assert.AreNotSame(client1, client2); -// } - -// [TestMethod] -// public void TestFactoryDelegate() { -// ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); -// Client client = ClientManager.Build(); -// Assert.AreEqual("apiKey", client.configuration.ApiKey); -// } - -// [TestMethod] -// public void TestFactoryDelegateForUniqueObjects() { -// ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); -// Client client1 = ClientManager.Build(); -// Client client2 = ClientManager.Build(); - -// Assert.AreNotSame(client1, client2); -// } -// } -// } - - diff --git a/EasyPost.Tests.Net/ClientTest.cs b/EasyPost.Tests.Net/ClientTest.cs deleted file mode 100644 index e3725686c..000000000 --- a/EasyPost.Tests.Net/ClientTest.cs +++ /dev/null @@ -1,64 +0,0 @@ -//using System; -//using System.Linq; -//using System.Collections.Generic; -//using Microsoft.VisualStudio.TestTools.UnitTesting; - -//public class JsonTest { -// public string key { get; set; } -//} - -//namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class ClientTest { - -// [TestMethod] -// public void TestApiKey() { -// ClientManager.SetCurrent("apiKey"); -// Assert.AreEqual("apiKey", ClientManager.Build().configuration.ApiKey); -// } - -// [TestMethod] -// public void TestApiBase() { -// Client client = new Client(new ClientConfiguration("apiKey", "https://foobar.com")); -// Assert.AreEqual(new System.Uri("https://foobar.com"), client.client.BaseUrl); -// } - -// [TestMethod] -// public void TestRestClient() { -// Client client = new Client(new ClientConfiguration("apiKey")); -// Assert.AreEqual(client.client.BaseUrl, "https://api.easypost.com/"); -// } - -// [TestMethod] -// public void TestRestClientWithOptions() { -// Client client = new Client(new ClientConfiguration("someapikey", "http://apiBase.com")); -// Assert.AreEqual(new Uri("http://apiBase.com"), client.client.BaseUrl); -// } - -// [TestMethod] -// public void TestPrepareRequest() { -// const string apiKey = "apiKey"; - -// ClientManager.SetCurrent(apiKey); -// Request request = new Request("resource"); - -// List parameters = ClientManager.Build().PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); -// CollectionAssert.Contains(parameters, "user_agent=EasyPost/v2 CSharp/" + ClientManager.Build().version); -// CollectionAssert.Contains(parameters, "authorization=Bearer " + apiKey); -// CollectionAssert.Contains(parameters, "content_type=application/json"); -// } - -// [TestMethod] -// public void TestPrepareRequestWithOptions() { -// Client client = new Client(new ClientConfiguration("someapikey", "http://foobar.com")); -// Request request = new Request("resource"); - -// List parameters = client.PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); -// CollectionAssert.Contains(parameters, "user_agent=EasyPost/v2 CSharp/" + client.version); -// CollectionAssert.Contains(parameters, "authorization=Bearer someapikey"); -// CollectionAssert.Contains(parameters, "content_type=application/json"); -// } -// } -//} - - diff --git a/EasyPost.Tests.Net/CustomsInfoTest.cs b/EasyPost.Tests.Net/CustomsInfoTest.cs index 983a9687b..d8220dafd 100644 --- a/EasyPost.Tests.Net/CustomsInfoTest.cs +++ b/EasyPost.Tests.Net/CustomsInfoTest.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net { @@ -8,77 +6,40 @@ namespace EasyPost.Tests.Net public class CustomsInfoTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "customs_info", true); + } + + private static CustomsInfo CreateBasicCustomsInfo() + { + return CustomsInfo.Create(Fixture.BasicCustomsInfo); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreate() { - Dictionary item = new Dictionary - { - { - "description", "TShirt" - }, - { - "quantity", 1 - }, - { - "weight", 8 - }, - { - "origin_country", "US" - } - }; + VCR.Replay("create"); - CustomsInfo info = CustomsInfo.Create(new Dictionary - { - { - "customs_certify", true - }, - { - "eel_pfc", "NOEEI 30.37(a)" - }, - { - "customs_items", new List> - { - item - } - } - }); + CustomsInfo customsInfo = CreateBasicCustomsInfo(); - CustomsInfo retrieved = CustomsInfo.Retrieve(info.id); - Assert.AreEqual(info.id, retrieved.id); - Assert.IsNotNull(retrieved.customs_items); + Assert.IsInstanceOfType(customsInfo, typeof(CustomsInfo)); + Assert.IsTrue(customsInfo.id.StartsWith("cstinfo_")); + Assert.AreEqual("NOEEI 30.37(a)", customsInfo.eel_pfc); } [TestMethod] - public void TestCreateWithIResource() + public void TestRetrieve() { - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = CustomsInfo.Create( - new Dictionary - { - { - "customs_certify", true - }, - { - "eel_pfc", "NOEEI 30.37(a)" - }, - { - "customs_items", new List - { - item - } - } - } - ); + VCR.Replay("retrieve"); + + + CustomsInfo customsInfo = CreateBasicCustomsInfo(); + + CustomsInfo retrievedCustomsInfo = CustomsInfo.Retrieve(customsInfo.id); - Assert.IsNotNull(info.id); - Assert.AreEqual(info.customs_items.Count, 1); - Assert.AreEqual(info.customs_items[0].description, item.description); + Assert.IsInstanceOfType(retrievedCustomsInfo, typeof(CustomsInfo)); + Assert.AreEqual(customsInfo.id, retrievedCustomsInfo.id); } } } diff --git a/EasyPost.Tests.Net/CustomsItemTest.cs b/EasyPost.Tests.Net/CustomsItemTest.cs index 9297dc1cc..afa818b36 100644 --- a/EasyPost.Tests.Net/CustomsItemTest.cs +++ b/EasyPost.Tests.Net/CustomsItemTest.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net { @@ -8,33 +6,40 @@ namespace EasyPost.Tests.Net public class CustomsItemTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "customs_item", true); + } + + private static CustomsItem CreateBasicCustomsItem() + { + return CustomsItem.Create(Fixture.BasicCustomsItem); + } + + [TestMethod] + public void TestCreate() + { + VCR.Replay("create"); + + CustomsItem customsItem = CreateBasicCustomsItem(); + + Assert.IsInstanceOfType(customsItem, typeof(CustomsItem)); + Assert.IsTrue(customsItem.id.StartsWith("cstitem_")); + Assert.AreEqual(23.0, customsItem.value); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestRetrieve() { - CustomsItem item = CustomsItem.Create(new Dictionary - { - { - "description", "TShirt" - }, - { - "quantity", 1 - }, - { - "weight", 8 - }, - { - "value", 10.0 - }, - { - "currency", "USD" - } - }); - CustomsItem retrieved = CustomsItem.Retrieve(item.id); - Assert.AreEqual(item.id, retrieved.id); - Assert.AreEqual(retrieved.value, 10.0); - Assert.AreEqual(retrieved.currency, "USD"); + VCR.Replay("retrieve"); + + + CustomsItem customsItem = CreateBasicCustomsItem(); + + CustomsItem retrievedCustomsItem = CustomsItem.Retrieve(customsItem.id); + + Assert.IsInstanceOfType(retrievedCustomsItem, typeof(CustomsItem)); + Assert.AreEqual(customsItem.id, retrievedCustomsItem.id); } } } diff --git a/EasyPost.Tests.Net/EasyPost.Tests.Net.csproj b/EasyPost.Tests.Net/EasyPost.Tests.Net.csproj index f817e0c9f..bd328a708 100644 --- a/EasyPost.Tests.Net/EasyPost.Tests.Net.csproj +++ b/EasyPost.Tests.Net/EasyPost.Tests.Net.csproj @@ -1,15 +1,15 @@ + + netcoreapp3.1;net5.0;net6.0 - - netcoreapp3.1;net5.0;net6.0 - false + false - Release;Debug + Release;Debug - AnyCPU + AnyCPU - EasyPost.Tests.Net - + EasyPost.Tests.Net + @@ -22,6 +22,7 @@ + @@ -30,4 +31,8 @@ + + + + diff --git a/EasyPost.Tests.Net/EasyPostTest.cs b/EasyPost.Tests.Net/EasyPostTest.cs new file mode 100644 index 000000000..c1c60a3f3 --- /dev/null +++ b/EasyPost.Tests.Net/EasyPostTest.cs @@ -0,0 +1,65 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace EasyPost.Tests.Net +{ + [TestClass] + public class EasyPostTest + { + private const string FakeApikey = "fake_api_key"; + private const string FakeApiUrl = "https://fake.api.com"; + private const string HttpBinUrl = "https://httpbin.org/get"; + + private static ClientConfiguration GetBasicClientConfiguration() + { + return new ClientConfiguration(FakeApikey); + } + + [TestMethod] + public void TestApiKeyConstructor() + { + ClientConfiguration config = GetBasicClientConfiguration(); + + Assert.AreEqual(FakeApikey, config.ApiKey); + Assert.AreEqual("https://api.easypost.com/v2", config.ApiBase); + } + + [TestMethod] + public void TestApiKeyPlusBaseUrlConstructor() + { + ClientConfiguration config = new ClientConfiguration(FakeApikey, FakeApiUrl); + + Assert.AreEqual(FakeApikey, config.ApiKey); + Assert.AreEqual(FakeApiUrl, config.ApiBase); + } + + [TestMethod] + public void TestTimeout() + { + Client client = new Client(GetBasicClientConfiguration()); + client.ConnectTimeoutMilliseconds = 5000; + client.RequestTimeoutMilliseconds = 5000; + + Assert.AreEqual(5000, client.ConnectTimeoutMilliseconds); + Assert.AreEqual(5000, client.RequestTimeoutMilliseconds); + } + + [TestMethod] + public void TestClientManagerGetCurrent() + { + ClientManager.SetCurrent(delegate { return new Client(new ClientConfiguration(FakeApikey, HttpBinUrl)); }); + + // Client should now be configured to hit httpbin.org instead of EasyPost's API + + Request request = new Request(""); + dynamic response = request.Execute(); + Assert.AreEqual(HttpBinUrl, response.url.ToString()); + } + + [TestMethod] + public void TestNotConfigured() + { + ClientManager.Unconfigure(); + Assert.ThrowsException(() => new Request("resource").Execute()); + } + } +} diff --git a/EasyPost.Tests.Net/ErrorTest.cs b/EasyPost.Tests.Net/ErrorTest.cs index de14905e3..339adf29b 100644 --- a/EasyPost.Tests.Net/ErrorTest.cs +++ b/EasyPost.Tests.Net/ErrorTest.cs @@ -1,5 +1,4 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net { @@ -11,20 +10,25 @@ public class ErrorTest [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - _error = - "{\"code\":\"E.ADDRESS.NOT_FOUND\",\"field\":\"address\",\"suggestion\":\"foobar\",\"message\":\"Address not found\"}"; + VCR.SetUp(VCRApiKey.Test, "error", true); } [TestMethod] - public void TestErrorLoad() + public void TestError() { - Error e = Error.Load(_error); - Assert.AreEqual("E.ADDRESS.NOT_FOUND", e.code); - Assert.AreEqual("Address not found", e.message); - Assert.AreEqual("address", e.field); - Assert.AreEqual("foobar", e.suggestion); + VCR.Replay("error"); + + try + { + var _ = Shipment.Create(); + } + catch (HttpException error) + { + Assert.AreEqual(422, error.StatusCode); + Assert.AreEqual("SHIPMENT.INVALID_PARAMS", error.Code); + Assert.AreEqual("Unable to create shipment, one or more parameters were invalid.", error.Message); + Assert.IsTrue(error.Errors.Count == 2); + } } } } diff --git a/EasyPost.Tests.Net/EventTest.cs b/EasyPost.Tests.Net/EventTest.cs index 1c67e8d42..eedcd6a22 100644 --- a/EasyPost.Tests.Net/EventTest.cs +++ b/EasyPost.Tests.Net/EventTest.cs @@ -1,4 +1,5 @@ - +using System; +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -7,29 +8,65 @@ namespace EasyPost.Tests.Net public class EventTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "event", true); + } + + private static EventCollection GetBasicEventCollection() + { + return Event.All(new Dictionary + { + { + "page_size", Fixture.PageSize + } + }); + } [TestMethod] - public void TestLoad() => Assert.AreEqual(Resource.Load("{'id': 'barfoo'}").id, "barfoo"); + public void TestAll() + { + VCR.Replay("all"); + + EventCollection eventCollection = GetBasicEventCollection(); + + List events = eventCollection.events; + + Assert.IsTrue(events.Count <= Fixture.PageSize); + Assert.IsNotNull(eventCollection.has_more); + foreach (var item in events) + { + Assert.IsInstanceOfType(item, typeof(Event)); + } + } [TestMethod] - [ExpectedException(typeof(HttpException))] public void TestRetrieve() { - // Events are archived after some time. Lets at least make sure we get a 404. - Event e = Event.Retrieve("evt_d0000c1a9c6c4614949af6931ea9fac8"); + VCR.Replay("retrieve"); + + + EventCollection eventCollection = GetBasicEventCollection(); + Event _event = eventCollection.events[0]; + + Event retrievedEvent = Event.Retrieve(_event.id); + + Assert.IsInstanceOfType(retrievedEvent, typeof(Event)); + Assert.AreEqual(_event.id, retrievedEvent.id); } [TestMethod] - public void TestRetrieveAll() + public void TestRetrieveBadInput() { - EventCollection eventCollection = Event.All(); - Assert.IsNotNull(eventCollection); - foreach (Event tEvent in eventCollection.events) - { - Assert.IsNotNull(tEvent.id); - Assert.AreEqual(tEvent.id.Substring(0, 4), "evt_"); - } + VCR.Replay("retrieve_bad_input"); + + Assert.ThrowsException(() => Event.Retrieve("bad input")); + } + + [TestMethod] + public void TestRetrieveNoInput() + { + Assert.ThrowsException(() => Event.Retrieve("")); } } } diff --git a/EasyPost.Tests.Net/Fixture.cs b/EasyPost.Tests.Net/Fixture.cs new file mode 100644 index 000000000..d7f8824c5 --- /dev/null +++ b/EasyPost.Tests.Net/Fixture.cs @@ -0,0 +1,555 @@ +using System; +using System.Collections.Generic; +using EasyPost.Utilities; + +namespace EasyPost.Tests.Net +{ + public static class Fixture + { + // We keep the page_size of retrieving `all` records small so cassettes stay small + public const int PageSize = 5; + + // This is the carrier account ID for the default USPS account that comes by default. All tests should use this carrier account + public const string UspsCarrierAccountId = "ca_7642d249fdcf47bcb5da9ea34c96dfcf"; + + public const string ChildUserId = "user_608a91d0487e419bb465e5acbc999056"; + + public const string Usps = "USPS"; + + public const string UspsService = "First"; + + public const string NextDayService = "NextDay"; + + // If ever these need to change due to re-recording cassettes, simply increment this date by 1 + public const string ReportStartDate = "2022-02-01"; + + // If ever these need to change due to re-recording cassettes, simply increment this date by 1 + public const string ReportEndDate = "2022-02-03"; + + public static string RandomUrl => $"https://{Guid.NewGuid().ToString().Substring(0, 8)}.com"; + + public static Dictionary BasicAddress + { + get + { + return new Dictionary + { + { + "name", "Jack Sparrow" + }, + { + "company", "EasyPost" + }, + { + "street1", "388 Townsend St" + }, + { + "street2", "Apt 20" + }, + { + "city", "San Francisco" + }, + { + "state", "CA" + }, + { + "zip", "94107" + }, + { + "country", "US" + }, + { + "phone", "5555555555" + }, + }; + } + } + + public static Dictionary IncorrectAddressToVerify + { + get + { + return new Dictionary + { + { + "verify", new List + { + true + } + }, + { + "street1", "417 montgomery streat" + }, + { + "street2", "FL 5" + }, + { + "city", "San Francisco" + }, + { + "state", "CA" + }, + { + "zip", "94104" + }, + { + "country", "US" + }, + { + "company", "EasyPost" + }, + { + "phone", "415-123-4567" + } + }; + } + } + + public static Dictionary PickupAddress + { + get + { + return new Dictionary + { + { + "name", "Dr. Steve Brule" + }, + { + "street1", "179 N Harbor Dr" + }, + { + "city", "Redondo Beach" + }, + { + "state", "CA" + }, + { + "zip", "90277" + }, + { + "country", "US" + }, + { + "phone", "3331114444" + } + }; + } + } + + public static Dictionary BasicParcel + { + get + { + return new Dictionary + { + { + "length", "10" + }, + { + "width", "8" + }, + { + "height", "4" + }, + { + "weight", "15.4" + } + }; + } + } + + public static Dictionary BasicCustomsItem + { + get + { + return new Dictionary + { + { + "description", "Sweet shirts" + }, + { + "quantity", 2 + }, + { + "weight", 11 + }, + { + "value", 23.00 + }, + { + "hs_tariff_number", 654321 + }, + { + "origin_country", "US" + } + }; + } + } + + public static Dictionary BasicCustomsInfo + { + get + { + return new Dictionary + { + { + "eel_pfc", "NOEEI 30.37(a)" + }, + { + "customs_certify", true + }, + { + "customs_signer", "Dr. Steve Brule" + }, + { + "contents_type", "merchandise" + }, + { + "contents_explanation", "" + }, + { + "restriction_type", "none" + }, + { + "non_delivery_option", "return" + }, + { + "customs_items", new List + { + BasicCustomsItem + } + } + }; + } + } + + public static Dictionary BasicCarrierAccount + { + get + { + return new Dictionary + { + { + "type", "UpsAccount" + }, + { + "credentials", new Dictionary + { + { + "account_number", "A1A1A1" + }, + { + "user_id", "USERID" + }, + { + "password", "PASSWORD" + }, + { + "access_license_number", "ALN" + } + } + } + }; + } + } + + public static Dictionary TaxIdentifier + { + get + { + return new Dictionary + { + { + "entity", "SENDER" + }, + { + "tax_id_type", "IOSS" + }, + { + "tax_id", "12345" + }, + { + "issuing_country", "GB" + } + }; + } + } + + public static Dictionary BasicShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + } + }; + } + } + + public static Dictionary FullShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + }, + { + "customs_info", BasicCustomsInfo + }, + { + "options", new Dictionary + { + { + "label_format", "PNG" // Must be PNG so we can convert to ZPL later + }, + { + "invoice_number", "123" + } + } + }, + { + "reference", "123" + } + }; + } + } + + public static Dictionary OneCallBuyShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + }, + { + "service", UspsService + }, + { + "carrier_accounts", new List + { + UspsCarrierAccountId + } + }, + { + "carrier", Usps + } + }; + } + } + + public static Dictionary BasicInsurance + { + get + { + Shipment shipment = Shipment.Create(OneCallBuyShipment); + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "tracking_code", shipment.tracking_code + }, + { + "carrier", Usps + }, + { + "amount", 100 + } + }; + } + } + + // This fixture will require you to add a `shipment` key with a Shipment object from a test. + // If you need to re-record cassettes, simply iterate the dates below and ensure they're one day in the future, + // USPS only does "next-day" pickups including Saturday but not Sunday or Holidays. + public static Dictionary BasicPickup + { + get + { + return new Dictionary + { + { + "address", BasicAddress + }, + { + "min_datetime", (DateTime.Today.Date + TimeSpan.FromDays(1)).ToString("yyyy-MM-dd") + }, + { + "max_datetime", (DateTime.Today.Date + TimeSpan.FromDays(2)).ToString("yyyy-MM-dd") + }, + { + "instructions", "Pickup at front door" + } + }; + } + } + + public static Dictionary BasicOrder + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "shipments", new List> + { + BasicShipment + } + } + }; + } + } + + public static string Event + { + get + { + Dictionary data = new Dictionary + { + { + "mode", "production" + }, + { + "description", "batch.created" + }, + { + "previous_attributes", new Dictionary + { + { + "state", "purchasing" + } + } + }, + { + "pending_urls", new List + { + "example.com/easypost-webhook" + } + }, + { + "completed_urls", new List() + }, + { + "created_at", "2015-12-03T19:09:19Z" + }, + { + "updated_at", "2015-12-03T19:09:19Z" + }, + { + "result", new Dictionary + { + { + "id", "batch_..." + }, + { + "object", "Batch" + }, + { + "mode", "production" + }, + { + "state", "purchased" + }, + { + "num_shipments", 1 + }, + { + "reference", null + }, + { + "created_at", "2015-12-03T19:09:19Z" + }, + { + "updated_at", "2015-12-03T19:09:19Z" + }, + { + "scan_form", null + }, + { + "shipments", new Dictionary + { + { + "batch_status", "postage_purchased" + }, + { + "batch_message", null + }, + { + "id", "shp_123..." + } + } + }, + { + "status", new Dictionary + { + { + "created", 0 + }, + { + "queued_for_purchase", 0 + }, + { + "creation_failed", 0 + }, + { + "postage_purchased", 1 + }, + { + "postage_purchase_failed", 0 + } + } + }, + { + "pickup", null + }, + { + "label_url", null + } + } + }, + { + "id", "evt_..." + }, + { + "object", "Event" + } + }; + return JsonSerialization.ConvertObjectToJson(data); + } + } + } +} diff --git a/EasyPost.Tests.Net/InsuranceTest.cs b/EasyPost.Tests.Net/InsuranceTest.cs index f086c4b19..989fef47d 100644 --- a/EasyPost.Tests.Net/InsuranceTest.cs +++ b/EasyPost.Tests.Net/InsuranceTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -7,139 +6,63 @@ namespace EasyPost.Tests.Net [TestClass] public class InsuranceTest { - private Dictionary FromAddressData { get; set; } - private Dictionary InsuranceData { get; set; } - private Dictionary ParcelData { get; set; } - private Dictionary ToAddressData { get; set; } - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - FromAddressData = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend St" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "zip", "94107" - }, - { - "country", "US" - } - }; - ToAddressData = new Dictionary() - { - { - "company", "The White House" - }, - { - "street1", "1600 Pennsylvania Avenue NW" - }, - { - "street2", "DC 20500" - }, - { - "city", "Washington" - }, - { - "state", "DC" - }, - { - "zip", "20500" - }, - { - "country", "US" - } - }; - ParcelData = new Dictionary - { - { - "weight", 8.0 - } - }; + VCR.SetUp(VCRApiKey.Test, "insurance", true); + } - Shipment shipment = Shipment.Create(new Dictionary - { - { - "from_address", FromAddressData - }, - { - "to_address", ToAddressData - }, - { - "parcel", ParcelData - }, - { - "service", "First" - }, - { - "carrier_accounts", new List - { - { - "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - } - } - }); + private static Insurance CreateBasicInsurance() + { + return Insurance.Create(Fixture.BasicInsurance); + } - InsuranceData = new Dictionary - { - { - "to_address", ToAddressData - }, - { - "from_address", FromAddressData - }, - { - "tracking_code", shipment.tracking_code - }, - { - "amount", "100.00" - }, - { - "carrier", "USPS" - } - }; + [TestMethod] + public void TestCreate() + { + VCR.Replay("create"); + + Insurance insurance = CreateBasicInsurance(); + + Assert.IsInstanceOfType(insurance, typeof(Insurance)); + Assert.IsTrue(insurance.id.StartsWith("ins_")); + // TODO: amount really should be a number, not a string + Assert.AreEqual("100.00000", insurance.amount); } [TestMethod] - public void TestCreateAndRetrieve() + public void TestRetrieve() { - Insurance insurance = Insurance.Create(InsuranceData); - Assert.IsNotNull(insurance.id); - Assert.AreEqual("SAN FRANCISCO", insurance.from_address.city); + VCR.Replay("retrieve"); + - Insurance retrieved = Insurance.Retrieve(insurance.id); - Assert.AreEqual(insurance.id, retrieved.id); + Insurance insurance = CreateBasicInsurance(); + + Insurance retrievedInsurance = Insurance.Retrieve(insurance.id); + Assert.IsInstanceOfType(retrievedInsurance, typeof(Insurance)); + Assert.AreEqual(insurance.id, retrievedInsurance.id); } [TestMethod] - public void TestRetrieveAll() + public void TestAll() { - InsuranceCollection insuranceCollection = Insurance.All(); - Assert.IsNotNull(insuranceCollection); - foreach (Insurance insurance in insuranceCollection.insurances) + VCR.Replay("all"); + + InsuranceCollection insuranceCollection = Insurance.All(new Dictionary + { + { + "page_size", Fixture.PageSize + } + }); + + List insurances = insuranceCollection.insurances; + + Assert.IsTrue(insurances.Count <= Fixture.PageSize); + Assert.IsNotNull(insuranceCollection.has_more); + foreach (var item in insurances) { - Assert.IsNotNull(insurance.id); - Assert.AreEqual(insurance.id.Substring(0, 4), "ins_"); + Assert.IsInstanceOfType(item, typeof(Insurance)); } } - - [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestRetrieveInvalidId() => Insurance.Retrieve("not-an-id"); } } diff --git a/EasyPost.Tests.Net/OrderTest.cs b/EasyPost.Tests.Net/OrderTest.cs index e565fe9ee..71d7711a9 100644 --- a/EasyPost.Tests.Net/OrderTest.cs +++ b/EasyPost.Tests.Net/OrderTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -7,205 +6,79 @@ namespace EasyPost.Tests.Net [TestClass] public class OrderTest { - private Dictionary parameters, toAddress, fromAddress; - private List> shipments; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - shipments = new List> - { - new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 18 - } - } - } - }, - new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 9 - }, - { - "width", 5 - }, - { - "height", 4 - }, - { - "weight", 18 - } - } - } - } - }; - - parameters = new Dictionary - { - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "OrderRef" - }, - { - "shipments", shipments - } - }; + VCR.SetUp(VCRApiKey.Test, "order", true); } - // [TestMethod] - // public void TestCreateFromInstance() { - // Order order = new Order() { - // to_address = Address.Create(toAddress), - // from_address = Address.Create(fromAddress), - // reference = "OrderRef", - // shipments = shipments.Select(shipment => Shipment.Create(shipment)).ToList(), - // carrier_accounts = new List() { new CarrierAccount() { id = "ca_7642d249fdcf47bcb5da9ea34c96dfcf" } } - // }; - - // order.Create(); - - // Assert.IsNotNull(order.id); - // Assert.AreEqual(order.reference, "OrderRef"); - // CollectionAssert.AreEqual( - // new List() { "ca_7642d249fdcf47bcb5da9ea34c96dfcf" }, - // new HashSet(order.shipments.SelectMany(s => s.rates).Select(r => r.carrier_account_id)).ToList() - // ); - // } - - [TestMethod] - public void TestBuyOrder() + private static Order CreateBasicOrder() { - Order order = Order.Create(parameters); - order.Buy("USPS", "Priority"); - - Assert.IsNotNull(order.shipments[0].postage_label); + return Order.Create(Fixture.BasicOrder); } [TestMethod] - public void TestCreateAndRetrieveOrder() + public void TestCreate() { - Order order = Order.Create(parameters); + VCR.Replay("create"); - Assert.IsNotNull(order.id); - Assert.AreEqual(order.reference, "OrderRef"); + Order order = CreateBasicOrder(); - Order retrieved = Order.Retrieve(order.id); - Assert.AreEqual(order.id, retrieved.id); + Assert.IsInstanceOfType(order, typeof(Order)); + Assert.IsTrue(order.id.StartsWith("order_")); + Assert.IsNotNull(order.rates); } [TestMethod] - [ExpectedException(typeof(ResourceAlreadyCreated))] - public void TestCreateOrderWithId() + public void TestRetrieve() { - Order order = new Order - { - id = "order_asjhd" - }; - order.Create(); - } + VCR.Replay("retrieve"); - [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestFailure() => Order.Create(new Dictionary()); + Order order = CreateBasicOrder(); + + + Order retrievedOrder = Order.Retrieve(order.id); + + Assert.IsInstanceOfType(retrievedOrder, typeof(Order)); + Assert.AreEqual(order.id, retrievedOrder.id); + } [TestMethod] public void TestGetRates() { - Order order = Order.Create(parameters); - List old = order.rates; + VCR.Replay("get_rates"); + + + Order order = CreateBasicOrder(); + order.GetRates(); - Assert.AreNotEqual(old, order.rates); + + List rates = order.rates; + + Assert.IsNotNull(rates); + foreach (var rate in rates) + { + Assert.IsInstanceOfType(rate, typeof(Rate)); + } } [TestMethod] - public void TestOrderCarrierAccounts() + public void TestBuy() { - Dictionary carrierAccounts = - new Dictionary - { - { - "id", "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - }; - parameters.Add("carrier_accounts", carrierAccounts); - Order order = Order.Create(parameters); - - parameters.Remove("carrier_accounts"); - Order largeOrder = Order.Create(parameters); - - Assert.IsTrue(order.rates.Count < largeOrder.rates.Count); + VCR.Replay("buy"); + + + Order order = CreateBasicOrder(); + + order.Buy(Fixture.Usps, Fixture.UspsService); + + List shipments = order.shipments; + + foreach (var shipment in shipments) + { + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsNotNull(shipment.postage_label); + } } } } diff --git a/EasyPost.Tests.Net/ParcelTest.cs b/EasyPost.Tests.Net/ParcelTest.cs index c83806240..2ad872e6c 100644 --- a/EasyPost.Tests.Net/ParcelTest.cs +++ b/EasyPost.Tests.Net/ParcelTest.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net { @@ -8,38 +6,40 @@ namespace EasyPost.Tests.Net public class ParcelTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "parcel", true); + } + + private static Parcel CreateBasicParcel() + { + return Parcel.Create(Fixture.BasicParcel); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreate() { - Parcel parcel = Parcel.Create(new Dictionary - { - { - "length", 10 - }, - { - "width", 20 - }, - { - "height", 5 - }, - { - "weight", 1.8 - } - }); - Parcel retrieved = Parcel.Retrieve(parcel.id); - Assert.AreEqual(parcel.id, retrieved.id); + VCR.Replay("create"); + + Parcel parcel = CreateBasicParcel(); + + Assert.IsInstanceOfType(parcel, typeof(Parcel)); + Assert.IsTrue(parcel.id.StartsWith("prcl_")); + Assert.AreEqual(15.4, parcel.weight); } - // [TestMethod] - // public void TestPredefinedPackage() { - // Parcel parcel = new Parcel() { weight = 1.8, predefined_package = "SMALLFLATRATEBOX" }; - // Shipment shipment = new Shipment() { parcel = parcel }; - // shipment.Create(); + [TestMethod] + public void TestRetrieve() + { + VCR.Replay("retrieve"); + - // Assert.AreEqual(null, shipment.parcel.height); - // Assert.AreEqual("SMALLFLATRATEBOX", shipment.parcel.predefined_package); - // } + Parcel parcel = CreateBasicParcel(); + + Parcel retrievedParcel = Parcel.Retrieve(parcel.id); + + Assert.IsInstanceOfType(retrievedParcel, typeof(Parcel)); + Assert.AreEqual(parcel.id, retrievedParcel.id); + } } } diff --git a/EasyPost.Tests.Net/PickupTest.cs b/EasyPost.Tests.Net/PickupTest.cs index 884c7c864..d7901eb28 100644 --- a/EasyPost.Tests.Net/PickupTest.cs +++ b/EasyPost.Tests.Net/PickupTest.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; - +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,153 +6,77 @@ namespace EasyPost.Tests.Net [TestClass] public class PickupTest { - private Address address; - private Dictionary parameters, parcel, toAddress, fromAddress; - private Shipment shipment; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - address = new Address - { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107", - phone = "1234567890" - }; - - parcel = new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - }; - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - shipment = Shipment.Create(new Dictionary - { - { - "parcel", parcel - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - } - }); - shipment.Buy(shipment.LowestRate()); - - parameters = new Dictionary - { - { - "is_account_address", false - }, - { - "instructions", "In mailbox." - }, - { - "address", address - }, - { - "shipment", shipment - }, - { - "min_datetime", DateTime.Now.AddDays(1) - }, - { - "max_datetime", DateTime.Now.AddDays(1) - } - }; + VCR.SetUp(VCRApiKey.Test, "pickup", true); + } + + private static Pickup CreateBasicPickup() + { + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + Dictionary pickupData = Fixture.BasicPickup; + pickupData["shipment"] = shipment; + return Pickup.Create(pickupData); } [TestMethod] - public void TestBuyAndCancel() + public void TestCreate() { - Pickup pickup = Pickup.Create(parameters); + VCR.Replay("create"); + + Pickup pickup = CreateBasicPickup(); + + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.IsNotNull(pickup.pickup_rates); + } + + [TestMethod] + public void TestRetrieve() + { + VCR.Replay("retrieve"); - pickup.Buy(pickup.pickup_rates[0].carrier, pickup.pickup_rates[0].service); - Assert.IsNotNull(pickup.confirmation); - // XXX: This isn't working. - //pickup.Cancel(); - //Assert.AreEqual(pickup.status, "canceled"); + Pickup pickup = CreateBasicPickup(); + + Pickup retrievedPickup = Pickup.Retrieve(pickup.id); + + Assert.IsInstanceOfType(retrievedPickup, typeof(Pickup)); + Assert.AreEqual(pickup.id, retrievedPickup.id); + } + + [TestMethod] + public void TestBuy() + { + VCR.Replay("buy"); + + //use "TestCreate" + Pickup pickup = CreateBasicPickup(); + + pickup.Buy(Fixture.Usps, Fixture.NextDayService); + + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.IsNotNull(pickup.confirmation); + Assert.AreEqual("scheduled", pickup.status); } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCancel() { - Pickup pickup = Pickup.Create(parameters); + VCR.Replay("cancel"); + + //use "TestCreate" + Pickup pickup = CreateBasicPickup(); + + pickup.Buy(Fixture.Usps, Fixture.NextDayService); - Assert.IsNotNull(pickup.id); - Assert.AreEqual(pickup.address.street1, "164 Townsend Street"); + pickup.Cancel(); - Pickup retrieved = Pickup.Retrieve(pickup.id); - Assert.AreEqual(pickup.id, retrieved.id); + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.AreEqual("canceled", pickup.status); } } } diff --git a/EasyPost.Tests.Net/RateTest.cs b/EasyPost.Tests.Net/RateTest.cs index 509a8dbc6..0cc24c31d 100644 --- a/EasyPost.Tests.Net/RateTest.cs +++ b/EasyPost.Tests.Net/RateTest.cs @@ -1,6 +1,4 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net { @@ -8,97 +6,23 @@ namespace EasyPost.Tests.Net public class RateTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "rate", true); + } [TestMethod] public void TestRetrieve() { - Dictionary fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - Dictionary toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Shipment shipment = Shipment.Create(new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - } - }); + VCR.Replay("retrieve"); + + Shipment shipment = Shipment.Create(Fixture.BasicShipment); - shipment.GetRates(); Rate rate = Rate.Retrieve(shipment.rates[0].id); - Assert.AreEqual(rate.id, shipment.rates[0].id); - Assert.IsNotNull(rate.rate); - Assert.IsNotNull(rate.currency); - Assert.IsNotNull(rate.list_rate); - Assert.IsNotNull(rate.list_currency); + Assert.IsInstanceOfType(rate, typeof(Rate)); + Assert.IsTrue(rate.id.StartsWith("rate_")); + Assert.AreEqual(shipment.rates[0].id, rate.id); } } } diff --git a/EasyPost.Tests.Net/RefundTest.cs b/EasyPost.Tests.Net/RefundTest.cs new file mode 100644 index 000000000..d545b09db --- /dev/null +++ b/EasyPost.Tests.Net/RefundTest.cs @@ -0,0 +1,16 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace EasyPost.Tests.Net +{ + [TestClass] + public class RefundTest + { + // TODO: C# does not have a Refund class + + [TestInitialize] + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "refund", true); + } + } +} diff --git a/EasyPost.Tests.Net/ReportTest.cs b/EasyPost.Tests.Net/ReportTest.cs index f6754a0ba..ed33fa769 100644 --- a/EasyPost.Tests.Net/ReportTest.cs +++ b/EasyPost.Tests.Net/ReportTest.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; - +using System; +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,35 +8,140 @@ namespace EasyPost.Tests.Net public class ReportTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "report", true); + } + + private static Report CreateBasicReport(string reportType) + { + return Report.Create(reportType, new Dictionary + { + { + "start_date", Fixture.ReportStartDate + }, + { + "end_date", Fixture.ReportEndDate + } + }); + } + + private static void TestCreateReport(string cassetteName, string reportType, string idPrefix) + { + VCR.Replay(cassetteName); + + Report report = CreateBasicReport(reportType); + + Assert.IsInstanceOfType(report, typeof(Report)); + Assert.IsTrue(report.id.StartsWith(idPrefix)); + } + + private static void TestRetrieveReport(string cassetteName, string reportType) + { + VCR.Replay(cassetteName); + + + Report report = CreateBasicReport(reportType); + + Report retrievedReport = Report.Retrieve(report.id); + + Assert.IsInstanceOfType(report, typeof(Report)); + Assert.AreEqual(report.start_date, retrievedReport.start_date); + Assert.AreEqual(report.end_date, retrievedReport.end_date); + } + + [TestMethod] + public void TestCreatePaymentLogReport() + { + TestCreateReport("create_payment_log_report", "payment_log", "plrep_"); + } + + [TestMethod] + public void TestCreateRefundReport() + { + TestCreateReport("create_refund_report", "refund", "refrep_"); + } + + [TestMethod] + public void TestCreateShipmentReport() + { + TestCreateReport("create_shipment_report", "shipment", "shprep_"); + } + + [TestMethod] + public void TestCreateShipmentInvoiceReport() + { + TestCreateReport("create_shipment_invoice_report", "shipment_invoice", "shpinvrep_"); + } + + [TestMethod] + public void TestCreateTrackerReport() + { + TestCreateReport("create_tracker_report", "tracker", "trkrep_"); + } + + [TestMethod] + public void TestRetrievePaymentLogReport() + { + TestRetrieveReport("retrieve_payment_log_report", "payment_log"); + } + + [TestMethod] + public void TestRetrieveRefundReport() + { + TestRetrieveReport("retrieve_refund_report", "refund"); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestRetrieveShipmentReport() { - Dictionary parameters = new Dictionary(); - Report report = Report.Create("shipment", parameters); - Assert.IsNotNull(report.id); + TestRetrieveReport("retrieve_shipment_report", "shipment"); + } - Report retrieved = Report.Retrieve("shipment", report.id); - Assert.AreEqual(report.id, retrieved.id); + [TestMethod] + public void TestRetrieveShipmentInvoiceReport() + { + TestRetrieveReport("retrieve_shipment_invoice_report", "shipment_invoice"); + } - retrieved = Report.Retrieve(report.id); - Assert.AreEqual(report.id, retrieved.id); + [TestMethod] + public void TestRetrieveTrackerReport() + { + TestRetrieveReport("retrieve_tracker_report", "tracker"); } [TestMethod] public void TestAll() { + VCR.Replay("all"); + ReportList reportList = Report.All("shipment", new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } }); - Assert.AreNotEqual(0, reportList.reports.Count); - ReportList nextReportList = reportList.Next(); - Assert.AreNotEqual(reportList.reports[0].id, nextReportList.reports[0].id); + List reports = reportList.reports; + + Assert.IsTrue(reports.Count <= Fixture.PageSize); + Assert.IsNotNull(reportList.has_more); + foreach (var report in reports) + { + Assert.IsInstanceOfType(report, typeof(Report)); + } + } + + [TestMethod] + public void TestCreateNoType() + { + Assert.ThrowsException(() => Report.Create("")); + } + + [TestMethod] + public void TestAllNoType() + { + Assert.ThrowsException(() => Report.All("")); } } } diff --git a/EasyPost.Tests.Net/RequestTest.cs b/EasyPost.Tests.Net/RequestTest.cs deleted file mode 100644 index c03826a9d..000000000 --- a/EasyPost.Tests.Net/RequestTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using RestSharp; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class RequestTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - [TestMethod] - public void TestAddBody() - { - Request request = new Request("resource"); - request.AddBody(new Dictionary - { - { - "foo", "bar" - } - }); - - RestRequest restRequest = (RestRequest)request; - List parameters = restRequest.Parameters.Select(p => p.Value.ToString()).ToList(); - CollectionAssert.Contains(parameters, "{\"foo\":\"bar\"}"); - } - - [TestMethod] - public void TestCastToRestRequest() - { - RestRequest request = (RestRequest)new Request("resource"); - } - - // [TestMethod] - // public void TestRestRequest() { - // Request request = new Request("resource"); - // Assert.IsInstanceOfType(request.restRequest, typeof(RestRequest)); - // } - - [TestMethod] - public void TestRootElement() - { - Request request = new Request("resource"); - request.RootElement = "root"; - Assert.AreEqual(request.RootElement, "root"); - } - } -} diff --git a/EasyPost.Tests.Net/ResourceTest.cs b/EasyPost.Tests.Net/ResourceTest.cs deleted file mode 100644 index 16876b95a..000000000 --- a/EasyPost.Tests.Net/ResourceTest.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ResourceTest - { - private class Inner : Resource - { - public string qux { get; set; } - } - - private class Data : Resource - { - public int bar { get; set; } - public List baz { get; set; } - public string foo { get; set; } - } - - [TestClass] - public class ResourceExtenstionTest - { - private Data dest, source; - - [TestInitialize] - public void Initialize() - { - dest = new Data - { - foo = "foo", - bar = 10, - baz = new List - { - new Inner - { - qux = "qux" - } - } - }; - source = new Data - { - foo = "oof", - bar = 42, - baz = new List - { - new Inner - { - qux = "xuq" - } - } - }; - } - - [TestMethod] - public void TestAsDictionary() - { - Dictionary dictionary = source.AsDictionary(); - - Assert.AreEqual(dictionary["foo"], "oof"); - Assert.AreEqual(dictionary["bar"], 42); - Assert.AreEqual(((List>)dictionary["baz"])[0]["qux"], "xuq"); - } - - [TestMethod] - public void TestLoad() - { - Assert.AreEqual(Resource.Load(JsonConvert.SerializeObject(source.AsDictionary())).foo, "oof"); - Assert.AreEqual(Resource.Load(JsonConvert.SerializeObject(source.AsDictionary())).baz[0].qux, - "xuq"); - Assert.AreEqual(Resource.LoadFromDictionary(source.AsDictionary()).foo, "oof"); - Assert.AreEqual(Resource.LoadFromDictionary(source.AsDictionary()).baz[0].qux, "xuq"); - } - - [TestMethod] - public void TestMerge() - { - dest.Merge(source); - - Assert.AreEqual(dest.foo, source.foo); - Assert.AreEqual(dest.bar, source.bar); - Assert.AreEqual(dest.baz[0].qux, source.baz[0].qux); - } - } - } -} diff --git a/EasyPost.Tests.Net/ScanFormTest.cs b/EasyPost.Tests.Net/ScanFormTest.cs index 6dfe2c8f8..6c52a743c 100644 --- a/EasyPost.Tests.Net/ScanFormTest.cs +++ b/EasyPost.Tests.Net/ScanFormTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,29 +7,65 @@ namespace EasyPost.Tests.Net public class ScanFormTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "scan_form", true); + } + + private static ScanForm GetBasicScanForm() + { + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + return ScanForm.Create(new List + { + shipment + }); + } [TestMethod] - public void TestScanFormCreateAndRetrieve() + public void TestCreate() { - ScanForm scanForm = ScanForm.Retrieve("sf_e35ae7fc59bb4482ae32efc663267104"); - Assert.AreEqual("sf_e35ae7fc59bb4482ae32efc663267104", scanForm.id); + VCR.Replay("create"); + + ScanForm scanForm = GetBasicScanForm(); + + Assert.IsInstanceOfType(scanForm, typeof(ScanForm)); + Assert.IsTrue(scanForm.id.StartsWith("sf_")); } [TestMethod] - public void TestScanFormList() + public void TestRetrieve() { - Dictionary dict = new Dictionary + VCR.Replay("retrieve"); + + + ScanForm scanForm = GetBasicScanForm(); + + ScanForm retrievedScanForm = ScanForm.Retrieve(scanForm.id); + + Assert.IsInstanceOfType(retrievedScanForm, typeof(ScanForm)); + Assert.AreEqual(scanForm.id, retrievedScanForm.id); + } + + [TestMethod] + public void TestAll() + { + VCR.Replay("all"); + + ScanFormList scanFormList = ScanForm.All(new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } - }; - ScanFormList scanFormList = ScanForm.All(dict); - Assert.AreNotEqual(null, scanFormList.scan_forms[0].batch_id); - Assert.AreNotEqual(0, scanFormList.scan_forms.Count); - ScanFormList nextScanFormList = scanFormList.Next(); - Assert.AreNotEqual(scanFormList.scan_forms[0].id, nextScanFormList.scan_forms[0].id); + }); + + List scanForms = scanFormList.scan_forms; + + Assert.IsTrue(scanForms.Count <= Fixture.PageSize); + Assert.IsNotNull(scanFormList.has_more); + foreach (var scanForm in scanForms) + { + Assert.IsInstanceOfType(scanForm, typeof(ScanForm)); + } } } } diff --git a/EasyPost.Tests.Net/SecurityTest.cs b/EasyPost.Tests.Net/SecurityTest.cs deleted file mode 100644 index e8657ba8d..000000000 --- a/EasyPost.Tests.Net/SecurityTest.cs +++ /dev/null @@ -1,15 +0,0 @@ -// using System.Net; -// using Microsoft.VisualStudio.TestTools.UnitTesting; -// using EasyPost; - -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class SecurityTest { -// [TestMethod] -// public void TestGetProtocol() { -// Assert.AreEqual(Security.GetProtocol(), SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12); -// } -// } -// } - - diff --git a/EasyPost.Tests.Net/ShipmentTest.cs b/EasyPost.Tests.Net/ShipmentTest.cs index 2aa622a6b..6ea58e85a 100644 --- a/EasyPost.Tests.Net/ShipmentTest.cs +++ b/EasyPost.Tests.Net/ShipmentTest.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -9,591 +7,199 @@ namespace EasyPost.Tests.Net [TestClass] public class ShipmentTest { - private Dictionary parameters, options, toAddress, fromAddress; - - //Smart rate - [TestMethod] - public void ApiCallIsNotNull() + [TestInitialize] + public void Initialize() { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - Assert.IsNotNull(smartrateResult); + VCR.SetUp(VCRApiKey.Test, "shipment", true); } - [TestInitialize] - public void Initialize() + [TestMethod] + public void TestCreate() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + VCR.Replay("create"); - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - options = new Dictionary(); - parameters = new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - }, - { - "options", options - } - }; + Shipment shipment = Shipment.Create(Fixture.FullShipment); + + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.IsNotNull(shipment.rates); + Assert.AreEqual("PNG", shipment.options.label_format); + Assert.AreEqual("123", shipment.options.invoice_number); + Assert.AreEqual("123", shipment.reference); } [TestMethod] - public void TestBuyWithInsurance() + public void TestRetrieve() { - Shipment shipment = Shipment.Create(parameters); - shipment.GetRates(); - shipment.Buy(shipment.rates.First(), "100.00"); + VCR.Replay("retrieve"); + - Assert.AreEqual(shipment.insurance, "100.00"); + Shipment shipment = Shipment.Create(Fixture.FullShipment); + + Shipment retrievedShipment = Shipment.Retrieve(shipment.id); + + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.AreEqual(shipment.id, retrievedShipment.id); } [TestMethod] - public void TestCarrierAccounts() + public void TestAll() { - Address to = Address.Create(toAddress); - Address from = Address.Create(fromAddress); - Parcel parcel = Parcel.Create(new Dictionary + VCR.Replay("all"); + + ShipmentList shipmentList = Shipment.All(new Dictionary { { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 + "page_size", Fixture.PageSize } }); - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = new CustomsInfo - { - customs_certify = "TRUE", - eel_pfc = "NOEEI 30.37(a)", - customs_items = new List - { - item - } - }; - Shipment shipment = new Shipment - { - to_address = to, - from_address = from, - parcel = parcel, - carrier_accounts = new List - { - new CarrierAccount - { - id = "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - } - }; - shipment.Create(); - if (shipment.rates.Count > 0) + List shipments = shipmentList.shipments; + + Assert.IsTrue(shipments.Count <= Fixture.PageSize); + Assert.IsNotNull(shipmentList.has_more); + foreach (var shipment in shipments) { - Assert.IsTrue(shipment.rates.TrueForAll(r => - r.carrier_account_id == "ca_7642d249fdcf47bcb5da9ea34c96dfcf")); + Assert.IsInstanceOfType(shipment, typeof(Shipment)); } } - [TestMethod] - public void TestCarrierAccountsString() + public void TestBuy() { - parameters["carrier_accounts"] = new List - { - "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - }; - Shipment shipment = Shipment.Create(parameters); + VCR.Replay("buy"); - foreach (Rate rate in shipment.rates) - { - Assert.AreEqual("ca_7642d249fdcf47bcb5da9ea34c96dfcf", rate.carrier_account_id); - } - } - [TestMethod] - public void TestCreateAndBuyPlusInsurance() - { - Shipment shipment = Shipment.Create(parameters); - Assert.IsNotNull(shipment.rates); - Assert.AreNotEqual(shipment.rates.Count, 0); + Shipment shipment = Shipment.Create(Fixture.FullShipment); - shipment.Buy(shipment.rates[0]); - Assert.IsNotNull(shipment.postage_label); - Assert.AreNotEqual(shipment.fees.Count, 0); - CollectionAssert.AllItemsAreNotNull(shipment.fees.Select(f => f.type).ToList()); + shipment.Buy(shipment.LowestRate()); - shipment.Insure(100.1); - Assert.AreNotEqual(shipment.insurance, 100.1); + Assert.IsNotNull(shipment.postage_label); } [TestMethod] - public void TestCreateAndRetrieve() + public void TestRegenerateRates() { - Shipment shipment = Shipment.Create(parameters); + VCR.Replay("regenerate_rates"); - Assert.IsNotNull(shipment.id); - Assert.AreEqual(shipment.reference, "ShipmentRef"); - Shipment retrieved = Shipment.Retrieve(shipment.id); - Assert.AreEqual(shipment.id, retrieved.id); - } + Shipment shipment = Shipment.Create(Fixture.FullShipment); - [TestMethod] - [ExpectedException(typeof(ResourceAlreadyCreated))] - public void TestCreateWithId() - { - Shipment shipment = new Shipment + shipment.RegenerateRates(); + + List rates = shipment.rates; + + Assert.IsNotNull(rates); + foreach (var rate in rates) { - id = "shp_asdlf" - }; - shipment.Create(); + Assert.IsInstanceOfType(rate, typeof(Rate)); + } } [TestMethod] - public void TestCreateWithPreCreatedAttributes() + public void TestConvertLabel() { - Shipment shipment = CreateShipmentResource(); - shipment.Create(); - Assert.IsNotNull(shipment.id); - } + VCR.Replay("convert_label"); - [TestMethod] - public void TestGenerateLabel() - { - Shipment shipment = BuyShipment(); + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); - shipment.GenerateLabel("pdf"); - Assert.IsNotNull(shipment.postage_label); - } + shipment.GenerateLabel("ZPL"); - [TestMethod] - public void TestGetRatesWithoutCreate() - { - Shipment shipment = CreateShipmentResource(); - shipment.GetRates(); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); + Assert.IsNotNull(shipment.postage_label.label_zpl_url); } + // If the shipment was purchased with a USPS rate, it must have had its insurance set to `0` when bought + // so that USPS doesn't automatically insure it so we could manually insure it here. [TestMethod] - public void TestGetSmartrates() + public void TestInsure() { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - //Make sure shipment id from smartrate is the same as the created one - Assert.AreEqual(shipment.rates[0].id, smartrateResult[0].id); - Assert.IsNotNull(shipment.rates); - } + VCR.Replay("insure"); - [TestMethod] - public void TestInstanceOptions() - { - DateTime tomorrow = DateTime.Now.AddDays(1).ToUniversalTime(); + Dictionary shipmentData = Fixture.OneCallBuyShipment; + // Set to 0 so USPS doesn't insure this automatically and we can insure the shipment manually + shipmentData["insurance"] = 0; - Shipment shipment = CreateShipmentResource(); - shipment.options = new Options - { - label_date = tomorrow - }; - shipment.Create(); - - Assert.AreEqual(tomorrow.ToString(), shipment.options.label_date.ToString()); - } + Shipment shipment = Shipment.Create(shipmentData); - [TestMethod] - public void TestAll() - { - ShipmentList shipmentList = Shipment.All(new Dictionary - { - { - "page_size", 1 - } - }); - Assert.AreNotEqual(0, shipmentList.shipments.Count); + shipment.Insure(100); - ShipmentList nextShipmentList = shipmentList.Next(); - Assert.AreNotEqual(shipmentList.shipments[0].id, nextShipmentList.shipments[0].id); + Assert.AreEqual("100.00", shipment.insurance); } + // Refunding a test shipment must happen within seconds of the shipment being created as test shipments naturally + // follow a flow of created -> delivered to cycle through tracking events in test mode - as such anything older + // than a few seconds in test mode may not be refundable. [TestMethod] - public void TestLowestRate() + public void TestRefund() { - Rate lowestUSPS = new Rate - { - rate = "1.0", - carrier = "USPS", - service = "ParcelSelect" - }; - Rate highestUSPS = new Rate - { - rate = "10.0", - carrier = "USPS", - service = "Priority" - }; - Rate lowestUPS = new Rate - { - rate = "2.0", - carrier = "UPS", - service = "ParcelSelect" - }; - Rate highestUPS = new Rate - { - rate = "20.0", - carrier = "UPS", - service = "Priority" - }; - - Shipment shipment = - new Shipment - { - rates = new List - { - highestUSPS, - lowestUSPS, - highestUPS, - lowestUPS - } - }; - - Rate rate = shipment.LowestRate(); - Assert.AreEqual(rate, lowestUSPS); - - rate = shipment.LowestRate(new List - { - "UPS" - }); - Assert.AreEqual(rate, lowestUPS); + VCR.Replay("refund"); - rate = shipment.LowestRate(includeServices: new List - { - "Priority" - }); - Assert.AreEqual(rate, highestUSPS); + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); - rate = shipment.LowestRate(excludeCarriers: new List - { - "USPS" - }); - Assert.AreEqual(rate, lowestUPS); - - rate = shipment.LowestRate(excludeServices: new List - { - "ParcelSelect" - }); - Assert.AreEqual(rate, highestUSPS); + shipment.Refund(); - rate = shipment.LowestRate(new List - { - "FedEx" - }); - Assert.IsNull(rate); + Assert.AreEqual("submitted", shipment.refund_status); } [TestMethod] - public void TestOptions() + public void TestSmartrate() { - DateTime tomorrow = DateTime.Now.AddDays(1); - options["label_date"] = tomorrow.ToString("yyyy-MM-ddTHH:mm:ssZ"); - options["print_custom"] = new List> - { - new Dictionary - { - { - "value", "value" - }, - { - "name", "name" - }, - { - "barcode", true - } - } - }; - options["payment"] = new Dictionary - { - { - "type", "THIRD_PARTY" - }, - { - "account", "12345" - }, - { - "postal_code", "54321" - }, - { - "country", "US" - } - }; + VCR.Replay("smartrate"); - Shipment shipment = Shipment.Create(parameters); + Shipment shipment = Shipment.Create(Fixture.BasicShipment); - Assert.AreEqual(tomorrow.ToString(), shipment.options.label_date.ToString()); - Assert.AreEqual("value", shipment.options.print_custom[0]["value"]); - Assert.AreEqual("name", shipment.options.print_custom[0]["name"]); - Assert.AreEqual(true, shipment.options.print_custom[0]["barcode"]); - Assert.AreEqual("THIRD_PARTY", shipment.options.payment["type"]); - Assert.AreEqual("12345", shipment.options.payment["account"]); - Assert.AreEqual("54321", shipment.options.payment["postal_code"]); - Assert.AreEqual("US", shipment.options.payment["country"]); - } + Assert.IsNotNull(shipment.rates); - [TestMethod] - public void TestPostageInline() - { - options["postage_label_inline"] = true; - Shipment shipment = BuyShipment(); - Assert.IsNotNull(shipment.postage_label.label_file); + List smartRates = shipment.GetSmartrates(); + Smartrate smartrate = smartRates.First(); + Assert.AreEqual(shipment.rates[0].id, smartrate.id); + Assert.IsNotNull(smartrate.time_in_transit.percentile_50); + Assert.IsNotNull(smartrate.time_in_transit.percentile_75); + Assert.IsNotNull(smartrate.time_in_transit.percentile_85); + Assert.IsNotNull(smartrate.time_in_transit.percentile_90); + Assert.IsNotNull(smartrate.time_in_transit.percentile_95); + Assert.IsNotNull(smartrate.time_in_transit.percentile_97); + Assert.IsNotNull(smartrate.time_in_transit.percentile_99); } [TestMethod] - public void TestRateErrorMessages() + public void TestCreateEmptyObjects() { - parameters = new Dictionary - { - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "parcel", new Dictionary - { - { - "weight", 10 - }, - { - "predefined_package", "FEDEXBOX" - } - } - } - }; - Shipment shipment = Shipment.Create(parameters); + VCR.Replay("create_empty_objects"); - Assert.IsNotNull(shipment.id); - Assert.AreEqual(shipment.messages[0].carrier, "USPS"); - Assert.AreEqual(shipment.messages[0].type, "rate_error"); - Assert.AreEqual(shipment.messages[0].message, - "Unable to retrieve USPS rates for another carrier's predefined_package parcel type."); - } + Dictionary shipmentData = Fixture.BasicShipment; - [TestMethod] - public void TestRefund() - { - Shipment shipment = BuyShipment(); - shipment.Refund(); - Assert.IsNotNull(shipment.refund_status); - } + shipmentData.Add("customs_info", new Dictionary()); + (shipmentData["customs_info"] as Dictionary).Add("customs_items", new List()); + shipmentData["options"] = null; + shipmentData["tax_identifiers"] = null; + shipmentData["reference"] = ""; - [TestMethod] - public void TestRerateShipment() - { - Shipment shipment = CreateShipmentResource(); - shipment.Create(); - shipment.rates = new List(); - Assert.AreEqual(shipment.rates.Count, 0); - shipment.RegenerateRates(); - Assert.IsNotNull(shipment.rates); - Assert.AreNotEqual(shipment.rates.Count, 0); - } + Shipment shipment = Shipment.Create(shipmentData); - [TestMethod] - public void TestRerateShipmentWithoutCreate() - { - Shipment shipment = CreateShipmentResource(); - Assert.IsNull(shipment.id); - shipment.RegenerateRates(); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); - } - - //Tax Identifiers - [TestMethod] - public void TestTaxIdentifiers() - { - parameters["tax_identifiers"] = new List - { - new TaxIdentifier - { - entity = "SENDER", - tax_id = "12345", - tax_id_type = "EORI", - issuing_country = "GB" - } - }; - Shipment shipment = Shipment.Create(parameters); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); - TaxIdentifier taxIdentifier = shipment.tax_identifiers[0]; - Assert.AreEqual("SENDER", taxIdentifier.entity); - Assert.AreEqual("HIDDEN", taxIdentifier.tax_id); - Assert.AreEqual("EORI", taxIdentifier.tax_id_type); - Assert.AreEqual("GB", taxIdentifier.issuing_country); - - Shipment retrieved = Shipment.Retrieve(shipment.id); - - TaxIdentifier retrievedTaxIdentifier = retrieved.tax_identifiers[0]; - Assert.AreEqual("SENDER", retrievedTaxIdentifier.entity); - Assert.AreEqual("HIDDEN", retrievedTaxIdentifier.tax_id); - Assert.AreEqual("EORI", retrievedTaxIdentifier.tax_id_type); - Assert.AreEqual("GB", retrievedTaxIdentifier.issuing_country); + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.IsNotNull(shipment.options); // The EasyPost API populates some default values here + Assert.IsTrue(shipment.customs_info.customs_items.Count == 0); + Assert.IsNull(shipment.reference); } - //TODO: Once we have a library for recording and replaying HTTP, assert that the following values actually match an integer [TestMethod] - public void TestTimeInTransitData() + public void TestCreateTaxIdentifiers() { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_50, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_75, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_85, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_90, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_95, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_97, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_99, typeof(int)); - } - - private Shipment BuyShipment() - { - Shipment shipment = Shipment.Create(parameters); - shipment.GetRates(); - shipment.Buy(shipment.rates.First()); - return shipment; - } + VCR.Replay("create_tax_identifiers"); - private Shipment CreateShipmentResource() - { - Address to = new Address + Dictionary shipmentData = Fixture.BasicShipment; + shipmentData["tax_identifiers"] = new List> { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; - Address from = new Address - { - name = "Andrew Tribone", - street1 = "480 Fell St", - street2 = "#3", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94102" - }; - Parcel parcel = new Parcel - { - length = 8, - width = 6, - height = 5, - weight = 10 - }; - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = new CustomsInfo - { - customs_certify = "TRUE", - eel_pfc = "NOEEI 30.37(a)", - customs_items = new List - { - item - } + Fixture.TaxIdentifier }; + Shipment shipment = Shipment.Create(shipmentData); - return new Shipment - { - to_address = to, - from_address = from, - parcel = parcel, - customs_info = info - }; + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.AreEqual("IOSS", shipment.tax_identifiers[0].tax_id_type); } } } diff --git a/EasyPost.Tests.Net/TimeoutTest.cs b/EasyPost.Tests.Net/TimeoutTest.cs deleted file mode 100644 index e14323af0..000000000 --- a/EasyPost.Tests.Net/TimeoutTest.cs +++ /dev/null @@ -1,23 +0,0 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class TimeoutTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestTimeout() - { - Client client = new Client(new ClientConfiguration("apikey")); - client.ConnectTimeoutMilliseconds = 5000; - client.RequestTimeoutMilliseconds = 5000; - - Assert.AreEqual(5000, client.ConnectTimeoutMilliseconds); - Assert.AreEqual(5000, client.RequestTimeoutMilliseconds); - } - } -} diff --git a/EasyPost.Tests.Net/TrackerTest.cs b/EasyPost.Tests.Net/TrackerTest.cs index 2a1b1e165..1f61f5938 100644 --- a/EasyPost.Tests.Net/TrackerTest.cs +++ b/EasyPost.Tests.Net/TrackerTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,63 +7,100 @@ namespace EasyPost.Tests.Net public class TrackerTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "tracker", true); + } + + private static Tracker CreateBasicTracker() + { + return Tracker.Create(Fixture.Usps, "EZ1000000001"); + } - [Ignore] [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreate() { - const string carrier = "USPS"; - const string trackingCode = "EZ1000000001"; + VCR.Replay("create"); - Tracker tracker = Tracker.Create(carrier, trackingCode); - Assert.AreEqual(tracker.tracking_code, trackingCode); - Assert.IsNotNull(tracker.est_delivery_date); - Assert.IsNotNull(tracker.carrier); - Assert.IsNotNull(tracker.public_url); + Tracker tracker = CreateBasicTracker(); - Assert.AreEqual(Tracker.Retrieve(tracker.id).id, tracker.id); + Assert.IsInstanceOfType(tracker, typeof(Tracker)); + Assert.IsTrue(tracker.id.StartsWith("trk_")); + Assert.AreEqual("pre_transit", tracker.status); } [TestMethod] - public void TestCreateTrackerList() + public void TestRetrieve() { - string[] trackingCodes = - { - "EZ1000000001", "EZ1000000002", "EZ1000000003" - }; - Dictionary trackers = new Dictionary(); + VCR.Replay("retrieve"); - for (int i = 0; i < trackingCodes.Length; i++) - { - trackers.Add(i.ToString(), new Dictionary - { - { - "tracking_code", trackingCodes[i] - }, - { - "carrier", "USPS" - } - }); - } - bool response = Tracker.CreateList(trackers); - Assert.IsTrue(response); + // Test trackers cycle through their "dummy" statuses automatically, the created and retrieved objects may differ + Tracker tracker = CreateBasicTracker(); + + Tracker retrievedTracker = Tracker.Retrieve(tracker.id); + + Assert.IsInstanceOfType(retrievedTracker, typeof(Tracker)); + Assert.AreEqual(tracker.id, retrievedTracker.id); } [TestMethod] public void TestAll() { + VCR.Replay("all"); + TrackerList trackerList = Tracker.All(new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } }); - Assert.AreNotEqual(0, trackerList.trackers.Count); - TrackerList nextTrackerList = trackerList.Next(); - Assert.AreNotEqual(trackerList.trackers[0].id, nextTrackerList.trackers[0].id); + List trackers = trackerList.trackers; + + Assert.IsTrue(trackers.Count <= Fixture.PageSize); + Assert.IsNotNull(trackerList.has_more); + foreach (var tracker in trackers) + { + Assert.IsInstanceOfType(tracker, typeof(Tracker)); + } + } + + [TestMethod] + public void TestCreateList() + { + VCR.Replay("create_list"); + + bool success = Tracker.CreateList(new Dictionary + { + { + "0", new Dictionary + { + { + "tracking_code", "EZ1000000001" + } + } + }, + { + "1", new Dictionary + { + { + "tracking_code", "EZ1000000002" + } + } + }, + { + "2", new Dictionary + { + { + "tracking_code", "EZ1000000003" + } + } + }, + }); + + // This endpoint returns nothing so we assert the function returns true + Assert.IsTrue(success); } } } diff --git a/EasyPost.Tests.Net/UserTest.cs b/EasyPost.Tests.Net/UserTest.cs index 026de9f47..c0d4d9ef5 100644 --- a/EasyPost.Tests.Net/UserTest.cs +++ b/EasyPost.Tests.Net/UserTest.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace EasyPost.Tests.Net @@ -8,72 +7,146 @@ namespace EasyPost.Tests.Net public class UserTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); + public void Initialize() + { + VCR.SetUp(VCRApiKey.Production, "user", true); + } + + private static User RetrieveMe() + { + return User.RetrieveMe(); + } + + private static User CreateUser() + { + return User.Create(new Dictionary + { + { + "name", "Test User" + } + }); + } + + // This endpoint returns the child user keys in plain text, do not run this test. + [Ignore] + [TestMethod] + public void TestCreate() + { + VCR.Replay("create"); + + User user = CreateUser(); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual("Test User", user.name); + } + + [TestMethod] + public void TestRetrieve() + { + VCR.Replay("retrieve"); + + User user = User.Retrieve(Fixture.ChildUserId); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual(Fixture.ChildUserId, user.id); + } + [TestMethod] public void TestRetrieveMe() { - User user = User.RetrieveMe(); - Assert.IsNotNull(user.id); + VCR.Replay("retrieve_me"); + + User user = RetrieveMe(); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); } [TestMethod] - public void TestRetrieveSelf() + public void TestUpdate() { - User user = User.Retrieve(); - Assert.IsNotNull(user.id); + VCR.Replay("update"); + - User user2 = User.Retrieve(user.id); - Assert.AreEqual(user.id, user2.id); + User user = RetrieveMe(); + + string testPhone = "5555555555"; + + Dictionary userDict = new Dictionary + { + { + "phone_number", testPhone + } + }; + user.Update(userDict); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual(testPhone, user.phone_number); + } + + // Due to our inability to create child users securely, we must also skip deleting them as we cannot replace the deleted ones easily. + [Ignore] + [TestMethod] + public void TestDelete() + { + VCR.Replay("delete"); + + + User user = CreateUser(); + + user.Destroy(); + } + + // API keys are returned as plaintext, do not run this test. + [Ignore] + [TestMethod] + public void TestAllApiKeys() + { + VCR.Replay("all_api_keys"); + + + User user = RetrieveMe(); + + // TODO: User doesn't have a .all_api_keys() method + List apiKeys = user.api_keys; + } + + // API keys are returned as plaintext, do not run this test. + [Ignore] + [TestMethod] + public void TestApiKeys() + { + VCR.Replay("api_keys"); + + + User user = RetrieveMe(); + + List apiKeys = user.api_keys; } [TestMethod] public void TestUpdateBrand() { - User user = User.Retrieve(); - Assert.IsNotNull(user.id); + VCR.Replay("update_brand"); + + + User user = RetrieveMe(); - const string color = "#AA4A44"; - Dictionary details = new Dictionary() + string color = "#123456"; + Brand brand = user.UpdateBrand(new Dictionary { { "color", color } - }; - Brand brand = user.UpdateBrand(details); - Assert.IsNotNull(brand); - Assert.AreEqual(user.id, brand.user_id); + }); + + Assert.IsInstanceOfType(brand, typeof(Brand)); + // TODO: Brand doesn't have an ID Assert.AreEqual(color, brand.color); } - - // [TestMethod] - // public void TestCRUD() { - // try { - // User.Create(new Dictionary() { { "name", "foo" } }); - // Assert.Fail(); - // } catch (HttpException e) { - // Assert.AreEqual("USER.INVALID", e.Code); - // Assert.AreEqual("The user record was invalid and could not be saved.", e.Message); - // Assert.AreEqual(1, e.Errors.Count); - // Assert.AreEqual("name", e.Errors[0].field); - // Assert.AreEqual("First and last name required.", e.Errors[0].message); - // } - - // User user = User.Create(new Dictionary() { { "name", "Test Name" } }); - // Assert.AreEqual(user.api_keys.Count, 2); - // Assert.IsNotNull(user.id); - - // User other = User.Retrieve(user.id); - // Assert.AreEqual(user.id, other.id); - - // user.Update(new Dictionary() { { "name", "NewTest Name" } }); - // Assert.AreEqual("NewTest Name", user.name); - - // user.Destroy(); - // try { - // User.Retrieve(user.id); - // Assert.Fail(); - // } catch (HttpException) { } - // } } } diff --git a/EasyPost.Tests.Net/VCR.cs b/EasyPost.Tests.Net/VCR.cs new file mode 100644 index 000000000..c4701bc28 --- /dev/null +++ b/EasyPost.Tests.Net/VCR.cs @@ -0,0 +1,105 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Net.Http; +using System.Runtime.CompilerServices; +using Scotch; + +namespace EasyPost.Tests.Net +{ + public enum VCRApiKey + { + Test, + Production + } + + public static class VCR + { + public static string GlobalApiKey { get; set; } + + private static string CassetteFolder { get; set; } + + private static bool _HideCredentials { get; set; } + + private static string GetSourceFileDirectory([CallerFilePath] string sourceFilePath = "") + { + return Path.GetDirectoryName(sourceFilePath); + } + + private static string GetCassettePath(string cassetteName) + { + string cassetteFolder = Path.Combine(GetSourceFileDirectory(), "cassettes"); + Directory.CreateDirectory(cassetteFolder); + if (CassetteFolder != null) + { + cassetteFolder = Path.Combine(cassetteFolder, CassetteFolder); + Directory.CreateDirectory(cassetteFolder); + } + + return Path.Combine(cassetteFolder, $"{cassetteName}.json"); + } + + private static string GetApiKey(VCRApiKey apiKey) + { + string keyName = ""; + switch (apiKey) + { + case VCRApiKey.Test: + keyName = "EASYPOST_TEST_API_KEY"; + break; + case VCRApiKey.Production: + keyName = "EASYPOST_PROD_API_KEY"; + break; + } + + return Environment.GetEnvironmentVariable(keyName) ?? "couldnotpullapikey"; // if can't pull from environment, will use a fake key. Won't matter on replay. + } + + private static HttpClient GetClient(string cassetteName, ScotchMode mode, bool? hideCredentials = null) + { + return HttpClients.NewHttpClient(GetCassettePath(cassetteName), mode, hideCredentials.GetValueOrDefault(_HideCredentials)); + } + + public static void SetUp(string apiKey = null, string cassetteFolder = null, bool hideCredentials = false) + { + CassetteFolder = cassetteFolder; + GlobalApiKey = apiKey; + _HideCredentials = hideCredentials; + } + + public static void SetUp(VCRApiKey apiKey, string cassetteFolder = null, bool hideCredentials = false) + { + SetUp(GetApiKey(apiKey), cassetteFolder, hideCredentials); + } + + public static void Record(string cassetteName, string apiKey = null, bool? hideCredentials = null) + { + ClientManager.SetCurrent(GetRecordingClientFunction(apiKey ?? GlobalApiKey, cassetteName, hideCredentials.GetValueOrDefault(_HideCredentials))); + } + + public static void Replay(string cassetteName, string apiKey = null, bool? hideCredentials = null) + { + ClientManager.SetCurrent(GetReplayingClientFunction(apiKey ?? GlobalApiKey, cassetteName, hideCredentials.GetValueOrDefault(_HideCredentials))); + } + + public static void Bypass(string cassetteName = null, string apiKey = null, bool? hideCredentials = null) + { + ClientManager.SetCurrent(GetNonVCRClientFunction(apiKey ?? GlobalApiKey)); + } + + public static Func GetRecordingClientFunction(string apiKey, string cassetteName, bool? hideCredentials = null) + { + return delegate { return new Client(new ClientConfiguration(apiKey), GetClient(cassetteName, ScotchMode.Recording, hideCredentials.GetValueOrDefault(_HideCredentials))); }; + } + + public static Func GetReplayingClientFunction(string apiKey, string cassetteName, bool? hideCredentials = null) + { + return delegate { return new Client(new ClientConfiguration(apiKey), GetClient(cassetteName, ScotchMode.Replaying, hideCredentials.GetValueOrDefault(_HideCredentials))); }; + } + + public static Func GetNonVCRClientFunction(string apiKey) + { + return delegate { return new Client(new ClientConfiguration(apiKey)); }; + } + } +} diff --git a/EasyPost.Tests.Net/WebhookTest.cs b/EasyPost.Tests.Net/WebhookTest.cs index 788a02e71..dbc5a83f6 100644 --- a/EasyPost.Tests.Net/WebhookTest.cs +++ b/EasyPost.Tests.Net/WebhookTest.cs @@ -3,32 +3,120 @@ // using Microsoft.VisualStudio.TestTools.UnitTesting; // using EasyPost; -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class WebhookTest { -// [TestInitialize] -// public void Initialize() { -// ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); -// } - -// [TestMethod] -// public void TestCRUD() { -// Webhook webhook = Webhook.Create(new Dictionary() { { "url", "https://www.foobar.com" } }); -// Assert.AreEqual(webhook.url, "https://www.foobar.com"); - -// webhook.Update(); - -// WebhookList webhooks = Webhook.All(); -// CollectionAssert.Contains(webhooks.Select(w => w.id).ToList(), webhook.id); - -// webhook.Destroy(); -// try { -// User.Retrieve(webhook.id); -// Assert.Fail(); -// } -// catch (HttpException) { } -// } -// } -// } +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +namespace EasyPost.Tests.Net +{ + [TestClass] + public class WebhookTest + { + private string webhookId = null; + [TestInitialize] + public void Initialize() + { + VCR.SetUp(VCRApiKey.Test, "webhook", true); + } + + [TestCleanup] + public void Cleanup() + { + if (webhookId != null) + { + try + { + Webhook retrievedWebhook = Webhook.Retrieve(webhookId); + retrievedWebhook.Destroy(); + webhookId = null; + } + catch + { + } + } + } + + private static Webhook CreateBasicWebhook(string url) + { + return Webhook.Create(new Dictionary + { + { + "url", url + } + }); + } + + [TestMethod] + public void TestCreate() + { + VCR.Replay("create"); + + string url = "https://testcreate.com"; + + Webhook webhook = CreateBasicWebhook(url); + + Assert.IsInstanceOfType(webhook, typeof(Webhook)); + Assert.IsTrue(webhook.id.StartsWith("hook_")); + Assert.AreEqual(url, webhook.url); + + webhookId = webhook.id; // trigger deletion + } + + [TestMethod] + public void TestRetrieve() + { + VCR.Replay("retrieve"); + + string url = "https://testretrieve.com"; + + + Webhook webhook = CreateBasicWebhook(url); + + Webhook retrievedWebhook = Webhook.Retrieve(webhook.id); + + Assert.IsInstanceOfType(retrievedWebhook, typeof(Webhook)); + Assert.AreEqual(webhook.id, retrievedWebhook.id); + + webhookId = webhook.id; // trigger deletion + } + + [TestMethod] + public void TestAll() + { + VCR.Replay("all"); + + List webhooks = Webhook.All(); + + foreach (var item in webhooks) + { + Assert.IsInstanceOfType(item, typeof(Webhook)); + } + } + + // Cannot be easily tested - requires a disabled webhook + [Ignore] + [TestMethod] + public void TestUpdate() + { + VCR.Replay("update"); + } + + [TestMethod] + public void TestDelete() + { + VCR.Replay("delete"); + + string url = "https://testdelete.com"; + + + Webhook webhook = CreateBasicWebhook(url); + Webhook retrievedWebhook = Webhook.Retrieve(webhook.id); + + bool success = retrievedWebhook.Destroy(); + + // This endpoint/method does not return anything, just make sure the request doesn't fail + Assert.IsTrue(success); + } + } +} diff --git a/EasyPost.Tests.Net/cassettes/address/all.json b/EasyPost.Tests.Net/cassettes/address/all.json new file mode 100644 index 000000000..fafb3cf6b --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/addresses?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "bc27317c621d5d8fe4d16fde004e32e0", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"a2fad713e6b6a422d67d5722be2cbc85\"", + "X-Request-ID": "d6623229-3b90-4b87-812a-ade10e5ea83d", + "x-runtime": "0.044748", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb1nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2488" + }, + "Body": "{\"addresses\":[{\"id\":\"adr_e389f71798ef11ecb7b1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:02+00:00\",\"updated_at\":\"2022-02-28T23:41:02+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},{\"id\":\"adr_e3499cbe98ef11ecb7abac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:01+00:00\",\"updated_at\":\"2022-02-28T23:41:01+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},{\"id\":\"adr_e2f56f4598ef11ecb630ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:01+00:00\",\"updated_at\":\"2022-02-28T23:41:01+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},{\"id\":\"adr_00af744898e211ecb4d6ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:38+00:00\",\"updated_at\":\"2022-02-28T22:01:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},{\"id\":\"adr_00adb3f498e211ecb917ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:38+00:00\",\"updated_at\":\"2022-02-28T22:01:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:03.136956-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/create.json b/EasyPost.Tests.Net/cassettes/address/create.json new file mode 100644 index 000000000..b5fa50456 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "189" + }, + "Body": "{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5d8de4d16fc300a3f909", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e2f56f4598ef11ecb630ac1f6bc72124", + "ETag": "W/\"b710d1e4bb21521ff20de8b43e44eacf\"", + "X-Request-ID": "e2f5202e-2c50-4a59-9e2b-39e704b1e068", + "x-runtime": "0.032063", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "453" + }, + "Body": "{\"id\":\"adr_e2f56f4598ef11ecb630ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:01+00:00\",\"updated_at\":\"2022-02-28T23:41:01+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:01.333658-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/createVerifyStrict.json b/EasyPost.Tests.Net/cassettes/address/createVerifyStrict.json new file mode 100644 index 000000000..297a196fc --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/createVerifyStrict.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses?verify_strict%5b%5d=True", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "189" + }, + "Body": "{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5d8de4d16fc400a3f922", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e3499cbe98ef11ecb7abac1f6bc7b362", + "ETag": "W/\"f0c9e6241b7bdac59970cb33288d694c\"", + "X-Request-ID": "a3640b09-224d-4168-85b6-c242d9521385", + "x-runtime": "0.048457", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "638" + }, + "Body": "{\"id\":\"adr_e3499cbe98ef11ecb7abac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:01+00:00\",\"updated_at\":\"2022-02-28T23:41:01+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:01.875071-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/create_and_verify.json b/EasyPost.Tests.Net/cassettes/address/create_and_verify.json new file mode 100644 index 000000000..0beceb6b5 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/create_and_verify.json @@ -0,0 +1,55 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses?verify_strict%5b%5d=delivery", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "212" + }, + "Body": "{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"verify_strict\":[true]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "00a24143621d5d90e4d16fe000a978de", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e4aa3fdd98ef11ecb7ddac1f6bc7b362", + "ETag": "W/\"c000091c33c4891d02fbde6618548d72\"", + "X-Request-ID": "aee8e1a1-9543-4257-9b50-a2870f9438b6", + "x-runtime": "0.044799", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,intlb1wdc 88c34981dc,extlb1wdc 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "587" + }, + "Body": "{\"id\":\"adr_e4aa3fdd98ef11ecb7ddac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:04+00:00\",\"updated_at\":\"2022-02-28T23:41:04+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:04.214501-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/create_verify.json b/EasyPost.Tests.Net/cassettes/address/create_verify.json new file mode 100644 index 000000000..103ec2b98 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/create_verify.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses?verify%5b%5d=True", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "173" + }, + "Body": "{\"address\":{\"street1\":\"417 montgomery streat\",\"street2\":\"FL 5\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94104\",\"country\":\"US\",\"company\":\"EasyPost\",\"phone\":\"415-123-4567\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "00a24145621d5d8fe4d16fdf00a978c4", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e4593e2b98ef11eca25eac1f6bc7bdc6", + "ETag": "W/\"fb5af51cb66ef437ffd20aa7e92f7c17\"", + "X-Request-ID": "5f1b6755-9574-440a-bd60-70bfbf103370", + "x-runtime": "0.058800", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,intlb1wdc 88c34981dc,extlb1wdc 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "632" + }, + "Body": "{\"id\":\"adr_e4593e2b98ef11eca25eac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:03+00:00\",\"updated_at\":\"2022-02-28T23:41:03+00:00\",\"name\":null,\"company\":\"EASYPOST\",\"street1\":\"417 MONTGOMERY ST STE 500\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94104-1100\",\"country\":\"US\",\"phone\":\"4151234567\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":false,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.79342,\"longitude\":-122.40288,\"time_zone\":\"America/Los_Angeles\"}}}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:03.685853-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/retrieve.json b/EasyPost.Tests.Net/cassettes/address/retrieve.json new file mode 100644 index 000000000..61476f26d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "189" + }, + "Body": "{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "bc273180621d5d8ee4d16fc5004e3295", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e389f71798ef11ecb7b1ac1f6bc7b362", + "ETag": "W/\"0c5e4b21d4106a7069c386c53d869455\"", + "X-Request-ID": "1ab814d6-0c27-45e9-b35f-1c5b0055b7c7", + "x-runtime": "0.032457", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb1nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "453" + }, + "Body": "{\"id\":\"adr_e389f71798ef11ecb7b1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:02+00:00\",\"updated_at\":\"2022-02-28T23:41:02+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:02.297356-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/addresses/adr_e389f71798ef11ecb7b1ac1f6bc7b362", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "bc27317d621d5d8ee4d16fdd004e32ae", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"0c5e4b21d4106a7069c386c53d869455\"", + "X-Request-ID": "0e4a1911-9c9a-4cf2-a857-9713e3c5c031", + "x-runtime": "0.027471", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb1nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "453" + }, + "Body": "{\"id\":\"adr_e389f71798ef11ecb7b1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:02+00:00\",\"updated_at\":\"2022-02-28T23:41:02+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:02.694164-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/address/verify.json b/EasyPost.Tests.Net/cassettes/address/verify.json new file mode 100644 index 000000000..7c43b7018 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/address/verify.json @@ -0,0 +1,104 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/addresses", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "189" + }, + "Body": "{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "a7c93113621d5d90e4d16fe2009c2cd7", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e4f7b1b298ef11ecb366ac1f6b0a0d1e", + "ETag": "W/\"3618e284d5ad0e3f1d3c604429ee947a\"", + "X-Request-ID": "8a46a6cc-53dd-4206-b642-f1c1cd520ef4", + "x-runtime": "0.030960", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb2nuq 88c34981dc,intlb1wdc 88c34981dc,extlb3wdc 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "453" + }, + "Body": "{\"id\":\"adr_e4f7b1b298ef11ecb366ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:04+00:00\",\"updated_at\":\"2022-02-28T23:41:04+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:04.725519-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/addresses/adr_e4f7b1b298ef11ecb366ac1f6b0a0d1e/verify", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "a7c93118621d5d91e4d16fe4009c2d06", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/addresses/adr_e547e8ad98ef11ecb7fcac1f6bc7b362", + "ETag": "W/\"17eac648cfcc40fae6c769645792ce51\"", + "X-Request-ID": "0e0ed2f3-d554-4cc6-9dd0-49055061e5b4", + "x-runtime": "0.053533", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,intlb2wdc 88c34981dc,extlb3wdc 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "650" + }, + "Body": "{\"address\":{\"id\":\"adr_e547e8ad98ef11ecb7fcac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:05+00:00\",\"updated_at\":\"2022-02-28T23:41:05+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:05.249074-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/add_remove_shipment.json b/EasyPost.Tests.Net/cassettes/batch/add_remove_shipment.json new file mode 100644 index 000000000..c6582447d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/add_remove_shipment.json @@ -0,0 +1,208 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5d97e4d1702300a3fc68", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_4bbe9d1bfc1c4772818be93c95b52a5c", + "ETag": "W/\"404be5803769687f8f864a967ebe415f\"", + "X-Request-ID": "8b15e422-c1f8-48fc-9d5b-89f52339b9b3", + "x-runtime": "1.137126", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:11Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428321\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_e93a664f98ef11ecb74aac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:11+00:00\",\"updated_at\":\"2022-02-28T23:41:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_3fb39c8738634706a693fb17edd6156e\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:11Z\",\"updated_at\":\"2022-02-28T23:41:11Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_fe893c298ffc4a98801de8ee56c6ae61\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:12Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/08af0a9ccd01417f9c45cdca9661fde3.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_c368ac229f8741eba17d5c71a56b9fcc\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_19598d5e9e0249b99ecd18607eaf4eb1\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d664bca446a14484a4ca569dd610b43c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_7bc1b7667a8e4673a15be3f87d3e8347\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_7bc1b7667a8e4673a15be3f87d3e8347\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_e409f313d9204e6eaf2a8ba563d6b255\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428321\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:12Z\",\"updated_at\":\"2022-02-28T23:41:12Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrX2U0MDlmMzEzZDkyMDRlNmVhZjJhOGJhNTYzZDZiMjU1\"},\"to_address\":{\"id\":\"adr_e938977b98ef11eca2e3ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:11+00:00\",\"updated_at\":\"2022-02-28T23:41:12+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_e93a664f98ef11ecb74aac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:11+00:00\",\"updated_at\":\"2022-02-28T23:41:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_e938977b98ef11eca2e3ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:11+00:00\",\"updated_at\":\"2022-02-28T23:41:12+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:13.029407-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "12" + }, + "Body": "{\"batch\":{}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5d99e4d1704000a3fcc5", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"da90cd0e2d691abe43e08541429b2143\"", + "X-Request-ID": "ca2b1f3c-dc2e-46bb-bb18-3c988c4b0164", + "x-runtime": "0.043362", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "383" + }, + "Body": "{\"id\":\"batch_7254643cd73b40728750a811176c9cdd\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":0,\"reference\":null,\"created_at\":\"2022-02-28T23:41:13Z\",\"updated_at\":\"2022-02-28T23:41:13Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:13.541631-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_7254643cd73b40728750a811176c9cdd/add_shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "61" + }, + "Body": "{\"shipments\":[{\"id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\"}]}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5d99e4d1704200a3fce3", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"54bc5ac53fb81d3fc14db15adfdf771a\"", + "X-Request-ID": "76275416-ef4c-4551-b5f8-ae8a8495da04", + "x-runtime": "0.042648", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "542" + }, + "Body": "{\"id\":\"batch_7254643cd73b40728750a811176c9cdd\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:13Z\",\"updated_at\":\"2022-02-28T23:41:13Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":null,\"tracking_code\":\"9400100897846109428321\",\"id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:13.952375-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_7254643cd73b40728750a811176c9cdd/remove_shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "61" + }, + "Body": "{\"shipments\":[{\"id\":\"shp_4bbe9d1bfc1c4772818be93c95b52a5c\"}]}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5d9ae4d1704400a3fd0b", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"a5c2aa77ef9ed2071635586b7323d674\"", + "X-Request-ID": "337f26bd-1c36-4671-be39-59af6eca5297", + "x-runtime": "0.041937", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "385" + }, + "Body": "{\"id\":\"batch_7254643cd73b40728750a811176c9cdd\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"purchased\",\"num_shipments\":0,\"reference\":null,\"created_at\":\"2022-02-28T23:41:13Z\",\"updated_at\":\"2022-02-28T23:41:14Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:14.378897-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/all.json b/EasyPost.Tests.Net/cassettes/batch/all.json new file mode 100644 index 000000000..6a4ee4efd --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/batches?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5d93e4d1700500a3fadf", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"360bb9b03f57117c1589d6a698fbf86e\"", + "X-Request-ID": "ba9cc871-9746-44af-b6d5-b485fcd8d929", + "x-runtime": "0.178400", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5741" + }, + "Body": "{\"batches\":[{\"id\":\"batch_f734e06ea77a4391b1ee5a1a5e9107c4\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":0,\"reference\":null,\"created_at\":\"2022-01-31T02:15:49Z\",\"updated_at\":\"2022-01-31T02:15:49Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null},{\"id\":\"batch_c5c356992c12484c9ca533de513a8e39\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":0,\"reference\":null,\"created_at\":\"2022-01-31T02:15:50Z\",\"updated_at\":\"2022-01-31T02:15:50Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null},{\"id\":\"batch_826380ae7ebe4e1bbd6180a9dd9f440f\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"label_generated\",\"num_shipments\":1,\"reference\":\"EasyPostCSharpTest\",\"created_at\":\"2022-01-31T02:15:55Z\",\"updated_at\":\"2022-01-31T02:16:00Z\",\"scan_form\":{\"id\":\"sf_64243969744e4f78bbff482a6b7418ca\",\"object\":\"ScanForm\",\"created_at\":\"2022-01-31T02:15:59Z\",\"updated_at\":\"2022-01-31T02:16:00Z\",\"tracking_codes\":[\"9405500895232104640120\"],\"address\":{\"id\":\"adr_b8c4c0b5823b11ecb836ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-01-31T02:15:55+00:00\",\"updated_at\":\"2022-01-31T02:15:55+00:00\",\"name\":\"Andrew Tribone\",\"company\":null,\"street1\":\"480 Fell St\",\"street2\":\"#3\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94102\",\"country\":\"US\",\"phone\":null,\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220131/8fe1283e1ce4491fb5f33459edb805ec.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_826380ae7ebe4e1bbd6180a9dd9f440f\",\"confirmation\":null},\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":null,\"tracking_code\":\"9405500895232104640120\",\"id\":\"shp_df2da5481f4d4f91854479eafd091db3\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/batch/20220131/ba518fafb8d443dda1d97cfc2d64cb4a.pdf\"},{\"id\":\"batch_48fc40ac244343668ffff150fe3b5829\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-01-31T02:16:24Z\",\"updated_at\":\"2022-01-31T02:16:24Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":\"ShipmentRef\",\"tracking_code\":\"9400100895232104640189\",\"id\":\"shp_24d0d20990334cff9148b03807c0472d\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":{\"id\":\"pickup_0796ef7e8deb4fd3ab7e56d0b62d38fa\",\"object\":\"Pickup\",\"created_at\":\"2022-01-31T02:16:24Z\",\"updated_at\":\"2022-01-31T02:16:24Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-02-01T02:16:24Z\",\"max_datetime\":\"2022-02-01T02:16:24Z\",\"is_account_address\":false,\"instructions\":\"In mailbox.\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_ca3c48a0823b11ecafcbac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-01-31T02:16:24+00:00\",\"updated_at\":\"2022-01-31T02:16:24+00:00\",\"name\":null,\"company\":\"Simpler Postage Inc\",\"street1\":\"164 Townsend Street\",\"street2\":\"Unit 1\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"1234567890\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-01-31T02:16:26Z\",\"updated_at\":\"2022-01-31T02:16:26Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_0796ef7e8deb4fd3ab7e56d0b62d38fa\",\"id\":\"pickuprate_01b52359e27a43018fc62876930c1ca1\",\"object\":\"PickupRate\"}]},\"label_url\":null},{\"id\":\"batch_5adad6752a9d4b2e8b23ca41eaa8047b\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-01-31T02:16:29Z\",\"updated_at\":\"2022-01-31T02:16:29Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":\"ShipmentRef\",\"tracking_code\":\"9400100895232104640196\",\"id\":\"shp_e7673da7a0334f488c937e2ef0583e19\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":{\"id\":\"pickup_b7e8780d31f144238a9fbb5e2267c055\",\"object\":\"Pickup\",\"created_at\":\"2022-01-31T02:16:29Z\",\"updated_at\":\"2022-01-31T02:16:32Z\",\"mode\":\"test\",\"status\":\"scheduled\",\"reference\":null,\"min_datetime\":\"2022-02-01T02:16:29Z\",\"max_datetime\":\"2022-02-01T02:16:29Z\",\"is_account_address\":false,\"instructions\":\"In mailbox.\",\"messages\":[],\"confirmation\":\"WTC61766216\",\"address\":{\"id\":\"adr_cd20af94823b11ecaff9ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-01-31T02:16:29+00:00\",\"updated_at\":\"2022-01-31T02:16:29+00:00\",\"name\":null,\"company\":\"Simpler Postage Inc\",\"street1\":\"164 Townsend Street\",\"street2\":\"Unit 1\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"1234567890\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-01-31T02:16:30Z\",\"updated_at\":\"2022-01-31T02:16:30Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_b7e8780d31f144238a9fbb5e2267c055\",\"id\":\"pickuprate_3d862ea6bdc54bfa969072d536b416ac\",\"object\":\"PickupRate\"}]},\"label_url\":null}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:07.177837-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/buy.json b/EasyPost.Tests.Net/cassettes/batch/buy.json new file mode 100644 index 000000000..f19f26238 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/buy.json @@ -0,0 +1,101 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "571" + }, + "Body": "{\"batch\":{\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5d93e4d1700700a3fb07", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"068dc66835810575bb62d979e45cefdd\"", + "X-Request-ID": "b2fcd9f0-3b6c-47bd-bea7-a4e8bf4c6aca", + "x-runtime": "0.040472", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "384" + }, + "Body": "{\"id\":\"batch_a03bb09ab80b4b48959ba95cd09bda31\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:07Z\",\"updated_at\":\"2022-02-28T23:41:07Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:07.606883-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_a03bb09ab80b4b48959ba95cd09bda31/buy", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5d94e4d1701f00a3fb22", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"a3e6adac66d3fd3408af9e1303c1cd3e\"", + "X-Request-ID": "1bbc558e-dee8-4c22-adf6-b4ac305d4344", + "x-runtime": "0.057280", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "524" + }, + "Body": "{\"id\":\"batch_a03bb09ab80b4b48959ba95cd09bda31\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:07Z\",\"updated_at\":\"2022-02-28T23:41:07Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"queued_for_purchase\",\"batch_message\":null,\"reference\":null,\"tracking_code\":null,\"id\":\"shp_c637cfaea5fb47f09e26060e1d8d7d17\"}],\"status\":{\"created\":1,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:08.033546-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/create.json b/EasyPost.Tests.Net/cassettes/batch/create.json new file mode 100644 index 000000000..5061b8af6 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "477" + }, + "Body": "{\"batch\":{\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5d91e4d16ffe00a3fa4c", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"2de6f5adf7967685170010cbe65f2845\"", + "X-Request-ID": "5230c51e-d323-463c-86f2-dc20e110630b", + "x-runtime": "0.041882", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "384" + }, + "Body": "{\"id\":\"batch_b78ed29485114ecb9f2b727895ebdf1f\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:05Z\",\"updated_at\":\"2022-02-28T23:41:05Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:05.704098-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/create_scan_form.json b/EasyPost.Tests.Net/cassettes/batch/create_scan_form.json new file mode 100644 index 000000000..69f9eac4e --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/create_scan_form.json @@ -0,0 +1,149 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "571" + }, + "Body": "{\"batch\":{\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5d94e4d1702000a3fb42", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"dd5d4e7a741a10e0c6953c5cc58c4dba\"", + "X-Request-ID": "fa3d1021-4401-451b-be05-97243ce11bdb", + "x-runtime": "0.141167", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "384" + }, + "Body": "{\"id\":\"batch_f158681ea94c4b0ab1e2a1ba70e78305\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:08Z\",\"updated_at\":\"2022-02-28T23:41:08Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:08.545565-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_f158681ea94c4b0ab1e2a1ba70e78305/buy", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5d94e4d1702100a3fb63", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"5716a712388e8d99c8e8d5c9c831f0ad\"", + "X-Request-ID": "205ff378-7f94-479f-bfa2-8be2e30546eb", + "x-runtime": "0.050382", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "524" + }, + "Body": "{\"id\":\"batch_f158681ea94c4b0ab1e2a1ba70e78305\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:08Z\",\"updated_at\":\"2022-02-28T23:41:08Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"queued_for_purchase\",\"batch_message\":null,\"reference\":null,\"tracking_code\":null,\"id\":\"shp_93f2c7e6a400444190de2920c9095e22\"}],\"status\":{\"created\":1,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:08.958141-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_f158681ea94c4b0ab1e2a1ba70e78305/scan_form", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5d97e4d1702200a3fc22", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"fe5a5fc5aa269129c582dbb64abe87db\"", + "X-Request-ID": "e695c4a6-9f17-4b8f-a07d-56187a9937be", + "x-runtime": "0.060156", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "856" + }, + "Body": "{\"id\":\"batch_f158681ea94c4b0ab1e2a1ba70e78305\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"purchased\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:08Z\",\"updated_at\":\"2022-02-28T23:41:11Z\",\"scan_form\":{\"id\":\"sf_96cb1ae7f2484ec8bf3f749a70eebbc6\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:41:11Z\",\"updated_at\":\"2022-02-28T23:41:11Z\",\"tracking_codes\":[],\"address\":null,\"status\":\"creating\",\"message\":null,\"form_url\":null,\"form_file_type\":null,\"batch_id\":\"batch_f158681ea94c4b0ab1e2a1ba70e78305\",\"confirmation\":null},\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":null,\"tracking_code\":\"9400100897846109428314\",\"id\":\"shp_93f2c7e6a400444190de2920c9095e22\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:11.430731-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/label.json b/EasyPost.Tests.Net/cassettes/batch/label.json new file mode 100644 index 000000000..2b98205b6 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/label.json @@ -0,0 +1,149 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "571" + }, + "Body": "{\"batch\":{\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5d9ae4d1704600a3fd2d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"5d1a7714964792cc81d79ed64c858d9f\"", + "X-Request-ID": "7bba6f09-5c3b-4f68-b391-154f68db98d2", + "x-runtime": "0.051932", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "384" + }, + "Body": "{\"id\":\"batch_db30476251e945688919a662bc7ae068\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:14Z\",\"updated_at\":\"2022-02-28T23:41:14Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:14.79856-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_db30476251e945688919a662bc7ae068/buy", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5d9be4d1704700a3fd51", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"c78b15cf5d758243fc76c3d4fdbe015b\"", + "X-Request-ID": "badc96e6-f7a9-4ab7-8d19-5034dba33306", + "x-runtime": "0.053160", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "524" + }, + "Body": "{\"id\":\"batch_db30476251e945688919a662bc7ae068\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:14Z\",\"updated_at\":\"2022-02-28T23:41:15Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"queued_for_purchase\",\"batch_message\":null,\"reference\":null,\"tracking_code\":null,\"id\":\"shp_4bec9da9ec23477ea3e735c76a55e390\"}],\"status\":{\"created\":1,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:15.225841-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches/batch_db30476251e945688919a662bc7ae068/label?file_format=ZPL", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5d9de4d1704800a3fe05", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"a94571184a286d37cc2b4b741401c536\"", + "X-Request-ID": "0e794e3c-a2a6-4ed4-a093-9f3b81bd05f9", + "x-runtime": "0.043322", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "551" + }, + "Body": "{\"id\":\"batch_db30476251e945688919a662bc7ae068\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"label_generating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:14Z\",\"updated_at\":\"2022-02-28T23:41:17Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"reference\":null,\"tracking_code\":\"9400100897846109428345\",\"id\":\"shp_4bec9da9ec23477ea3e735c76a55e390\"}],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":1,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:17.654425-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/batch/retrieve.json b/EasyPost.Tests.Net/cassettes/batch/retrieve.json new file mode 100644 index 000000000..be5ba0dfb --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/batch/retrieve.json @@ -0,0 +1,101 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/batches", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "477" + }, + "Body": "{\"batch\":{\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5d92e4d1700000a3fa7d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"872785535381d67634022179f50e7d2d\"", + "X-Request-ID": "df08c63f-2f7e-4032-bdd9-997789a53d6a", + "x-runtime": "0.048266", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "384" + }, + "Body": "{\"id\":\"batch_1a3474f70c2f4068bac816b9dcc05b43\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"creating\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:06Z\",\"updated_at\":\"2022-02-28T23:41:06Z\",\"scan_form\":null,\"shipments\":[],\"status\":{\"created\":0,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:06.11937-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/batches/batch_1a3474f70c2f4068bac816b9dcc05b43", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5d92e4d1700200a3fac7", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"33a641dc040300ac8aeb9d67d1152129\"", + "X-Request-ID": "0110b850-d508-4585-9503-44653abc7e7a", + "x-runtime": "0.114874", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "512" + }, + "Body": "{\"id\":\"batch_1a3474f70c2f4068bac816b9dcc05b43\",\"object\":\"Batch\",\"mode\":\"test\",\"state\":\"created\",\"num_shipments\":1,\"reference\":null,\"created_at\":\"2022-02-28T23:41:06Z\",\"updated_at\":\"2022-02-28T23:41:06Z\",\"scan_form\":null,\"shipments\":[{\"batch_status\":\"created\",\"batch_message\":null,\"reference\":null,\"tracking_code\":null,\"id\":\"shp_064f17ea5daa4158a8f283f64642fc52\"}],\"status\":{\"created\":1,\"queued_for_purchase\":0,\"creation_failed\":0,\"postage_purchased\":0,\"postage_purchase_failed\":0},\"pickup\":null,\"label_url\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:06.607315-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/all.json b/EasyPost.Tests.Net/cassettes/carrier_account/all.json new file mode 100644 index 000000000..006c7852e --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/carrier_accounts", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5d9fe4d1735a00a3fe7d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"87e3e258259e4da5e72aa90ef23d1e14\"", + "X-Request-ID": "617020f7-e1db-4348-8a76-fee6588a2583", + "x-runtime": "0.132099", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "3217" + }, + "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,\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{\"company_name\":{\"visibility\":\"visible\",\"label\":\"Account Holder Name\",\"value\":\"\"},\"address_street\":{\"visibility\":\"visible\",\"label\":\"Street Address\",\"value\":\"\"},\"address_city\":{\"visibility\":\"visible\",\"label\":\"City\",\"value\":\"\"},\"address_state\":{\"visibility\":\"visible\",\"label\":\"State\",\"value\":\"\"},\"address_zip\":{\"visibility\":\"visible\",\"label\":\"ZIP Code\",\"value\":\"\"},\"phone\":{\"visibility\":\"visible\",\"label\":\"Phone Number\",\"value\":\"\"},\"email\":{\"visibility\":\"visible\",\"label\":\"Email Address\",\"value\":null},\"shipper_id\":{\"visibility\":\"visible\",\"label\":\"Shipper Identifier (Optional)\",\"value\":\"\"}}},\"credentials\":{\"company_name\":\"\",\"address_street\":\"\",\"address_city\":\"\",\"address_state\":\"\",\"address_zip\":\"\",\"phone\":\"\",\"email\":null,\"shipper_id\":\"\"},\"test_credentials\":null},{\"id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T22:00:14Z\",\"updated_at\":\"2022-02-28T22:00:14Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null},{\"id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T22:00:14Z\",\"updated_at\":\"2022-02-28T22:00:14Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null},{\"id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T22:00:16Z\",\"updated_at\":\"2022-02-28T22:00:17Z\",\"description\":\"my custom description\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null},{\"id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:18Z\",\"updated_at\":\"2022-02-28T23:41:18Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null},{\"id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:18Z\",\"updated_at\":\"2022-02-28T23:41:18Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}]", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:19.58054-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/create.json b/EasyPost.Tests.Net/cassettes/carrier_account/create.json new file mode 100644 index 000000000..a2013109d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/create.json @@ -0,0 +1,53 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/carrier_accounts", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "154" + }, + "Body": "{\"carrier_account\":{\"type\":\"UpsAccount\",\"credentials\":{\"account_number\":\"A1A1A1\",\"user_id\":\"USERID\",\"password\":\"PASSWORD\",\"access_license_number\":\"ALN\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5d9ee4d1704900a3fe1f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"35629dd098e71e34093d36161e092acc\"", + "X-Request-ID": "2d8ad269-6242-4193-94a7-c7ac23d7a441", + "x-runtime": "0.133989", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "432" + }, + "Body": "{\"id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:18Z\",\"updated_at\":\"2022-02-28T23:41:18Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:18.1717-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/delete.json b/EasyPost.Tests.Net/cassettes/carrier_account/delete.json new file mode 100644 index 000000000..9d7b34400 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/delete.json @@ -0,0 +1,101 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/carrier_accounts", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "154" + }, + "Body": "{\"carrier_account\":{\"type\":\"UpsAccount\",\"credentials\":{\"account_number\":\"A1A1A1\",\"user_id\":\"USERID\",\"password\":\"PASSWORD\",\"access_license_number\":\"ALN\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5da1e4d1735d00a3ff04", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"3491a3ab4735d93d11178d63b83f8ee0\"", + "X-Request-ID": "e16a80f9-a89e-4b6e-b54c-b7cf170ed8fe", + "x-runtime": "0.136148", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "432" + }, + "Body": "{\"id\":\"ca_e69e89e9cbb54dacb5fb7ffae45ac31a\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:21Z\",\"updated_at\":\"2022-02-28T23:41:21Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:21.125161-08:00" + }, + { + "Request": { + "Method": "DELETE", + "URI": "https://api.easypost.com/v2/carrier_accounts/ca_e69e89e9cbb54dacb5fb7ffae45ac31a", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596080621d5da1e4d1735e00a3ff20", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"44136fa355b3678a1146ad16f7e8649e\"", + "X-Request-ID": "6c5d3822-1335-4601-8aff-6f194e75af4a", + "x-runtime": "0.187533", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "Body": "{}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:21.685599-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/retrieve.json b/EasyPost.Tests.Net/cassettes/carrier_account/retrieve.json new file mode 100644 index 000000000..c41252bbb --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/retrieve.json @@ -0,0 +1,101 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/carrier_accounts", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "154" + }, + "Body": "{\"carrier_account\":{\"type\":\"UpsAccount\",\"credentials\":{\"account_number\":\"A1A1A1\",\"user_id\":\"USERID\",\"password\":\"PASSWORD\",\"access_license_number\":\"ALN\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5d9ee4d1735800a3fe44", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"95c69010a089f62ed1f4f13e8f9f3c6f\"", + "X-Request-ID": "e0536be5-61e0-4f08-b128-fe5caa85be94", + "x-runtime": "0.126678", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "432" + }, + "Body": "{\"id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:18Z\",\"updated_at\":\"2022-02-28T23:41:18Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:18.671935-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/carrier_accounts/ca_8b201fc1e6f7468c882001e5fe931dc2", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596080621d5d9fe4d1735900a3fe64", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"95c69010a089f62ed1f4f13e8f9f3c6f\"", + "X-Request-ID": "74a55b31-36f8-4a22-98a8-98577d4b701a", + "x-runtime": "0.042353", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "432" + }, + "Body": "{\"id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:18Z\",\"updated_at\":\"2022-02-28T23:41:18Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:19.08831-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/types.json b/EasyPost.Tests.Net/cassettes/carrier_account/types.json new file mode 100644 index 000000000..32fefa0e0 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/types.json @@ -0,0 +1,49 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/carrier_types", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/3.1.22" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "8055d316621fba8bfb8d8be00093aca9", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"249279100011627f6d71dc2d1536ffcb\"", + "X-Request-ID": "42472340-4979-45e6-87cc-8c39fa271876", + "x-runtime": "0.028905", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202203011826-45d0115384-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb1nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "30598" + }, + "Body": "[{\"object\":\"CarrierType\",\"type\":\"AmazonMwsAccount\",\"readable\":\"Amazon MWS\",\"logo\":null,\"fields\":{\"credentials\":{\"access_key_id\":{\"visibility\":\"visible\",\"label\":\"AWS Access Key ID\"},\"secret_key\":{\"visibility\":\"password\",\"label\":\"Secret Key\"},\"merchant_id\":{\"visibility\":\"visible\",\"label\":\"Seller ID\"}}}},{\"object\":\"CarrierType\",\"type\":\"ApcAccount\",\"readable\":\"APC\",\"logo\":null,\"fields\":{\"credentials\":{\"shipper_id\":{\"visibility\":\"visible\",\"label\":\"APC Shipper ID\"},\"password\":{\"visibility\":\"password\",\"label\":\"APC Password\"},\"facility\":{\"visibility\":\"visible\",\"label\":\"APC Facility (e.g., NJ, LA)\"}}}},{\"object\":\"CarrierType\",\"type\":\"AsendiaAccount\",\"readable\":\"Asendia USA (Legacy)\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Asendia Account Number\"},\"company_name\":{\"visibility\":\"visible\",\"label\":\"Company Name\"},\"ftp_username\":{\"visibility\":\"visible\",\"label\":\"FTP Username\"},\"ftp_password\":{\"visibility\":\"password\",\"label\":\"FTP Password\"},\"prioritytracked\":{\"visibility\":\"checkbox\",\"label\":\"Priority Tracked\"},\"pmi\":{\"visibility\":\"checkbox\",\"label\":\"PMI\"},\"epacket\":{\"visibility\":\"checkbox\",\"label\":\"ePacket\"},\"internationalexpress\":{\"visibility\":\"checkbox\",\"label\":\"International Express\"},\"ipa\":{\"visibility\":\"checkbox\",\"label\":\"IPA\"},\"isal\":{\"visibility\":\"checkbox\",\"label\":\"ISAL\"},\"pmei\":{\"visibility\":\"checkbox\",\"label\":\"PMEI\"},\"other\":{\"visibility\":\"checkbox\",\"label\":\"Other\"}}}},{\"object\":\"CarrierType\",\"type\":\"AsendiaUsaAccount\",\"readable\":\"Asendia USA\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"AsendiaUsa Account Number\"},\"sub_account_number\":{\"visibility\":\"visible\",\"label\":\"AsendiaUsa Sub Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"AsendiaUsa Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"AsendiaUsa Password\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"AsendiaUsa API key\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Test AsendiaUsa Account Number\"},\"sub_account_number\":{\"visibility\":\"visible\",\"label\":\"Test AsendiaUsa Sub Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Test AsendiaUsa Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test AsendiaUsa Password\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"Test AsendiaUsa API key\"}}}},{\"object\":\"CarrierType\",\"type\":\"AustraliaPostAccount\",\"readable\":\"Australia Post\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Australia Post Account Number\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"Australia Post API Key\"},\"api_secret\":{\"visibility\":\"password\",\"label\":\"Australia Post Secret Key\"},\"print_as_you_go\":{\"visibility\":\"checkbox\",\"label\":\"Print as you go\"}}}},{\"object\":\"CarrierType\",\"type\":\"AxlehireV3Account\",\"readable\":\"AxlehireV3\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Client Secret\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Client Secret\"}}}},{\"object\":\"CarrierType\",\"type\":\"BetterTrucksAccount\",\"readable\":\"Better Trucks\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Better Trucks API key\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Test Better Trucks API key\"}}}},{\"object\":\"CarrierType\",\"type\":\"BondAccount\",\"readable\":\"Bond\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Bond API key\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Test Bond API key\"}}}},{\"object\":\"CarrierType\",\"type\":\"CanadaPostAccount\",\"readable\":\"Canada Post\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"CanadaPost API Key\"},\"contract_id\":{\"visibility\":\"visible\",\"label\":\"CanadaPost Contract ID (contract customers only)\"},\"customer_number\":{\"visibility\":\"visible\",\"label\":\"CanadaPost Customer Number\"},\"has_credit_card\":{\"visibility\":\"checkbox\",\"label\":\"CanadaPost account has credit card?\"}},\"custom_workflow\":true}},{\"object\":\"CarrierType\",\"type\":\"CanparAccount\",\"readable\":\"Canpar\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Canpar Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Canpar Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Canpar Password\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Test Canpar Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Test Canpar Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test Canpar Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"ColumbusLastMileAccount\",\"readable\":\"CDL Last Mile Solutions\",\"logo\":null,\"fields\":{\"credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"CDL Last Mile Solutions customer username\"},\"password\":{\"visibility\":\"password\",\"label\":\"CDL Last Mile Solutions customer password\"},\"tracking_code_prefix\":{\"visibility\":\"visible\",\"label\":\"CDL Last Mile Solutions tracking code prefix\"}},\"test_credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"CDL Last Mile Solutions customer test username\"},\"password\":{\"visibility\":\"password\",\"label\":\"CDL Last Mile Solutions customer test password\"},\"tracking_code_prefix\":{\"visibility\":\"visible\",\"label\":\"CDL Last Mile Solutions tracking code prefix\"}}}},{\"object\":\"CarrierType\",\"type\":\"CourierExpressAccount\",\"readable\":\"Courier Express\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Courier Express API key\"},\"shipper_id\":{\"visibility\":\"visible\",\"label\":\"Courier Express shipper ID\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Test Courier Express API key\"},\"shipper_id\":{\"visibility\":\"visible\",\"label\":\"Test Courier Express shipper ID\"}}}},{\"object\":\"CarrierType\",\"type\":\"CouriersPleaseAccount\",\"readable\":\"CouriersPlease\",\"logo\":null,\"fields\":{\"credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"Account Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"Password\"}},\"test_credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"Account Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"DaiPostAccount\",\"readable\":\"Dai Post\",\"logo\":null,\"fields\":{\"credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\" Dai Post customer username\"},\"password\":{\"visibility\":\"password\",\"label\":\" Dai Post client secret\"},\"origin_terminal\":{\"visibility\":\"visible\",\"label\":\" Dai Post default origin terminal\"},\"account_code\":{\"visibility\":\"visible\",\"label\":\" 3-letter account code for customers with multiple accounts\"}}}},{\"object\":\"CarrierType\",\"type\":\"DeutschePostUKAccount\",\"readable\":\"Deutsche Post UK\",\"logo\":null,\"fields\":{\"credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"Deutsche Post UK Client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"Deutsche Post UK Secret\"},\"account_number\":{\"visibility\":\"visible\",\"label\":\"Deutsche Post UK Account Number\"}},\"test_credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"Test Deutsche Post UK Client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"Test Deutsche Post UK Secret\"},\"account_number\":{\"visibility\":\"visible\",\"label\":\"Test Deutsche Post UK Account Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"DhlEcommerceAsiaAccount\",\"readable\":\"DHL Ecommerce Asia\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"DHL Ecommerce Asia Account Number\"},\"client_id\":{\"visibility\":\"visible\",\"label\":\"DHL Ecommerce Asia Contract Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"DHL Ecommerce Asia Password\"},\"barcode_prefix\":{\"visibility\":\"visible\",\"label\":\"DHL Ecommerce Asia Customer ID\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Test DHL Ecommerce Asia Account Number\"},\"client_id\":{\"visibility\":\"visible\",\"label\":\"Test DHL Ecommerce Asia Contract Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test DHL Ecommerce Asia Password\"},\"barcode_prefix\":{\"visibility\":\"visible\",\"label\":\"Test DHL Ecommerce Asia Customer ID\"}}}},{\"object\":\"CarrierType\",\"type\":\"DhlEcsAccount\",\"readable\":\"DHL eCommerce Solutions\",\"logo\":null,\"fields\":{\"credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"DHL eCommerce Solutions client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"DHL eCommerce Solutions client secret\"},\"pickup_id\":{\"visibility\":\"visible\",\"label\":\"DHL eCommerce Solutions pickup ID\"},\"distribution_center\":{\"visibility\":\"visible\",\"label\":\"DHL eCommerce Solutions distribution center\"}},\"test_credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"Test DHL eCommerce Solutions client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"Test DHL eCommerce Solutions client secret\"},\"pickup_id\":{\"visibility\":\"visible\",\"label\":\"Test DHL eCommerce Solutions pickup ID\"},\"distribution_center\":{\"visibility\":\"visible\",\"label\":\"Test DHL eCommerce Solutions distribution center\"}}}},{\"object\":\"CarrierType\",\"type\":\"DhlExpressAccount\",\"readable\":\"DHL Express\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"DHL Account Number\"},\"country\":{\"visibility\":\"visible\",\"label\":\"Account Country Code (2 Letter)\"},\"site_id\":{\"visibility\":\"visible\",\"label\":\"Site ID (Optional)\"},\"password\":{\"visibility\":\"password\",\"label\":\"Password (Optional)\"},\"is_reseller\":{\"visibility\":\"checkbox\",\"label\":\"Reseller Account? (check if yes)\"}}}},{\"object\":\"CarrierType\",\"type\":\"DhlParcelAccount\",\"readable\":\"DHL Parcel\",\"logo\":null,\"fields\":{\"credentials\":{\"user_id\":{\"visibility\":\"visible\",\"label\":\"DHL Parcel User ID\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"DHL Parcel API Key\"},\"account_number\":{\"visibility\":\"visible\",\"label\":\"DHL Parcel Account Number\"}},\"test_credentials\":{\"user_id\":{\"visibility\":\"visible\",\"label\":\"DHL Parcel User ID\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"DHL Parcel API Key\"},\"account_number\":{\"visibility\":\"visible\",\"label\":\"DHL Parcel Account Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"DpdAccount\",\"readable\":\"DPD\",\"logo\":null,\"fields\":{\"credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"WebConnect Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"WebConnect Password\"},\"customer_number\":{\"visibility\":\"visible\",\"label\":\"DPD Customer Number\"}},\"test_credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"Test WebConnect Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test WebConnect Password\"},\"customer_number\":{\"visibility\":\"visible\",\"label\":\"DPD Customer Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"DpdUkAccount\",\"readable\":\"DPD UK\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"DPD UK Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"DPD UK Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"DPD UK Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"EstafetaAccount\",\"readable\":\"Estafeta\",\"logo\":null,\"fields\":{\"credentials\":{\"customer_id\":{\"visibility\":\"visible\",\"label\":\"Subscriber ID\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Login\"},\"password\":{\"visibility\":\"password\",\"label\":\"Password\"},\"client_id\":{\"visibility\":\"visible\",\"label\":\"Tracking Subscriber ID\"},\"user_id\":{\"visibility\":\"visible\",\"label\":\"Tracking Login\"},\"secret_key\":{\"visibility\":\"password\",\"label\":\"Tracking Password\"},\"customer_number\":{\"visibility\":\"visible\",\"label\":\"Customer Number\"},\"hub_id\":{\"visibility\":\"visible\",\"label\":\"Office Number\"}},\"test_credentials\":{\"customer_id\":{\"visibility\":\"visible\",\"label\":\"Test Subscriber ID\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Test Login\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test Password\"},\"client_id\":{\"visibility\":\"visible\",\"label\":\"Test Tracking Subscriber ID\"},\"user_id\":{\"visibility\":\"visible\",\"label\":\"Test Tracking Login\"},\"secret_key\":{\"visibility\":\"password\",\"label\":\"Test Tracking Password\"},\"customer_number\":{\"visibility\":\"visible\",\"label\":\"Test Customer Number\"},\"hub_id\":{\"visibility\":\"visible\",\"label\":\"Test Office Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"FastwayAccount\",\"readable\":\"Fastway\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"API Key\"}}}},{\"object\":\"CarrierType\",\"type\":\"FedexAccount\",\"readable\":\"FedEx\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"FedEx Account Number\"},\"meter_number\":{\"visibility\":\"invisible\",\"label\":\"FedEx Production Meter Number\"},\"key\":{\"visibility\":\"invisible\",\"label\":\"FedEx Production Authentication Key\"},\"password\":{\"visibility\":\"invisible\",\"label\":\"FedEx Production Password\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"FedEx Account Number\"},\"meter_number\":{\"visibility\":\"invisible\",\"label\":\"FedEx Test Meter Number\"},\"key\":{\"visibility\":\"invisible\",\"label\":\"FedEx Developer Test Key\"},\"password\":{\"visibility\":\"invisible\",\"label\":\"FedEx Test Password\"}},\"creation_fields\":{\"credential_information\":{\"account_number\":{\"label\":\"FedEx Account #\",\"visibility\":\"visible\"}},\"company_information\":{\"corporate_first_name\":{\"label\":\"Company Contact First Name\",\"visibility\":\"visible\"},\"corporate_last_name\":{\"label\":\"Company Contact Last Name\",\"visibility\":\"visible\"},\"corporate_job_title\":{\"label\":\"Company Contact Job Title\",\"visibility\":\"visible\"},\"corporate_company_name\":{\"label\":\"Company Name\",\"visibility\":\"visible\"},\"corporate_phone_number\":{\"label\":\"Company Phone\",\"visibility\":\"visible\"},\"corporate_email_address\":{\"label\":\"Company Email\",\"visibility\":\"visible\"},\"corporate_streets\":{\"label\":\"Company Street\",\"visibility\":\"visible\"},\"corporate_city\":{\"label\":\"Company City\",\"visibility\":\"visible\"},\"corporate_state\":{\"label\":\"Company State\",\"visibility\":\"visible\"},\"corporate_postal_code\":{\"label\":\"Company Postal Code\",\"visibility\":\"visible\"},\"corporate_country_code\":{\"label\":\"Company Country Code\",\"visibility\":\"visible\"}},\"address_information\":{\"shipping_streets\":{\"label\":\"Shipping Street\",\"visibility\":\"visible\"},\"shipping_city\":{\"label\":\"Shipping City\",\"visibility\":\"visible\"},\"shipping_state\":{\"label\":\"Shipping State\",\"visibility\":\"visible\"},\"shipping_postal_code\":{\"label\":\"Shipping Postal Code \",\"visibility\":\"visible\"},\"shipping_country_code\":{\"label\":\"Shipping Country Code\",\"visibility\":\"visible\"}}},\"custom_workflow\":true}},{\"object\":\"CarrierType\",\"type\":\"FedexCrossBorderAccount\",\"readable\":\"FedEx Cross Border\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"FedEx Cross Border API key\"},\"origin_hub\":{\"visibility\":\"select\",\"label\":\"FedEx Cross Border Origin Hub\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Test FedEx Cross Border API key\"},\"origin_hub\":{\"visibility\":\"select\",\"label\":\"Test FedEx Cross Border Origin Hub\"}}}},{\"object\":\"CarrierType\",\"type\":\"FedexMailviewAccount\",\"readable\":\"FedEx MailView\",\"logo\":null,\"fields\":{\"credentials\":{\"customer_id\":{\"visibility\":\"visible\",\"label\":\"Customer Code\"},\"service_id\":{\"visibility\":\"password\",\"label\":\"Service ID\"},\"fimspremium\":{\"visibility\":\"checkbox\",\"label\":\"FIMS Premium\"},\"fimsstandard\":{\"visibility\":\"checkbox\",\"label\":\"FIMS Standard\"},\"mailviewpremium\":{\"visibility\":\"checkbox\",\"label\":\"MailView Premium\"},\"mailviewlight\":{\"visibility\":\"checkbox\",\"label\":\"MailView Light\"}}}},{\"object\":\"CarrierType\",\"type\":\"FedexSamedayCityAccount\",\"readable\":\"FedEx SameDay City\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"FedEx SameDay City Account Number\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"FedEx SameDay City Shipment API Key\"},\"tracking_api_key\":{\"visibility\":\"masked\",\"label\":\"FedEx SameDay City Tracking API Key\"}}}},{\"object\":\"CarrierType\",\"type\":\"FedexSmartpostAccount\",\"readable\":\"FedEx SmartPost\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"FedEx SmartPost Account Number\"},\"hub_id\":{\"visibility\":\"visible\",\"label\":\"FedEx SmartPost HubID\"},\"meter_number\":{\"visibility\":\"visible\",\"label\":\"Fedex SmartPost Meter Number\"},\"key\":{\"visibility\":\"masked\",\"label\":\"FedEx SmartPost Access Key\"},\"password\":{\"visibility\":\"password\",\"label\":\"SmartPost Access Key Password\"}},\"creation_fields\":{\"credential_information\":{\"account_number\":{\"label\":\"FedEx SmartPost Account #\",\"visibility\":\"visible\"},\"hub_id\":{\"label\":\"FedEx SmartPost Hub ID\",\"visibility\":\"visible\"}},\"company_information\":{\"corporate_first_name\":{\"label\":\"Company Contact First Name\",\"visibility\":\"visible\"},\"corporate_last_name\":{\"label\":\"Company Contact Last Name\",\"visibility\":\"visible\"},\"corporate_job_title\":{\"label\":\"Company Contact Job Title\",\"visibility\":\"visible\"},\"corporate_company_name\":{\"label\":\"Company Name\",\"visibility\":\"visible\"},\"corporate_phone_number\":{\"label\":\"Company Phone\",\"visibility\":\"visible\"},\"corporate_email_address\":{\"label\":\"Company Email\",\"visibility\":\"visible\"},\"corporate_streets\":{\"label\":\"Company Street\",\"visibility\":\"visible\"},\"corporate_city\":{\"label\":\"Company City\",\"visibility\":\"visible\"},\"corporate_state\":{\"label\":\"Company State\",\"visibility\":\"visible\"},\"corporate_postal_code\":{\"label\":\"Company Postal Code\",\"visibility\":\"visible\"},\"corporate_country_code\":{\"label\":\"Company Country Code\",\"visibility\":\"visible\"}},\"address_information\":{\"shipping_streets\":{\"label\":\"Shipping Street\",\"visibility\":\"visible\"},\"shipping_city\":{\"label\":\"Shipping City\",\"visibility\":\"visible\"},\"shipping_state\":{\"label\":\"Shipping State\",\"visibility\":\"visible\"},\"shipping_postal_code\":{\"label\":\"Shipping Postal Code \",\"visibility\":\"visible\"},\"shipping_country_code\":{\"label\":\"Shipping Country Code\",\"visibility\":\"visible\"}}},\"custom_workflow\":true}},{\"object\":\"CarrierType\",\"type\":\"GlobegisticsAccount\",\"readable\":\"Globegistics\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Globegistics Account Number\"},\"facility\":{\"visibility\":\"visible\",\"label\":\"Globegistics Facility\"}}}},{\"object\":\"CarrierType\",\"type\":\"GsoAccount\",\"readable\":\"GSO\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"GSO Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"HermesAccount\",\"readable\":\"Hermes\",\"logo\":null,\"fields\":{\"credentials\":{\"username\":{\"visibility\":\"visible\",\"label\":\"Hermes Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Hermes Password\"},\"client_id\":{\"visibility\":\"visible\",\"label\":\"Hermes Client ID\"},\"client_name\":{\"visibility\":\"visible\",\"label\":\"Hermes Client name\"},\"group_id\":{\"visibility\":\"visible\",\"label\":\"Hermes Group ID\"},\"client_licence\":{\"visibility\":\"masked\",\"label\":\"Hermes Client License\"}}}},{\"object\":\"CarrierType\",\"type\":\"InterlinkExpressAccount\",\"readable\":\"Interlink Express\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Interlink Express Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Interlink Express Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Interlink Express Password\"},\"vat_number\":{\"visibility\":\"visible\",\"label\":\"VAT Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"LasershipV2Account\",\"readable\":\"LaserShipV2\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"LaserShipV2 API Key\"},\"api_id\":{\"visibility\":\"visible\",\"label\":\"LaserShipV2 API ID\"},\"facility\":{\"visibility\":\"visible\",\"label\":\"LaserShipV2 Customer Branch\"},\"cargo_claim_value\":{\"visibility\":\"visible\",\"label\":\"LaserShipV2 Cargo Insurance Claim Value (USD)\"},\"is_reseller\":{\"visibility\":\"checkbox\",\"label\":\"3PL Account? (check if yes)\"},\"injection_location_type\":{\"visibility\":\"visible\",\"label\":\"Injection Address Location Type (\\\"Business\\\" or \\\"Residence\\\")\"},\"injection_contact\":{\"visibility\":\"visible\",\"label\":\"Injection Address Contact\"},\"injection_organization\":{\"visibility\":\"visible\",\"label\":\"Injection Address Organization\"},\"injection_street1\":{\"visibility\":\"visible\",\"label\":\"Injection Address Street1\"},\"injection_street2\":{\"visibility\":\"visible\",\"label\":\"Injection Address Street2\"},\"injection_city\":{\"visibility\":\"visible\",\"label\":\"Injection Address City\"},\"injection_state\":{\"visibility\":\"visible\",\"label\":\"Injection Address State\"},\"injection_zip\":{\"visibility\":\"visible\",\"label\":\"Injection Address Postal Code\"},\"injection_country\":{\"visibility\":\"visible\",\"label\":\"Injection Address Country Code\"},\"injection_phone\":{\"visibility\":\"visible\",\"label\":\"Injection Address Phone\"},\"injection_phone_ext\":{\"visibility\":\"visible\",\"label\":\"Injection Address Phone Extension\"},\"injection_email\":{\"visibility\":\"visible\",\"label\":\"Injection Address Email\"},\"injection_instruction\":{\"visibility\":\"visible\",\"label\":\"Injection Address Instruction\"},\"injection_note\":{\"visibility\":\"visible\",\"label\":\"Injection Address Note\"}}}},{\"object\":\"CarrierType\",\"type\":\"LoomisExpressAccount\",\"readable\":\"Loomis Express\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Loomis Express Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Loomis Express Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Loomis Express Password\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Test Loomis Express Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Test Loomis Express Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test Loomis Express Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"LsoAccount\",\"readable\":\"LSO\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"LSO Production Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"LSO Production Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"LSO Production Password\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"LSO Test Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"LSO Test Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"LSO Test Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"NewgisticsAccount\",\"readable\":\"Newgistics\",\"logo\":null,\"fields\":{\"credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"Client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"Client Secret\"},\"client_facility_id\":{\"visibility\":\"visible\",\"label\":\"Client Facility ID\"},\"fulfiller_facility_id\":{\"visibility\":\"visible\",\"label\":\"Newgistics Facility ID\"},\"tracking_api_key\":{\"visibility\":\"masked\",\"label\":\"Tracking API Key\"},\"merchant_id\":{\"visibility\":\"visible\",\"label\":\"Merchant ID\"}},\"test_credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"Client ID\"},\"client_secret\":{\"visibility\":\"password\",\"label\":\"Client Secret\"},\"client_facility_id\":{\"visibility\":\"visible\",\"label\":\"Client Facility ID\"},\"fulfiller_facility_id\":{\"visibility\":\"visible\",\"label\":\"Newgistics Facility ID\"},\"tracking_api_key\":{\"visibility\":\"masked\",\"label\":\"Tracking API Key\"},\"merchant_id\":{\"visibility\":\"visible\",\"label\":\"Merchant ID\"}}}},{\"object\":\"CarrierType\",\"type\":\"OmniParcelAccount\",\"readable\":\"OmniParcel\",\"logo\":null,\"fields\":{\"credentials\":{\"api_access_key\":{\"visibility\":\"masked\",\"label\":\"API Access Key\"},\"return_api_access_key\":{\"visibility\":\"masked\",\"label\":\"Return API Access Key\"}},\"test_credentials\":{\"api_access_key\":{\"visibility\":\"masked\",\"label\":\"Test API Access Key\"},\"return_api_access_key\":{\"visibility\":\"masked\",\"label\":\"Test Return API Access Key\"}}}},{\"object\":\"CarrierType\",\"type\":\"OntracAccount\",\"readable\":\"OnTrac\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"OnTrac Account Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"OnTrac API Password\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"OnTrac Test Account Number\"},\"password\":{\"visibility\":\"password\",\"label\":\"OnTrac Test API Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"OsmWorldwideAccount\",\"readable\":\"OSM Worldwide\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Account Number\"},\"mailer_id\":{\"visibility\":\"visible\",\"label\":\"Mailer ID\"},\"facility_code\":{\"visibility\":\"visible\",\"label\":\"Facility Code/Cost Center ID for manifesting (optional)\"},\"company_name\":{\"visibility\":\"visible\",\"label\":\"Company Name\"},\"aws_sftp_username\":{\"visibility\":\"visible\",\"label\":\"SFTP Username\"}}}},{\"object\":\"CarrierType\",\"type\":\"ParcelForceAccount\",\"readable\":\"Parcel Force\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Parcelforce Contract Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"expressLink API Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"expressLink API Password\"},\"department_id\":{\"visibility\":\"visible\",\"label\":\"Department ID - not required\"}},\"test_credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Parcelforce Test Contract Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"Test expressLink API Username\"},\"password\":{\"visibility\":\"password\",\"label\":\"Test expressLink API Password\"},\"department_id\":{\"visibility\":\"visible\",\"label\":\"Test Department ID - not required\"}}}},{\"object\":\"CarrierType\",\"type\":\"PassportGlobalAccount\",\"readable\":\"Passport Global\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Passport Global API key\"},\"email\":{\"visibility\":\"visible\",\"label\":\"Customer email address registered with Passport Global\"},\"name\":{\"visibility\":\"visible\",\"label\":\"Customer name registered with Passport Global\"},\"company_name\":{\"visibility\":\"visible\",\"label\":\"Customer company name registered with Passport Global\"},\"phone\":{\"visibility\":\"visible\",\"label\":\"Customer phone number registered with Passport Global (optional)\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Passport Global Test API key\"},\"email\":{\"visibility\":\"visible\",\"label\":\"Customer email address registered with Passport Global\"},\"name\":{\"visibility\":\"visible\",\"label\":\"Customer name registered with Passport Global\"},\"company_name\":{\"visibility\":\"visible\",\"label\":\"Customer company name registered with Passport Global\"},\"phone\":{\"visibility\":\"visible\",\"label\":\"Customer phone number registered with Passport Global (optional)\"}}}},{\"object\":\"CarrierType\",\"type\":\"PcfFinalMileAccount\",\"readable\":\"PCF Final Mile\",\"logo\":null,\"fields\":{\"credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"PCF client ID\"},\"key\":{\"visibility\":\"masked\",\"label\":\"PCF API key\"}},\"test_credentials\":{\"client_id\":{\"visibility\":\"visible\",\"label\":\"PCF test client ID\"},\"key\":{\"visibility\":\"masked\",\"label\":\"PCF test API key\"}}}},{\"object\":\"CarrierType\",\"type\":\"PurolatorAccount\",\"readable\":\"Purolator\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Purolator Account Number\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"Production API Key\"},\"password\":{\"visibility\":\"password\",\"label\":\"Production API Key Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"RoyalMailAccount\",\"readable\":\"Royal Mail\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Royal Mail Account Number\"},\"username\":{\"visibility\":\"visible\",\"label\":\"OBA Email Address\"},\"posting_location_number\":{\"visibility\":\"visible\",\"label\":\"Posting Location Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"RRDonnelleyAccount\",\"readable\":\"ePost Global\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"ePostGlobal Account Number\"}}}},{\"object\":\"CarrierType\",\"type\":\"SfExpressAccount\",\"readable\":\"SF Express\",\"logo\":null,\"fields\":{\"credentials\":{\"checkword\":{\"visibility\":\"visible\",\"label\":\"SF Express checkword\"},\"customer_code\":{\"visibility\":\"visible\",\"label\":\"SF Express customer code\"},\"customer_id\":{\"visibility\":\"visible\",\"label\":\"SF Express customer id\"}},\"test_credentials\":{\"checkword\":{\"visibility\":\"visible\",\"label\":\"Test SF Express checkword\"},\"customer_code\":{\"visibility\":\"visible\",\"label\":\"Test SF Express customer code\"},\"customer_id\":{\"visibility\":\"visible\",\"label\":\"Test SF Express customer id\"}}}},{\"object\":\"CarrierType\",\"type\":\"SpeedeeAccount\",\"readable\":\"Spee-Dee\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"Spee-Dee Account Number\"},\"ftp_username\":{\"visibility\":\"visible\",\"label\":\"Spee-Dee FTP Username\"},\"ftp_password\":{\"visibility\":\"password\",\"label\":\"Spee-Dee FTP Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"StarTrackAccount\",\"readable\":\"StarTrack\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"StarTrack Account Number\"},\"api_key\":{\"visibility\":\"masked\",\"label\":\"StarTrack API Key\"},\"api_secret\":{\"visibility\":\"password\",\"label\":\"StarTrack Secret Key\"},\"print_as_you_go\":{\"visibility\":\"checkbox\",\"label\":\"Print as you go\"}}}},{\"object\":\"CarrierType\",\"type\":\"UdsAccount\",\"readable\":\"UDS\",\"logo\":null,\"fields\":{\"credentials\":{\"ftp_username\":{\"visibility\":\"visible\",\"label\":\"FTP Username\"},\"ftp_password\":{\"visibility\":\"password\",\"label\":\"FTP Password\"}}}},{\"object\":\"CarrierType\",\"type\":\"UpsAccount\",\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"access_license_number\":{\"visibility\":\"invisible\",\"label\":\"UPS Access License Number\"},\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\"},\"user_id\":{\"visibility\":\"invisible\",\"label\":\"UPS.com User ID\"},\"password\":{\"visibility\":\"invisible\",\"label\":\"UPS.com Password\"}},\"custom_workflow\":true}},{\"object\":\"CarrierType\",\"type\":\"UpsIparcelAccount\",\"readable\":\"UPS i-Parcel\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"i-Parcel API key\"}}}},{\"object\":\"CarrierType\",\"type\":\"UpsMailInnovationsAccount\",\"readable\":\"UPS Mail Innovations\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"visible\",\"label\":\"UPS Shipper Number\"},\"user_id\":{\"visibility\":\"visible\",\"label\":\"UPS.com User ID\"},\"password\":{\"visibility\":\"password\",\"label\":\"UPS.com Password\"},\"customer_id\":{\"visibility\":\"visible\",\"label\":\"UPS customer id (optional)\"},\"customer_guid\":{\"visibility\":\"visible\",\"label\":\"UPS customer GUID (optional)\"}}}},{\"object\":\"CarrierType\",\"type\":\"UspsAccount\",\"readable\":\"USPS\",\"logo\":null,\"fields\":{\"credentials\":{\"company_name\":{\"visibility\":\"visible\",\"label\":\"Account Holder Name\"},\"address_street\":{\"visibility\":\"visible\",\"label\":\"Street Address\"},\"address_city\":{\"visibility\":\"visible\",\"label\":\"City\"},\"address_state\":{\"visibility\":\"visible\",\"label\":\"State\"},\"address_zip\":{\"visibility\":\"visible\",\"label\":\"ZIP Code\"},\"phone\":{\"visibility\":\"visible\",\"label\":\"Phone Number\"},\"email\":{\"visibility\":\"visible\",\"label\":\"Email Address\"},\"shipper_id\":{\"visibility\":\"visible\",\"label\":\"Shipper Identifier (Optional)\"}}}},{\"object\":\"CarrierType\",\"type\":\"VehoAccount\",\"readable\":\"Veho\",\"logo\":null,\"fields\":{\"credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Veho Production API Key\"}},\"test_credentials\":{\"api_key\":{\"visibility\":\"masked\",\"label\":\"Veho Test API Key\"}}}}]", + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-03-02T10:42:19.120425-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/carrier_account/update.json b/EasyPost.Tests.Net/cassettes/carrier_account/update.json new file mode 100644 index 000000000..4f6819b91 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/carrier_account/update.json @@ -0,0 +1,104 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/carrier_accounts", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "154" + }, + "Body": "{\"carrier_account\":{\"type\":\"UpsAccount\",\"credentials\":{\"account_number\":\"A1A1A1\",\"user_id\":\"USERID\",\"password\":\"PASSWORD\",\"access_license_number\":\"ALN\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5da0e4d1735b00a3fea4", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"635a0e3306afc557b350d7859dcf33ab\"", + "X-Request-ID": "00aeef17-ac77-4321-8e56-8ae88373a309", + "x-runtime": "0.140514", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "432" + }, + "Body": "{\"id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:20Z\",\"updated_at\":\"2022-02-28T23:41:20Z\",\"description\":\"UPS Account\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:20.090883-08:00" + }, + { + "Request": { + "Method": "PUT", + "URI": "https://api.easypost.com/v2/carrier_accounts/ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "59" + }, + "Body": "{\"carrier_account\":{\"description\":\"my custom description\"}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5da0e4d1735c00a3fed5", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"d8a67c90da0327286414e04cba905965\"", + "X-Request-ID": "0ba233d7-9fa7-4347-8f7e-d2598e09605b", + "x-runtime": "0.139635", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "442" + }, + "Body": "{\"id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"object\":\"CarrierAccount\",\"type\":\"UpsAccount\",\"clone\":false,\"created_at\":\"2022-02-28T23:41:20Z\",\"updated_at\":\"2022-02-28T23:41:20Z\",\"description\":\"my custom description\",\"reference\":null,\"readable\":\"UPS\",\"logo\":null,\"fields\":{\"credentials\":{\"account_number\":{\"visibility\":\"readonly\",\"label\":\"UPS Account Number\",\"value\":\"A1A1A1\"}}},\"credentials\":{\"account_number\":\"A1A1A1\"},\"test_credentials\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:20.597029-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/customs_info/create.json b/EasyPost.Tests.Net/cassettes/customs_info/create.json new file mode 100644 index 000000000..bb2330feb --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/customs_info/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/customs_infos", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "351" + }, + "Body": "{\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5da2e4d1735f00a3ff41", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/customs_infos/cstinfo_b20e8e5006c044e49300af82fb125d8f", + "ETag": "W/\"e4e3327c1d3faf55e88cb66fc68903bd\"", + "X-Request-ID": "c40e8116-208b-4e7f-b0bd-65ac54c4a374", + "x-runtime": "0.043837", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "797" + }, + "Body": "{\"id\":\"cstinfo_b20e8e5006c044e49300af82fb125d8f\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_0b560c0d19d9484f9b22ef2f05455388\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:22.110585-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/customs_info/retrieve.json b/EasyPost.Tests.Net/cassettes/customs_info/retrieve.json new file mode 100644 index 000000000..f9fdbd7c3 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/customs_info/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/customs_infos", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "351" + }, + "Body": "{\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5da2e4d1736000a3ff5a", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/customs_infos/cstinfo_76398b08a5164ee28316212e968ca269", + "ETag": "W/\"62f8f4c5942d05db8884456f0557669b\"", + "X-Request-ID": "01b07587-cafa-414f-9ca3-759d490a75b0", + "x-runtime": "0.039232", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "797" + }, + "Body": "{\"id\":\"cstinfo_76398b08a5164ee28316212e968ca269\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_99e02966535e4ee9b10bd712db8da434\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:22.52918-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/customs_infos/cstinfo_76398b08a5164ee28316212e968ca269", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5da2e4d1736100a3ff72", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"62f8f4c5942d05db8884456f0557669b\"", + "X-Request-ID": "edb8450c-b043-459c-9df4-ab2528d1d939", + "x-runtime": "0.031408", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "797" + }, + "Body": "{\"id\":\"cstinfo_76398b08a5164ee28316212e968ca269\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_99e02966535e4ee9b10bd712db8da434\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:22Z\",\"updated_at\":\"2022-02-28T23:41:22Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:22.937926-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/customs_item/create.json b/EasyPost.Tests.Net/cassettes/customs_item/create.json new file mode 100644 index 000000000..c16c3b9c7 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/customs_item/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/customs_items", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "133" + }, + "Body": "{\"customs_item\":{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5da3e4d1737900a3ff91", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/customs_items/cstitem_9d64031a33834144bbf56e495255f37e", + "ETag": "W/\"9613b5cc91c07cf86b4c63d94621e3ae\"", + "X-Request-ID": "35f14d01-ccac-4fcb-9990-ecf02bb47e02", + "x-runtime": "0.025928", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "375" + }, + "Body": "{\"id\":\"cstitem_9d64031a33834144bbf56e495255f37e\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:23Z\",\"updated_at\":\"2022-02-28T23:41:23Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:23.330809-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/customs_item/retrieve.json b/EasyPost.Tests.Net/cassettes/customs_item/retrieve.json new file mode 100644 index 000000000..51b2e8302 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/customs_item/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/customs_items", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "133" + }, + "Body": "{\"customs_item\":{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5da3e4d1737a00a3ffab", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/customs_items/cstitem_37562e7965d64742bdc727c34618aaca", + "ETag": "W/\"2b1edda3744eb734e81b238b4f1cd0c1\"", + "X-Request-ID": "80d957e7-926c-4f55-9d84-f719b3f0c1bd", + "x-runtime": "0.025591", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "375" + }, + "Body": "{\"id\":\"cstitem_37562e7965d64742bdc727c34618aaca\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:23Z\",\"updated_at\":\"2022-02-28T23:41:23Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:23.721921-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/customs_items/cstitem_37562e7965d64742bdc727c34618aaca", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5da4e4d1737b00a3ffc8", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"2b1edda3744eb734e81b238b4f1cd0c1\"", + "X-Request-ID": "a92c0bff-6286-4e89-881d-e5038f5f4be0", + "x-runtime": "0.079554", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "375" + }, + "Body": "{\"id\":\"cstitem_37562e7965d64742bdc727c34618aaca\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:41:23Z\",\"updated_at\":\"2022-02-28T23:41:23Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:24.18186-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/error/error.json b/EasyPost.Tests.Net/cassettes/error/error.json new file mode 100644 index 000000000..7bd47db4e --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/error/error.json @@ -0,0 +1,52 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "15" + }, + "Body": "{\"shipment\":{}}" + }, + "Response": { + "Status": { + "Code": 422, + "Message": "Unprocessable Entity" + }, + "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": "5f596087621d5da5e4d1737d00a3ffff", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "X-Request-ID": "7d331066-3b66-4bcc-8b16-236e45b1403d", + "x-runtime": "0.016677", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "211" + }, + "Body": "{\"error\":{\"code\":\"SHIPMENT.INVALID_PARAMS\",\"message\":\"Unable to create shipment, one or more parameters were invalid.\",\"errors\":[{\"to_address\":\"Required and missing.\"},{\"from_address\":\"Required and missing.\"}]}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:25.115692-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/event/all.json b/EasyPost.Tests.Net/cassettes/event/all.json new file mode 100644 index 000000000..13d1b5dfe --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/event/all.json @@ -0,0 +1,51 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/events?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5da5e4d1737e00a40014", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"f23223127e654665c102cd101a95c50c\"", + "X-Request-ID": "bc7a2772-eb44-4009-8c71-5d8df09e6836", + "x-runtime": "0.304967", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1108" + }, + "Body": "{\"events\":[{\"description\":\"batch.updated\",\"id\":\"evt_eda2c93e98ef11ecb85f23282eb4e9bf\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:19.311Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_ecb68f0698ef11ec982359f340dbb366\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:17.763Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_ebd406ae98ef11ec8aea0b22dc9c4881\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:16.278Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_eb16369298ef11eca46c7751dd02e3ed\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:15.034Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.created\",\"id\":\"evt_eb03529898ef11ec83b0054d842a494d\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:14.911Z\",\"mode\":\"test\",\"object\":\"Event\"}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:25.827777-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/event/retrieve.json b/EasyPost.Tests.Net/cassettes/event/retrieve.json new file mode 100644 index 000000000..0f70dffc5 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/event/retrieve.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/events?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5da6e4d1738100a4003d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"f23223127e654665c102cd101a95c50c\"", + "X-Request-ID": "0c4f10cc-b138-4f1c-b0a3-b36b67ac419c", + "x-runtime": "0.199479", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1108" + }, + "Body": "{\"events\":[{\"description\":\"batch.updated\",\"id\":\"evt_eda2c93e98ef11ecb85f23282eb4e9bf\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:19.311Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_ecb68f0698ef11ec982359f340dbb366\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:17.763Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_ebd406ae98ef11ec8aea0b22dc9c4881\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:16.278Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.updated\",\"id\":\"evt_eb16369298ef11eca46c7751dd02e3ed\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:15.034Z\",\"mode\":\"test\",\"object\":\"Event\"},{\"description\":\"batch.created\",\"id\":\"evt_eb03529898ef11ec83b0054d842a494d\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"created_at\":\"2022-02-28T23:41:14.911Z\",\"mode\":\"test\",\"object\":\"Event\"}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:26.423804-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/events/evt_eda2c93e98ef11ecb85f23282eb4e9bf", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5da6e4d1739b00a4007a", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"5ca44786acf46ea8927f9d1a6c05b69a\"", + "X-Request-ID": "3c16ca97-628c-4501-96ae-28f766535651", + "x-runtime": "0.031639", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "344" + }, + "Body": "{\"description\":\"batch.updated\",\"mode\":\"test\",\"previous_attributes\":{\"state\":\"label_generating\"},\"created_at\":\"2022-02-28T23:41:19.000Z\",\"pending_urls\":[],\"completed_urls\":[],\"updated_at\":\"2022-02-28T23:41:19.000Z\",\"id\":\"evt_eda2c93e98ef11ecb85f23282eb4e9bf\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"status\":\"pending\",\"object\":\"Event\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:26.828732-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/event/retrieve_bad_input.json b/EasyPost.Tests.Net/cassettes/event/retrieve_bad_input.json new file mode 100644 index 000000000..efdcf2362 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/event/retrieve_bad_input.json @@ -0,0 +1,49 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/events/bad input", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 422, + "Message": "Unprocessable Entity" + }, + "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": "5f596083621d5da7e4d1739d00a40095", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "X-Request-ID": "308f595f-cc82-4b41-bd5f-906efedac265", + "x-runtime": "0.039762", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "201" + }, + "Body": "{\"error\":{\"code\":\"PARAMETER.INVALID_TYPE\",\"message\":\"Wrong parameter type.\",\"errors\":[{\"field\":\"id\",\"message\":\"expected a evt ID. See https://www.easypost.com/docs/api#objects for more information\"}]}}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:27.239963-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/insurance/all.json b/EasyPost.Tests.Net/cassettes/insurance/all.json new file mode 100644 index 000000000..d30578b8d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/insurance/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/insurances?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dace4d173bd00a40216", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"8b93ec8ff40909a7d5248e5f54f52230\"", + "X-Request-ID": "61888d4f-abe4-4485-a1c6-e5d7912c14ee", + "x-runtime": "0.221910", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "23302" + }, + "Body": "{\"insurances\":[{\"id\":\"ins_c456b6f5141049e981dd24c2dc435270\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"pending\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_f4e217f098ef11ecbaffac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_f4e5f81f98ef11ecb98cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_2c15a88b4dd841e2aef754bdd2a31ba4\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428369\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:31Z\",\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzJjMTVhODhiNGRkODQxZTJhZWY3NTRiZGQyYTMxYmE0\",\"fees\":[]},\"tracking_code\":\"9400100897846109428369\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\"},{\"id\":\"ins_d10f13ab7f5e4d3697fec87b4f5fa6dd\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"pending\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_f399e4b898ef11ecb62eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_f39e26e198ef11ecb94aac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_74e504026a5846d58967ee49829040ba\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428352\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:28Z\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:28Z\",\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:28Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:28Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzc0ZTUwNDAyNmE1ODQ2ZDU4OTY3ZWU0OTgyOTA0MGJh\",\"fees\":[]},\"tracking_code\":\"9400100897846109428352\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\"},{\"id\":\"ins_b14bded88b3640058ba788ef80eced40\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"purchased\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_fbe825cb98e111ecb7daac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:30+00:00\",\"updated_at\":\"2022-02-28T22:01:30+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_fbea14e698e111ecaf73ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:30+00:00\",\"updated_at\":\"2022-02-28T22:01:30+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipment_id\":\"shp_5c171cb337244c5baf31d34ae26f2ad1\",\"tracker\":{\"id\":\"trk_21701e93ede241f6a48df8fee9670dda\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109416328\",\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"created_at\":\"2022-02-28T22:01:31Z\",\"updated_at\":\"2022-02-28T22:04:31Z\",\"signed_by\":\"John Tester\",\"weight\":null,\"est_delivery_date\":\"2022-02-28T22:04:31Z\",\"shipment_id\":\"shp_5c171cb337244c5baf31d34ae26f2ad1\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T22:04:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T10:41:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Origin Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-29T20:46:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-30T22:22:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"COLUMBIA\",\"state\":\"SC\",\"country\":null,\"zip\":\"29201\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at Post Office\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-31T01:13:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Sorting Complete\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-31T06:53:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Out for Delivery\",\"description\":null,\"status\":\"out_for_delivery\",\"status_detail\":\"out_for_delivery\",\"datetime\":\"2022-01-31T07:03:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Delivered\",\"description\":null,\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"datetime\":\"2022-01-31T11:55:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"},\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":\"2022-01-31T11:55:31Z\"},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzIxNzAxZTkzZWRlMjQxZjZhNDhkZjhmZWU5NjcwZGRh\",\"fees\":[]},\"tracking_code\":\"9400100897846109416328\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T22:01:31Z\",\"updated_at\":\"2022-02-28T22:01:31Z\"},{\"id\":\"ins_5d47f37047a34116a7d9ed1fb0c34944\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"cancelled\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_d8161d3198e111eca8ffac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:00:30+00:00\",\"updated_at\":\"2022-02-28T22:00:30+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_d81a4ffd98e111ecac23ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:00:30+00:00\",\"updated_at\":\"2022-02-28T22:00:30+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_0ee26c683df54a83b1fff39af322a24d\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109416182\",\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"created_at\":\"2022-02-28T22:00:29Z\",\"updated_at\":\"2022-02-28T22:03:30Z\",\"signed_by\":\"John Tester\",\"weight\":null,\"est_delivery_date\":\"2022-02-28T22:03:30Z\",\"shipment_id\":\"shp_c9c08ca771714113a8d9380335e666c5\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T22:03:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T10:40:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Origin Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-29T20:45:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-30T22:21:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"COLUMBIA\",\"state\":\"SC\",\"country\":null,\"zip\":\"29201\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at Post Office\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-31T01:12:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Sorting Complete\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-31T06:52:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Out for Delivery\",\"description\":null,\"status\":\"out_for_delivery\",\"status_detail\":\"out_for_delivery\",\"datetime\":\"2022-01-31T07:02:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Delivered\",\"description\":null,\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"datetime\":\"2022-01-31T11:54:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"},\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":\"2022-01-31T11:54:30Z\"},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzBlZTI2YzY4M2RmNTRhODNiMWZmZjM5YWYzMjJhMjRk\",\"fees\":[]},\"tracking_code\":\"9400100897846109416182\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[\"The tracker entered the mailstream before insurance was purchased.\"],\"created_at\":\"2022-02-28T22:00:30Z\",\"updated_at\":\"2022-02-28T22:02:21Z\"},{\"id\":\"ins_4f738ae836a84d4fa9b80921820ca4bc\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"cancelled\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_d6c1853898e111ecab8dac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:00:27+00:00\",\"updated_at\":\"2022-02-28T22:00:27+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_d6c5e88098e111eca306ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:00:28+00:00\",\"updated_at\":\"2022-02-28T22:00:28+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_232fe84619ef4b2e85fba21623d3ceae\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109416175\",\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"created_at\":\"2022-02-28T22:00:27Z\",\"updated_at\":\"2022-02-28T22:03:27Z\",\"signed_by\":\"John Tester\",\"weight\":null,\"est_delivery_date\":\"2022-02-28T22:03:27Z\",\"shipment_id\":\"shp_cbfd48e641f24f9ab20450f2ee0a72da\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T22:03:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T10:40:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Origin Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-29T20:45:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at USPS Facility\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-30T22:21:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"COLUMBIA\",\"state\":\"SC\",\"country\":null,\"zip\":\"29201\"}},{\"object\":\"TrackingDetail\",\"message\":\"Arrived at Post Office\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"arrived_at_facility\",\"datetime\":\"2022-01-31T01:12:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Sorting Complete\",\"description\":null,\"status\":\"in_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-31T06:52:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Out for Delivery\",\"description\":null,\"status\":\"out_for_delivery\",\"status_detail\":\"out_for_delivery\",\"datetime\":\"2022-01-31T07:02:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}},{\"object\":\"TrackingDetail\",\"message\":\"Delivered\",\"description\":null,\"status\":\"delivered\",\"status_detail\":\"arrived_at_destination\",\"datetime\":\"2022-01-31T11:54:27Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"NORTH HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77315\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"CHARLESTON\",\"state\":\"SC\",\"country\":null,\"zip\":\"29407\"},\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":\"2022-01-31T11:54:27Z\"},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzIzMmZlODQ2MTllZjRiMmU4NWZiYTIxNjIzZDNjZWFl\",\"fees\":[]},\"tracking_code\":\"9400100897846109416175\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[\"The tracker entered the mailstream before insurance was purchased.\"],\"created_at\":\"2022-02-28T22:00:28Z\",\"updated_at\":\"2022-02-28T22:02:11Z\"}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:32.652762-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/insurance/create.json b/EasyPost.Tests.Net/cassettes/insurance/create.json new file mode 100644 index 000000000..ae379e9c0 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/insurance/create.json @@ -0,0 +1,106 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5da7e4d1739f00a400b2", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_e1fc967666bd45e29a249f479538b3d4", + "ETag": "W/\"67d4e3d7afae6dd1eb2c712fd44990c9\"", + "X-Request-ID": "b0750a7c-4a31-43c1-9dba-fafa5c41370b", + "x-runtime": "1.143117", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:27Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428352\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f2a818aa98ef11ecb60aac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:27+00:00\",\"updated_at\":\"2022-02-28T23:41:27+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_a06bc2bf8a69490ebfe776296b4017fc\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:27Z\",\"updated_at\":\"2022-02-28T23:41:27Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_4ead157cc1a142059681df3d0eed4010\",\"created_at\":\"2022-02-28T23:41:28Z\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:28Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/ec92ab6295f94866b4058392ada40b32.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_2b92c2652feb456ca707e2dd473648cd\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:27Z\",\"updated_at\":\"2022-02-28T23:41:27Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d6c216fa04e544eab719f8486e862e49\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:27Z\",\"updated_at\":\"2022-02-28T23:41:27Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_9a38eb3d8b69436999ff2d364d3365e6\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:27Z\",\"updated_at\":\"2022-02-28T23:41:27Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f3c888b0d2f64bea9a76d7d2b434a19d\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:27Z\",\"updated_at\":\"2022-02-28T23:41:27Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_9a38eb3d8b69436999ff2d364d3365e6\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:28Z\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_74e504026a5846d58967ee49829040ba\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428352\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:28Z\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzc0ZTUwNDAyNmE1ODQ2ZDU4OTY3ZWU0OTgyOTA0MGJh\"},\"to_address\":{\"id\":\"adr_f2a6218298ef11eca3f7ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:27+00:00\",\"updated_at\":\"2022-02-28T23:41:27+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f2a818aa98ef11ecb60aac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:27+00:00\",\"updated_at\":\"2022-02-28T23:41:27+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f2a6218298ef11eca3f7ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:27+00:00\",\"updated_at\":\"2022-02-28T23:41:27+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:28.799864-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/insurances", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "470" + }, + "Body": "{\"insurance\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"tracking_code\":\"9400100897846109428352\",\"carrier\":\"USPS\",\"amount\":100}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596081621d5da9e4d173a200a40115", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/insurances/ins_d10f13ab7f5e4d3697fec87b4f5fa6dd", + "ETag": "W/\"7f1bf06395515e45d5719e595b93e5f2\"", + "X-Request-ID": "f0d5c3c0-0fcf-4d6d-812c-70484f909694", + "x-runtime": "0.148571", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "3417" + }, + "Body": "{\"id\":\"ins_d10f13ab7f5e4d3697fec87b4f5fa6dd\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"pending\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_f399e4b898ef11ecb62eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_f39e26e198ef11ecb94aac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_74e504026a5846d58967ee49829040ba\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428352\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:28Z\",\"updated_at\":\"2022-02-28T23:41:28Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:28Z\",\"shipment_id\":\"shp_e1fc967666bd45e29a249f479538b3d4\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:28Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:28Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzc0ZTUwNDAyNmE1ODQ2ZDU4OTY3ZWU0OTgyOTA0MGJh\",\"fees\":[]},\"tracking_code\":\"9400100897846109428352\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:29.345186-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/insurance/retrieve.json b/EasyPost.Tests.Net/cassettes/insurance/retrieve.json new file mode 100644 index 000000000..15e748478 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/insurance/retrieve.json @@ -0,0 +1,154 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5da9e4d173a300a40136", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_69bf0ddcbf3c44bb81b49329845ce939", + "ETag": "W/\"998f31553741047624a036344de30fff\"", + "X-Request-ID": "7daccdaf-7ab8-4f96-9a89-749c93def97a", + "x-runtime": "1.121706", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:29Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428369\",\"updated_at\":\"2022-02-28T23:41:30Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f3eb77a298ef11ecb958ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_d1b5dcbc710d4a3db29209f22ab5c654\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_b09f33666e09415bb7898a0336c2d5fa\",\"created_at\":\"2022-02-28T23:41:30Z\",\"updated_at\":\"2022-02-28T23:41:30Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:30Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/a8ea1a7dbf144ba690afbb12c1a66132.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_37822a629dda43ada19efdf5454a0721\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_b4a05fa6fc334379808e12b2182c925a\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_25994f3fb4a548c191c91aa58a943965\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4ab3e016cb2e489db7aef6215e1660b7\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:29Z\",\"updated_at\":\"2022-02-28T23:41:29Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_37822a629dda43ada19efdf5454a0721\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:30Z\",\"updated_at\":\"2022-02-28T23:41:30Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_2c15a88b4dd841e2aef754bdd2a31ba4\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428369\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:30Z\",\"updated_at\":\"2022-02-28T23:41:30Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzJjMTVhODhiNGRkODQxZTJhZWY3NTRiZGQyYTMxYmE0\"},\"to_address\":{\"id\":\"adr_f3e9db6198ef11ecb639ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:30+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f3eb77a298ef11ecb958ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f3e9db6198ef11ecb639ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:29+00:00\",\"updated_at\":\"2022-02-28T23:41:30+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:30.949635-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/insurances", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "470" + }, + "Body": "{\"insurance\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"tracking_code\":\"9400100897846109428369\",\"carrier\":\"USPS\",\"amount\":100}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5dabe4d173bb00a401d4", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/insurances/ins_c456b6f5141049e981dd24c2dc435270", + "ETag": "W/\"5bb6296393d1539c5ce0381caf271986\"", + "X-Request-ID": "2662d82b-87b9-4149-9361-e8df4614ad93", + "x-runtime": "0.133646", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "3417" + }, + "Body": "{\"id\":\"ins_c456b6f5141049e981dd24c2dc435270\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"pending\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_f4e217f098ef11ecbaffac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_f4e5f81f98ef11ecb98cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":\"\",\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_2c15a88b4dd841e2aef754bdd2a31ba4\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428369\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:31Z\",\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzJjMTVhODhiNGRkODQxZTJhZWY3NTRiZGQyYTMxYmE0\",\"fees\":[]},\"tracking_code\":\"9400100897846109428369\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:31.483789-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/insurances/ins_c456b6f5141049e981dd24c2dc435270", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5dabe4d173bc00a401f1", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"83feea5994ccf1684bddf7d55f4bdad9\"", + "X-Request-ID": "3a512b2a-2d49-4b83-aa40-9b70984761c5", + "x-runtime": "0.092668", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "3421" + }, + "Body": "{\"id\":\"ins_c456b6f5141049e981dd24c2dc435270\",\"object\":\"Insurance\",\"mode\":\"test\",\"reference\":null,\"status\":\"pending\",\"amount\":\"100.00000\",\"provider\":\"easypost\",\"provider_id\":null,\"to_address\":{\"id\":\"adr_f4e217f098ef11ecbaffac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"from_address\":{\"id\":\"adr_f4e5f81f98ef11ecb98cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:31+00:00\",\"updated_at\":\"2022-02-28T23:41:31+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"shipment_id\":null,\"tracker\":{\"id\":\"trk_2c15a88b4dd841e2aef754bdd2a31ba4\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428369\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:31Z\",\"shipment_id\":\"shp_69bf0ddcbf3c44bb81b49329845ce939\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrXzJjMTVhODhiNGRkODQxZTJhZWY3NTRiZGQyYTMxYmE0\",\"fees\":[]},\"tracking_code\":\"9400100897846109428369\",\"fee\":{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false},\"messages\":[],\"created_at\":\"2022-02-28T23:41:31Z\",\"updated_at\":\"2022-02-28T23:41:31Z\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:31.96267-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/order/buy.json b/EasyPost.Tests.Net/cassettes/order/buy.json new file mode 100644 index 000000000..2c215aac5 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/order/buy.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/orders", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "861" + }, + "Body": "{\"order\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5db2e4d173c400a403df", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/orders/order_e9d5f94376ad4731a56724267a3aa741", + "ETag": "W/\"f94d52c1057f615ee592f93e73178dea\"", + "X-Request-ID": "4a4daf44-f0bb-402d-bfbe-50779790a681", + "x-runtime": "0.676870", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "10514" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:38Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:38Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:38Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_e9d5f94376ad4731a56724267a3aa741\",\"parcel\":{\"id\":\"prcl_58e8e33b5369425589663b222b08ac63\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:38Z\",\"updated_at\":\"2022-02-28T23:41:38Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_4b819f39da2040ada50ddc83aa6e08ae\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c7c587c060654f9494ae1de759e181af\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec6911bcb1f34e658e3ee2ad2ef65af0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_72d1b831c9824c7a9f2cd1fcca3f7167\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_4b819f39da2040ada50ddc83aa6e08ae\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c7c587c060654f9494ae1de759e181af\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec6911bcb1f34e658e3ee2ad2ef65af0\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_72d1b831c9824c7a9f2cd1fcca3f7167\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_e9d5f94376ad4731a56724267a3aa741\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:39.126779-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/orders/order_e9d5f94376ad4731a56724267a3aa741/buy?carrier=USPS&service=First", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5db3e4d173e000a4043f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"f02918de30aeeeb7676ca8a8ce1e90ce\"", + "X-Request-ID": "f99625f8-6c9c-4526-92c5-26751e22d2c6", + "x-runtime": "0.857425", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "12152" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:38Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:39+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"buyer_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:39+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"return_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:38Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428383\",\"updated_at\":\"2022-02-28T23:41:40Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_e9d5f94376ad4731a56724267a3aa741\",\"parcel\":{\"id\":\"prcl_58e8e33b5369425589663b222b08ac63\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:38Z\",\"updated_at\":\"2022-02-28T23:41:38Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_16a51d4ab2eb4d07b8181b3cbac405bc\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:40Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:39Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/c90cfbb34a4b4f28abd4a890690f70f7.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_4b819f39da2040ada50ddc83aa6e08ae\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c7c587c060654f9494ae1de759e181af\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec6911bcb1f34e658e3ee2ad2ef65af0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_72d1b831c9824c7a9f2cd1fcca3f7167\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:39Z\",\"updated_at\":\"2022-02-28T23:41:39Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_72d1b831c9824c7a9f2cd1fcca3f7167\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:40Z\",\"updated_at\":\"2022-02-28T23:41:40Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_f4c837102a88425ebb7c7d6a90ba0de0\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428383\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:40Z\",\"updated_at\":\"2022-02-28T23:41:40Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrX2Y0YzgzNzEwMmE4ODQyNWViYjdjN2Q2YTkwYmEwZGUw\"},\"to_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:39+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f906898798ef11ecbbcfac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:38+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f90540e798ef11ecbbcdac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:38+00:00\",\"updated_at\":\"2022-02-28T23:41:39+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_4b819f39da2040ada50ddc83aa6e08ae\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c7c587c060654f9494ae1de759e181af\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec6911bcb1f34e658e3ee2ad2ef65af0\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_72d1b831c9824c7a9f2cd1fcca3f7167\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7014b1b8481b4480bc658d2fc31514ee\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_e9d5f94376ad4731a56724267a3aa741\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:40.444709-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/order/create.json b/EasyPost.Tests.Net/cassettes/order/create.json new file mode 100644 index 000000000..cd4c02cd3 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/order/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/orders", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "861" + }, + "Body": "{\"order\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596081621d5dade4d173be00a40260", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/orders/order_bc2fd559f8984966b92620d02fd416d1", + "ETag": "W/\"c19c218e414848ab595c982ce732ec0a\"", + "X-Request-ID": "66ebc822-5afe-49dc-b36c-fc6d7bf823b6", + "x-runtime": "0.769712", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "10514" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f5e2cc9898ef11ecbb2bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f5e1834698ef11eca447ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f5e1834698ef11eca447ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f5e2cc9898ef11ecbb2bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:33Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:33Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f5e2cc9898ef11ecbb2bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_bc2fd559f8984966b92620d02fd416d1\",\"parcel\":{\"id\":\"prcl_94ef581690da4745b7dafa82f1298962\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_09744399fb0c4de2bf488ab2e6fc327f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_2092459a2c9041e7b9f2eae02eeaa5e9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a8ca8260921641669f2d001cd2be5277\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3670d09bcb8e49b38492870687d13a8e\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:33Z\",\"updated_at\":\"2022-02-28T23:41:33Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f5e1834698ef11eca447ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f5e2cc9898ef11ecbb2bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f5e1834698ef11eca447ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:33+00:00\",\"updated_at\":\"2022-02-28T23:41:33+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_895eb33226014ae1909049075f398c0a\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_09744399fb0c4de2bf488ab2e6fc327f\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_2092459a2c9041e7b9f2eae02eeaa5e9\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a8ca8260921641669f2d001cd2be5277\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3670d09bcb8e49b38492870687d13a8e\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_895eb33226014ae1909049075f398c0a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_bc2fd559f8984966b92620d02fd416d1\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:33.920082-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/order/get_rates.json b/EasyPost.Tests.Net/cassettes/order/get_rates.json new file mode 100644 index 000000000..4a43d2c21 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/order/get_rates.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/orders", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "861" + }, + "Body": "{\"order\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5dafe4d173c100a4033c", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/orders/order_269b0142753141f5ac17d172fdb393d7", + "ETag": "W/\"fdc04ee3898f7280a397f42089592669\"", + "X-Request-ID": "257dbadb-f8ca-4aff-87f6-3d67d1951010", + "x-runtime": "0.664227", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "10514" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:36Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:36Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_269b0142753141f5ac17d172fdb393d7\",\"parcel\":{\"id\":\"prcl_f8c5017f8d4b4630ad323e784207d522\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_b150e44128aa4d19829d56fe165ec9a5\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4137b1db0cd14800a57136cc805d99f4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_855f0c80567040d7901f73c1cf419e69\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_be04b993adf3440294461305cda5c086\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_b150e44128aa4d19829d56fe165ec9a5\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4137b1db0cd14800a57136cc805d99f4\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_855f0c80567040d7901f73c1cf419e69\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_be04b993adf3440294461305cda5c086\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_269b0142753141f5ac17d172fdb393d7\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:36.589419-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/orders/order_269b0142753141f5ac17d172fdb393d7/rates", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596080621d5db1e4d173c200a4037f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"769896145e8db922ed22aa21c8cc2b4f\"", + "X-Request-ID": "b61c2ee5-831f-42fa-bf14-4d4020f82677", + "x-runtime": "0.915595", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "9681" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:36Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:36Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_269b0142753141f5ac17d172fdb393d7\",\"parcel\":{\"id\":\"prcl_f8c5017f8d4b4630ad323e784207d522\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:36Z\",\"updated_at\":\"2022-02-28T23:41:36Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_7d30389405a941ed95b66d76281d96bf\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:37Z\",\"updated_at\":\"2022-02-28T23:41:37Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_e8dd231e94a247c8a4e454fc56c7c337\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:37Z\",\"updated_at\":\"2022-02-28T23:41:37Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4e07f32aaa1743938eb7a2179542ee38\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:37Z\",\"updated_at\":\"2022-02-28T23:41:37Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_703d4cd56e104ad994229001011c683b\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:37Z\",\"updated_at\":\"2022-02-28T23:41:37Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f79b0aed98ef11ecb6d0ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f799cdae98ef11eca47cac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:36+00:00\",\"updated_at\":\"2022-02-28T23:41:36+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_7d30389405a941ed95b66d76281d96bf\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_e8dd231e94a247c8a4e454fc56c7c337\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4e07f32aaa1743938eb7a2179542ee38\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_703d4cd56e104ad994229001011c683b\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_7b1fcc4ca4eb48489ca6853e031efcf5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_269b0142753141f5ac17d172fdb393d7\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:37.909787-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/order/retrieve.json b/EasyPost.Tests.Net/cassettes/order/retrieve.json new file mode 100644 index 000000000..da69b3709 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/order/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/orders", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "861" + }, + "Body": "{\"order\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"shipments\":[{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5daee4d173bf00a402c5", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/orders/order_21273c9a39ad4441a69d71ada53eb790", + "ETag": "W/\"545f64fa50536c87537e736fe3979f14\"", + "X-Request-ID": "aa16e249-7472-4a13-858a-134886eba435", + "x-runtime": "0.707327", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "10514" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:34Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:34Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:34Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_21273c9a39ad4441a69d71ada53eb790\",\"parcel\":{\"id\":\"prcl_5513aeb81cd84c909305fe91537313b7\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:34Z\",\"updated_at\":\"2022-02-28T23:41:34Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_cdcbe7388b2b4888aeccf7c3a5bb0357\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_25c5b8de1da643a081a12f369b621f5d\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_242b1b468fd54e89a5470e718b995ae0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_8771abaed6744d82b0701766411f3212\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_cdcbe7388b2b4888aeccf7c3a5bb0357\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_25c5b8de1da643a081a12f369b621f5d\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_242b1b468fd54e89a5470e718b995ae0\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_8771abaed6744d82b0701766411f3212\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_21273c9a39ad4441a69d71ada53eb790\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:35.031119-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/orders/order_21273c9a39ad4441a69d71ada53eb790", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dafe4d173c000a40307", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"07f22c41abb618650e88fd0848d40225\"", + "X-Request-ID": "91e670d7-1484-4d2a-be91-9f7dd563f9e3", + "x-runtime": "0.117952", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "9681" + }, + "Body": "{\"mode\":\"test\",\"reference\":null,\"is_return\":false,\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"}},\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"created_at\":\"2022-02-28T23:41:34Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"customs_info\":null,\"from_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"to_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"return_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"shipments\":[{\"created_at\":\"2022-02-28T23:41:34Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:34Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":\"order_21273c9a39ad4441a69d71ada53eb790\",\"parcel\":{\"id\":\"prcl_5513aeb81cd84c909305fe91537313b7\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:34Z\",\"updated_at\":\"2022-02-28T23:41:34Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_cdcbe7388b2b4888aeccf7c3a5bb0357\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_25c5b8de1da643a081a12f369b621f5d\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_242b1b468fd54e89a5470e718b995ae0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_8771abaed6744d82b0701766411f3212\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:35Z\",\"updated_at\":\"2022-02-28T23:41:35Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_f6a7454d98ef11ecb6a4ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_f6a5d08e98ef11ecb9e0ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:34+00:00\",\"updated_at\":\"2022-02-28T23:41:34+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"object\":\"Shipment\"}],\"rates\":[{\"id\":\"rate_cdcbe7388b2b4888aeccf7c3a5bb0357\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_25c5b8de1da643a081a12f369b621f5d\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_242b1b468fd54e89a5470e718b995ae0\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_8771abaed6744d82b0701766411f3212\",\"object\":\"Rate\",\"created_at\":null,\"updated_at\":null,\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8302b1735337465e83d05812aad7eb62\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"id\":\"order_21273c9a39ad4441a69d71ada53eb790\",\"object\":\"Order\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:35.536447-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/parcel/create.json b/EasyPost.Tests.Net/cassettes/parcel/create.json new file mode 100644 index 000000000..6c7729306 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/parcel/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/parcels", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "67" + }, + "Body": "{\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5db4e4d173e500a404aa", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/parcels.prcl_709bb5523d0b42959f73aea5635b1418", + "ETag": "W/\"cb858bec9fa3b795b73c80041f29fd90\"", + "X-Request-ID": "47006024-cf16-43ab-8060-000e39d1cab9", + "x-runtime": "0.027137", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "229" + }, + "Body": "{\"id\":\"prcl_709bb5523d0b42959f73aea5635b1418\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:40Z\",\"updated_at\":\"2022-02-28T23:41:40Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:40.860667-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/parcel/retrieve.json b/EasyPost.Tests.Net/cassettes/parcel/retrieve.json new file mode 100644 index 000000000..b73639d5b --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/parcel/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/parcels", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "67" + }, + "Body": "{\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5db5e4d173fd00a404d3", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/parcels.prcl_816578813e604e55bed4c66eea4f3130", + "ETag": "W/\"8cadbf9faa67ef44a3bd4084af2e8658\"", + "X-Request-ID": "488ce737-d762-49e6-94f1-ab90f0a65536", + "x-runtime": "0.022010", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "229" + }, + "Body": "{\"id\":\"prcl_816578813e604e55bed4c66eea4f3130\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:41Z\",\"updated_at\":\"2022-02-28T23:41:41Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:41.261668-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/parcels/prcl_816578813e604e55bed4c66eea4f3130", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5db5e4d173fe00a40510", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"8cadbf9faa67ef44a3bd4084af2e8658\"", + "X-Request-ID": "492426cd-1e7a-46d9-bac3-4e262ce3ceb5", + "x-runtime": "0.038552", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "229" + }, + "Body": "{\"id\":\"prcl_816578813e604e55bed4c66eea4f3130\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:41Z\",\"updated_at\":\"2022-02-28T23:41:41Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:41.672752-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/pickup/buy.json b/EasyPost.Tests.Net/cassettes/pickup/buy.json new file mode 100644 index 000000000..d2292f764 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/pickup/buy.json @@ -0,0 +1,154 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596081621d5dbbe4d1740400a40700", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_c958dda98371438f97cb100b1a59376d", + "ETag": "W/\"6cef450442b3bfe74e0973489c4a8a02\"", + "X-Request-ID": "cdbf9ca2-30c2-45d5-928a-19ae5aadde79", + "x-runtime": "0.869962", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:47Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428420\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:47+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_9e6f4c2284e44bdba5c084d8b02807ce\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:47Z\",\"updated_at\":\"2022-02-28T23:41:47Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_33c1c17bd1b24c3faad613c4c0ece531\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:48Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/d95b132f7d7a45268db1f62cdb5a8b8d.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_9da8ace026e94afb90ecd1ebc599d1a4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a28d3d8a079449f39408d70add8743b6\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f55a46928dbd4bfb80c586a49ee36a21\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_9706068615994ca78632696b98737375\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_9706068615994ca78632696b98737375\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_fd07ffd1ea2d4ee9820ff6704cbb3f7b\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428420\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZkMDdmZmQxZWEyZDRlZTk4MjBmZjY3MDRjYmIzZjdi\"},\"to_address\":{\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:48+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:47+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:48+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:48.76621-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5917" + }, + "Body": "{\"pickup\":{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"min_datetime\":\"2022-03-01\",\"max_datetime\":\"2022-03-02\",\"instructions\":\"Pickup at front door\",\"shipment\":{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:47Z\",\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:41:47Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:47Z\",\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:47Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:41:47Z\",\"height\":4.0,\"id\":\"prcl_9e6f4c2284e44bdba5c084d8b02807ce\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:41:47Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:41:48Z\",\"date_advance\":0,\"id\":\"pl_33c1c17bd1b24c3faad613c4c0ece531\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:48Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/d95b132f7d7a45268db1f62cdb5a8b8d.png\",\"updated_at\":\"2022-02-28T23:41:48Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:48Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_9da8ace026e94afb90ecd1ebc599d1a4\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"updated_at\":\"2022-02-28T23:41:48Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:48Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_a28d3d8a079449f39408d70add8743b6\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"updated_at\":\"2022-02-28T23:41:48Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:48Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_f55a46928dbd4bfb80c586a49ee36a21\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"updated_at\":\"2022-02-28T23:41:48Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:48Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_9706068615994ca78632696b98737375\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"updated_at\":\"2022-02-28T23:41:48Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:47Z\",\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:47Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:48Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_9706068615994ca78632696b98737375\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"updated_at\":\"2022-02-28T23:41:48Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:47Z\",\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:41:48Z\",\"id\":\"trk_fd07ffd1ea2d4ee9820ff6704cbb3f7b\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZkMDdmZmQxZWEyZDRlZTk4MjBmZjY3MDRjYmIzZjdi\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428420\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:41:48Z\"},\"tracking_code\":\"9400100897846109428420\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"usps_zone\":\"1\"}}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5dbde4d1740500a4075e", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"10252610d7705e098e29ae4ad084eee1\"", + "X-Request-ID": "0fe1e9e6-5a0c-4e13-85f4-26a188ab7a3d", + "x-runtime": "0.682475", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1149" + }, + "Body": "{\"id\":\"pickup_cbc850ece3684637ac3f3de46ac5a445\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:49Z\",\"updated_at\":\"2022-02-28T23:41:49Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_ff7dd86998ef11ecb8adac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:49+00:00\",\"updated_at\":\"2022-02-28T23:41:49+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:49Z\",\"updated_at\":\"2022-02-28T23:41:49Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_cbc850ece3684637ac3f3de46ac5a445\",\"id\":\"pickuprate_571a6d9f396b49c091995b78ee7e2c99\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:49.839805-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups/pickup_cbc850ece3684637ac3f3de46ac5a445/buy?carrier=USPS&service=NextDay", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5dbee4d1740600a407b1", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"3e5424299fec358050e1213c77ddd1c0\"", + "X-Request-ID": "5dbb8619-0d74-4b83-86f6-9e4b79c73829", + "x-runtime": "1.006075", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1160" + }, + "Body": "{\"id\":\"pickup_cbc850ece3684637ac3f3de46ac5a445\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:49Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"status\":\"scheduled\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":\"WTC61769466\",\"address\":{\"id\":\"adr_ff7dd86998ef11ecb8adac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:49+00:00\",\"updated_at\":\"2022-02-28T23:41:49+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:49Z\",\"updated_at\":\"2022-02-28T23:41:49Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_cbc850ece3684637ac3f3de46ac5a445\",\"id\":\"pickuprate_571a6d9f396b49c091995b78ee7e2c99\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:51.327182-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/pickup/cancel.json b/EasyPost.Tests.Net/cassettes/pickup/cancel.json new file mode 100644 index 000000000..91659c5f2 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/pickup/cancel.json @@ -0,0 +1,201 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5dbfe4d1741e00a4080e", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_c9e2e3a498fd41309cb418dace3cd0a5", + "ETag": "W/\"0dd04f3d2b37ca68c9795eafe8731e95\"", + "X-Request-ID": "b165f24f-e216-4fc8-9ba6-2a743bf12cc6", + "x-runtime": "1.135661", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:51Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428437\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:51+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_603572466001446c88667cbebbd7f8d2\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_2a51549373bb47d3b18176784997beae\",\"created_at\":\"2022-02-28T23:41:52Z\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:52Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/4373c9355d32494988d0741fa1f629eb.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_9aa98f45ce9449d7b9bcfe485c9dc99c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_539e924548ed44118af46ff9b2d93e05\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_706608a88c874b3f9c05d9eb5e737c76\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:52Z\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_f8afa8607104487e94b774d6deacb0e2\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428437\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:52Z\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrX2Y4YWZhODYwNzEwNDQ4N2U5NGI3NzRkNmRlYWNiMGUy\"},\"to_address\":{\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:52+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:51+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:52+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:52.854303-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5917" + }, + "Body": "{\"pickup\":{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"min_datetime\":\"2022-03-01\",\"max_datetime\":\"2022-03-02\",\"instructions\":\"Pickup at front door\",\"shipment\":{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:51Z\",\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:41:51Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:51Z\",\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:41:51Z\",\"height\":4.0,\"id\":\"prcl_603572466001446c88667cbebbd7f8d2\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:41:52Z\",\"date_advance\":0,\"id\":\"pl_2a51549373bb47d3b18176784997beae\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:52Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/4373c9355d32494988d0741fa1f629eb.png\",\"updated_at\":\"2022-02-28T23:41:52Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:51Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_9aa98f45ce9449d7b9bcfe485c9dc99c\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"updated_at\":\"2022-02-28T23:41:51Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:51Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_539e924548ed44118af46ff9b2d93e05\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"updated_at\":\"2022-02-28T23:41:51Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:51Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"updated_at\":\"2022-02-28T23:41:51Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:51Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_706608a88c874b3f9c05d9eb5e737c76\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"updated_at\":\"2022-02-28T23:41:51Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:51Z\",\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:52Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"updated_at\":\"2022-02-28T23:41:52Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:51Z\",\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:41:52Z\",\"id\":\"trk_f8afa8607104487e94b774d6deacb0e2\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrX2Y4YWZhODYwNzEwNDQ4N2U5NGI3NzRkNmRlYWNiMGUy\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428437\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:41:52Z\"},\"tracking_code\":\"9400100897846109428437\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"usps_zone\":\"1\"}}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5dc1e4d1741f00a40850", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"b68083a198f73c946868e88ca9c27ca9\"", + "X-Request-ID": "78630aa3-9651-413d-9639-2adc4bd88760", + "x-runtime": "0.600243", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1149" + }, + "Body": "{\"id\":\"pickup_2c60c3a718484233849447227d31a107\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:53Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_01ecff7b98f011eca5e7ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:53+00:00\",\"updated_at\":\"2022-02-28T23:41:53+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:53Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_2c60c3a718484233849447227d31a107\",\"id\":\"pickuprate_c571333e095f4dc98b667765c98a68c1\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:53.88566-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups/pickup_2c60c3a718484233849447227d31a107/buy?carrier=USPS&service=NextDay", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dc2e4d1742000a4088c", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"aa5d5f13ae0fbbb5b8ab06606239f8c6\"", + "X-Request-ID": "7b55fb8f-99c4-4845-ba68-bdfce81fa89e", + "x-runtime": "0.746164", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1160" + }, + "Body": "{\"id\":\"pickup_2c60c3a718484233849447227d31a107\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:55Z\",\"mode\":\"test\",\"status\":\"scheduled\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":\"WTC61769468\",\"address\":{\"id\":\"adr_01ecff7b98f011eca5e7ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:53+00:00\",\"updated_at\":\"2022-02-28T23:41:53+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:53Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_2c60c3a718484233849447227d31a107\",\"id\":\"pickuprate_c571333e095f4dc98b667765c98a68c1\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:55.020189-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups/pickup_2c60c3a718484233849447227d31a107/cancel", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5dc3e4d1742100a408c2", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"a4c41f9e9eb3566e87e898dc575af36d\"", + "X-Request-ID": "2cab4ca0-7906-41d9-9c7f-5eaafc9e7ef2", + "x-runtime": "0.767490", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1159" + }, + "Body": "{\"id\":\"pickup_2c60c3a718484233849447227d31a107\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:56Z\",\"mode\":\"test\",\"status\":\"canceled\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":\"WTC61769468\",\"address\":{\"id\":\"adr_01ecff7b98f011eca5e7ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:53+00:00\",\"updated_at\":\"2022-02-28T23:41:53+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:53Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_2c60c3a718484233849447227d31a107\",\"id\":\"pickuprate_c571333e095f4dc98b667765c98a68c1\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:56.240666-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/pickup/create.json b/EasyPost.Tests.Net/cassettes/pickup/create.json new file mode 100644 index 000000000..964abefb6 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/pickup/create.json @@ -0,0 +1,105 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5db6e4d173ff00a4053b", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_275109db4cb44c98b1afaa25e7afb24d", + "ETag": "W/\"7d7c1e888fa527e4473d955e7dc95561\"", + "X-Request-ID": "6a252685-9ef3-4750-9e07-c71e608754a9", + "x-runtime": "0.933432", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:42Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428406\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_fb416b6898ef11ecbad6ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:42+00:00\",\"updated_at\":\"2022-02-28T23:41:42+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_43d0abd3ba854aa2acc4a6d7a8971983\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_fa163bd2367547f486227d21f49db675\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:42Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/e89bd8b5dffa496db34f66ae101f53ca.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_67bcdbdc6bfa4b619db09f3c2d6092e9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_393097e55604405ebddfb2605bba4a56\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_896982a3de184d4c91654105bead3d5f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_51b2dc95eae044cd8bec1dab79358f8d\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_51b2dc95eae044cd8bec1dab79358f8d\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:42Z\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_737cd387c83444478e7c306f19e2829c\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428406\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:43Z\",\"updated_at\":\"2022-02-28T23:41:43Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzczN2NkMzg3YzgzNDQ0NDc4ZTdjMzA2ZjE5ZTI4Mjlj\"},\"to_address\":{\"id\":\"adr_fb3f7add98ef11ecbad5ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:42+00:00\",\"updated_at\":\"2022-02-28T23:41:42+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_fb416b6898ef11ecbad6ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:42+00:00\",\"updated_at\":\"2022-02-28T23:41:42+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_fb3f7add98ef11ecbad5ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:42+00:00\",\"updated_at\":\"2022-02-28T23:41:42+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:42.975264-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5917" + }, + "Body": "{\"pickup\":{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"min_datetime\":\"2022-03-01\",\"max_datetime\":\"2022-03-02\",\"instructions\":\"Pickup at front door\",\"shipment\":{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:42Z\",\"id\":\"adr_fb3f7add98ef11ecbad5ac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:41:42Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:42Z\",\"id\":\"adr_fb416b6898ef11ecbad6ac1f6bc72124\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:41:42Z\",\"height\":4.0,\"id\":\"prcl_43d0abd3ba854aa2acc4a6d7a8971983\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:41:42Z\",\"date_advance\":0,\"id\":\"pl_fa163bd2367547f486227d21f49db675\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:42Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/e89bd8b5dffa496db34f66ae101f53ca.png\",\"updated_at\":\"2022-02-28T23:41:42Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:42Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_67bcdbdc6bfa4b619db09f3c2d6092e9\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"updated_at\":\"2022-02-28T23:41:42Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:42Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_393097e55604405ebddfb2605bba4a56\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"updated_at\":\"2022-02-28T23:41:42Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:42Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_896982a3de184d4c91654105bead3d5f\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"updated_at\":\"2022-02-28T23:41:42Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:42Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_51b2dc95eae044cd8bec1dab79358f8d\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"updated_at\":\"2022-02-28T23:41:42Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:42Z\",\"id\":\"adr_fb416b6898ef11ecbad6ac1f6bc72124\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:42Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_51b2dc95eae044cd8bec1dab79358f8d\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"updated_at\":\"2022-02-28T23:41:42Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:42Z\",\"id\":\"adr_fb3f7add98ef11ecbad5ac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:41:43Z\",\"id\":\"trk_737cd387c83444478e7c306f19e2829c\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrXzczN2NkMzg3YzgzNDQ0NDc4ZTdjMzA2ZjE5ZTI4Mjlj\",\"shipment_id\":\"shp_275109db4cb44c98b1afaa25e7afb24d\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428406\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:41:43Z\"},\"tracking_code\":\"9400100897846109428406\",\"updated_at\":\"2022-02-28T23:41:42Z\",\"usps_zone\":\"1\"}}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5db7e4d1740000a40597", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"8765866d107c9438e05bd8094c67dbd3\"", + "X-Request-ID": "cbca6d46-5649-474b-8b1c-77de3d04cb6f", + "x-runtime": "0.841943", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1149" + }, + "Body": "{\"id\":\"pickup_0abb23801f23471c9db9937af9e84757\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:43Z\",\"updated_at\":\"2022-02-28T23:41:43Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_fc0e995898ef11ecb7ddac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:43+00:00\",\"updated_at\":\"2022-02-28T23:41:43+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_0abb23801f23471c9db9937af9e84757\",\"id\":\"pickuprate_67485bf1f5e64ca484cd249d20eb28b0\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:44.237385-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/pickup/retrieve.json b/EasyPost.Tests.Net/cassettes/pickup/retrieve.json new file mode 100644 index 000000000..283e4687d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/pickup/retrieve.json @@ -0,0 +1,153 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5db8e4d1740100a40601", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_e97c2c97867d4e3a937386b88700b625", + "ETag": "W/\"e08d3982d0a749680d45bae9d07e6880\"", + "X-Request-ID": "59a4ce1c-0c2d-49d6-9d93-0c095d848b4c", + "x-runtime": "1.056242", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:44Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428413\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:44+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_1b383f4af1ee4f3d858a675cb4a983db\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_00eeed8bac4d4943b0564f95a6f17e0d\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:45Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/5a5dd743aba14ffcb64b708e843a779b.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_098a2c9d5fe54529aed5fa6a0ff495fe\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a42f268b792646118841506389d054e0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f07e7ed4d1cd4129a18b68a9b0ac4f89\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_063b17c42acd499db404652c5594bda5\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428413\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzA2M2IxN2M0MmFjZDQ5OWRiNDA0NjUyYzU1OTRiZGE1\"},\"to_address\":{\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:45+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:44+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:45+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:45.795908-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/pickups", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5917" + }, + "Body": "{\"pickup\":{\"address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"min_datetime\":\"2022-03-01\",\"max_datetime\":\"2022-03-02\",\"instructions\":\"Pickup at front door\",\"shipment\":{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:44Z\",\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:41:44Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:44Z\",\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:41:44Z\",\"height\":4.0,\"id\":\"prcl_1b383f4af1ee4f3d858a675cb4a983db\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:41:45Z\",\"date_advance\":0,\"id\":\"pl_00eeed8bac4d4943b0564f95a6f17e0d\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:45Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/5a5dd743aba14ffcb64b708e843a779b.png\",\"updated_at\":\"2022-02-28T23:41:45Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:44Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_098a2c9d5fe54529aed5fa6a0ff495fe\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"updated_at\":\"2022-02-28T23:41:44Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:44Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_a42f268b792646118841506389d054e0\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"updated_at\":\"2022-02-28T23:41:44Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:44Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"updated_at\":\"2022-02-28T23:41:44Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:44Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_f07e7ed4d1cd4129a18b68a9b0ac4f89\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"updated_at\":\"2022-02-28T23:41:44Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:44Z\",\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:41:45Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"updated_at\":\"2022-02-28T23:41:45Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:41:44Z\",\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:41:45Z\",\"id\":\"trk_063b17c42acd499db404652c5594bda5\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrXzA2M2IxN2M0MmFjZDQ5OWRiNDA0NjUyYzU1OTRiZGE1\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428413\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:41:45Z\"},\"tracking_code\":\"9400100897846109428413\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"usps_zone\":\"1\"}}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5dbae4d1740200a40686", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"c8ac3a94fc3b21114cef45d01cd36af6\"", + "X-Request-ID": "1a408af7-12a0-4869-8c0c-d74ca6856b41", + "x-runtime": "0.747980", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1149" + }, + "Body": "{\"id\":\"pickup_d94d5e81d0e94846bf720bc3b9870510\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:46Z\",\"updated_at\":\"2022-02-28T23:41:46Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_fdb8d79198ef11ecbb85ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:46+00:00\",\"updated_at\":\"2022-02-28T23:41:46+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:46Z\",\"updated_at\":\"2022-02-28T23:41:46Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_d94d5e81d0e94846bf720bc3b9870510\",\"id\":\"pickuprate_fc6f15fb1d5d49bfa27d499c80b0b69f\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:47.024615-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/pickups/pickup_d94d5e81d0e94846bf720bc3b9870510", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dbbe4d1740300a406dd", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"c8ac3a94fc3b21114cef45d01cd36af6\"", + "X-Request-ID": "1fdb5a1f-7560-4b27-b789-80cbc32be4c1", + "x-runtime": "0.073583", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1149" + }, + "Body": "{\"id\":\"pickup_d94d5e81d0e94846bf720bc3b9870510\",\"object\":\"Pickup\",\"created_at\":\"2022-02-28T23:41:46Z\",\"updated_at\":\"2022-02-28T23:41:46Z\",\"mode\":\"test\",\"status\":\"unknown\",\"reference\":null,\"min_datetime\":\"2022-03-01T00:00:00Z\",\"max_datetime\":\"2022-03-02T00:00:00Z\",\"is_account_address\":false,\"instructions\":\"Pickup at front door\",\"messages\":[],\"confirmation\":null,\"address\":{\"id\":\"adr_fdb8d79198ef11ecbb85ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:46+00:00\",\"updated_at\":\"2022-02-28T23:41:46+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"carrier_accounts\":[],\"pickup_rates\":[{\"mode\":\"test\",\"service\":\"NextDay\",\"rate\":\"0.00\",\"currency\":\"USD\",\"created_at\":\"2022-02-28T23:41:46Z\",\"updated_at\":\"2022-02-28T23:41:46Z\",\"carrier\":\"USPS\",\"pickup_id\":\"pickup_d94d5e81d0e94846bf720bc3b9870510\",\"id\":\"pickuprate_fc6f15fb1d5d49bfa27d499c80b0b69f\",\"object\":\"PickupRate\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:47.481203-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/rate/retrieve.json b/EasyPost.Tests.Net/cassettes/rate/retrieve.json new file mode 100644 index 000000000..44a2e846d --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/rate/retrieve.json @@ -0,0 +1,103 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "464" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5dc4e4d1742200a408f4", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_a8ca73b177ac443dadd04dc867708093", + "ETag": "W/\"5a54251305562c3a33afc82ff9e9a9da\"", + "X-Request-ID": "945bd890-c07f-4c44-989e-907055c1d7b8", + "x-runtime": "0.728940", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5562" + }, + "Body": "{\"created_at\":\"2022-02-28T23:41:56Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:41:57Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_03f2a41198f011ecbcccac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:56+00:00\",\"updated_at\":\"2022-02-28T23:41:56+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_493d2a6e38344b3f886e43f2c526f21e\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:56Z\",\"updated_at\":\"2022-02-28T23:41:56Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_99334f3ac0bb46379286c2923892aaab\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:57Z\",\"updated_at\":\"2022-02-28T23:41:57Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_49bf60b81a2341569fffa8fb795674e9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:57Z\",\"updated_at\":\"2022-02-28T23:41:57Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f6e9fa75d9c94fad856b0acb4eda5eff\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:57Z\",\"updated_at\":\"2022-02-28T23:41:57Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_106b028fa3f942f29bc64987466b35f1\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:57Z\",\"updated_at\":\"2022-02-28T23:41:57Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_03f088c498f011eca619ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:56+00:00\",\"updated_at\":\"2022-02-28T23:41:56+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_03f2a41198f011ecbcccac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:56+00:00\",\"updated_at\":\"2022-02-28T23:41:56+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_03f088c498f011eca619ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:56+00:00\",\"updated_at\":\"2022-02-28T23:41:56+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:57.367082-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/rates/rate_99334f3ac0bb46379286c2923892aaab", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dc5e4d1742300a40932", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"bae4a6516498a2c091a255a319e3eccc\"", + "X-Request-ID": "89964488-83f4-466f-bd37-d7b2d5245d56", + "x-runtime": "0.167756", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "513" + }, + "Body": "{\"id\":\"rate_99334f3ac0bb46379286c2923892aaab\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:57Z\",\"updated_at\":\"2022-02-28T23:41:57Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_a8ca73b177ac443dadd04dc867708093\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:57.918857-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/all.json b/EasyPost.Tests.Net/cassettes/report/all.json new file mode 100644 index 000000000..eb397e752 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/shipment?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5dcce4d1746200a40aa6", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"f84127be28184f380d0fa61b12e0e5c9\"", + "X-Request-ID": "4d10bc74-09d0-4d01-ac87-d0d118fb7b6b", + "x-runtime": "0.037708", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "3065" + }, + "Body": "{\"reports\":[{\"id\":\"shprep_a25c8b6292f249ad90916c893b5feb26\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T23:42:02Z\",\"updated_at\":\"2022-02-28T23:42:02Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false},{\"id\":\"shprep_e3d2743eab8e4650a22bed5e3a9db944\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T23:41:59Z\",\"updated_at\":\"2022-02-28T23:42:01Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/shipment_report/20220228/52c8c9ebc3994e9ebdcbb6ed618eee28.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234204Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=10340c6063e9bfcc3485080203ef04ec4f6e07919addcd8ce2a99d384790dd7a\",\"url_expires_at\":\"2022-02-28T23:42:34Z\",\"include_children\":false},{\"id\":\"shprep_17e53e0baf874b379448e47558547ff9\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T22:01:07Z\",\"updated_at\":\"2022-02-28T22:01:09Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/shipment_report/20220228/e90fcba2ad41478881b6ead40119617d.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234204Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=d9ad155f4d21f910d44652235c27124457591ce3e39d2a606a546494475b57db\",\"url_expires_at\":\"2022-02-28T23:42:34Z\",\"include_children\":false},{\"id\":\"shprep_bcd09fdf1a2741a99c415e6ff49543e9\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T22:01:03Z\",\"updated_at\":\"2022-02-28T22:01:06Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/shipment_report/20220228/d501b5dfd89a48d39fada869f759aff7.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234204Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=06a3ef49d734171d72c307650e1b3d389e60f404c67c1908812eb2853da24c20\",\"url_expires_at\":\"2022-02-28T23:42:34Z\",\"include_children\":false},{\"id\":\"shprep_7f331778be0e40718920a5b7a029a5fa\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T19:42:03Z\",\"updated_at\":\"2022-02-28T19:42:05Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/shipment_report/20220228/ec37c0dd0a30403e89eb612030328763.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234204Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=b8649a2bb18e8682aaf361cdc15534ff923818e43152149c71f8a2a9bcfc5162\",\"url_expires_at\":\"2022-02-28T23:42:34Z\",\"include_children\":false}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:04.608147-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/create_payment_log_report.json b/EasyPost.Tests.Net/cassettes/report/create_payment_log_report.json new file mode 100644 index 000000000..31d65c317 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/create_payment_log_report.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/payment_log?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5dc6e4d1742400a40949", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"4811ef014e2a11c186d107e58e2759c3\"", + "X-Request-ID": "3747fc57-ea29-4ac5-a9b2-8ec1b5d85942", + "x-runtime": "0.043317", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "259" + }, + "Body": "{\"id\":\"plrep_1a42ae5e8ecf490d9c6155bbc7beb93f\",\"object\":\"PaymentLogReport\",\"created_at\":\"2022-02-28T23:41:58Z\",\"updated_at\":\"2022-02-28T23:41:58Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:58.333714-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/create_refund_report.json b/EasyPost.Tests.Net/cassettes/report/create_refund_report.json new file mode 100644 index 000000000..7a1b547b3 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/create_refund_report.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/refund?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5dc6e4d1742500a4095f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"590ccf782cf55b92e207281759d045a3\"", + "X-Request-ID": "56f7171e-cd8d-462e-9064-da1b43dfe23d", + "x-runtime": "0.029102", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "256" + }, + "Body": "{\"id\":\"refrep_776c7f5da43f49859db49096614cb361\",\"object\":\"RefundReport\",\"created_at\":\"2022-02-28T23:41:58Z\",\"updated_at\":\"2022-02-28T23:41:58Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:58.733754-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/create_shipment_invoice_report.json b/EasyPost.Tests.Net/cassettes/report/create_shipment_invoice_report.json new file mode 100644 index 000000000..4c02ba816 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/create_shipment_invoice_report.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/shipment_invoice?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5dc7e4d1742700a40992", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"2358b4753765272b9ad2b99147b52e44\"", + "X-Request-ID": "3bdd3e11-d7e4-4357-91b0-f4a42a9a657c", + "x-runtime": "0.036418", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "293" + }, + "Body": "{\"id\":\"shpinvrep_07bb830737054dcf829b7d84ddafc348\",\"object\":\"ShipmentInvoiceReport\",\"created_at\":\"2022-02-28T23:41:59Z\",\"updated_at\":\"2022-02-28T23:41:59Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:59.559424-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/create_shipment_report.json b/EasyPost.Tests.Net/cassettes/report/create_shipment_report.json new file mode 100644 index 000000000..71b8cc34c --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/create_shipment_report.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/shipment?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5dc7e4d1742600a40979", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"3488826a3645a20490bce40f0bb3b821\"", + "X-Request-ID": "ad2a75e2-e4d1-46d2-b903-170928efc3a8", + "x-runtime": "0.040114", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "283" + }, + "Body": "{\"id\":\"shprep_e3d2743eab8e4650a22bed5e3a9db944\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T23:41:59Z\",\"updated_at\":\"2022-02-28T23:41:59Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:59.14567-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/create_tracker_report.json b/EasyPost.Tests.Net/cassettes/report/create_tracker_report.json new file mode 100644 index 000000000..5e2f756e5 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/create_tracker_report.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/tracker?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5dc8e4d1744000a409a9", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"ea6b85038538c7bd45ca2d3a8535e72f\"", + "X-Request-ID": "b60d4fec-a03a-4e4c-b2cb-371ec2b91412", + "x-runtime": "0.048293", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "685" + }, + "Body": "{\"id\":\"trkrep_391a27d3e52c4eb9bf150830dce0759a\",\"object\":\"TrackerReport\",\"created_at\":\"2022-02-25T19:32:58Z\",\"updated_at\":\"2022-02-28T22:01:13Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/tracker_report/20220228/978946e53f5146c89ffa64224827c679.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234200Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=9a57c43eca7f267c2ce58a458a49f7b58cd5e88700a1b979c3184e8176c10cbb\",\"url_expires_at\":\"2022-02-28T23:42:30Z\",\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:41:59.982273-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/retrieve_payment_log_report.json b/EasyPost.Tests.Net/cassettes/report/retrieve_payment_log_report.json new file mode 100644 index 000000000..0b172252e --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/retrieve_payment_log_report.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/payment_log?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596082621d5dc8e4d1744100a409ba", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"26b0618a772e4c87c989a7a21cc809d7\"", + "X-Request-ID": "ca5eb674-4865-4d6e-905f-c599c585e75a", + "x-runtime": "0.040045", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "259" + }, + "Body": "{\"id\":\"plrep_c722371abc714356a218aebfffe162af\",\"object\":\"PaymentLogReport\",\"created_at\":\"2022-02-28T23:42:00Z\",\"updated_at\":\"2022-02-28T23:42:00Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:00.393621-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/plrep_c722371abc714356a218aebfffe162af", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dc8e4d1744200a409cd", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"455868b1390157d29dea235276328bd5\"", + "X-Request-ID": "054ea6b2-5349-45c7-b3b6-39d16c36b267", + "x-runtime": "0.033075", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "261" + }, + "Body": "{\"id\":\"plrep_c722371abc714356a218aebfffe162af\",\"object\":\"PaymentLogReport\",\"created_at\":\"2022-02-28T23:42:00Z\",\"updated_at\":\"2022-02-28T23:42:00Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"empty\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:00.813107-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/retrieve_refund_report.json b/EasyPost.Tests.Net/cassettes/report/retrieve_refund_report.json new file mode 100644 index 000000000..b38fbc965 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/retrieve_refund_report.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/refund?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5dc9e4d1744300a409e1", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"107f117b2ed736583e49dadb8441f26b\"", + "X-Request-ID": "a66edee9-3afb-43a9-852f-5f263bea3cac", + "x-runtime": "0.043398", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "256" + }, + "Body": "{\"id\":\"refrep_d72c976ea61347dca9c9ceec8af22947\",\"object\":\"RefundReport\",\"created_at\":\"2022-02-28T23:42:01Z\",\"updated_at\":\"2022-02-28T23:42:01Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:01.223926-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/refrep_d72c976ea61347dca9c9ceec8af22947", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5dc9e4d1744400a409ea", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"107f117b2ed736583e49dadb8441f26b\"", + "X-Request-ID": "13de1519-191f-437c-84ce-7cae07ab318b", + "x-runtime": "0.036613", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "256" + }, + "Body": "{\"id\":\"refrep_d72c976ea61347dca9c9ceec8af22947\",\"object\":\"RefundReport\",\"created_at\":\"2022-02-28T23:42:01Z\",\"updated_at\":\"2022-02-28T23:42:01Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:01.636266-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_invoice_report.json b/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_invoice_report.json new file mode 100644 index 000000000..5ed9405d0 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_invoice_report.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/shipment_invoice?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5dcae4d1744700a40a45", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"7a24c82aea5da8472c632cde5f76a395\"", + "X-Request-ID": "c8c9944f-cc1a-4238-b5d4-853cf9799633", + "x-runtime": "0.043587", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "293" + }, + "Body": "{\"id\":\"shpinvrep_1d64156c063a47bbbd4545c52e5fde2e\",\"object\":\"ShipmentInvoiceReport\",\"created_at\":\"2022-02-28T23:42:02Z\",\"updated_at\":\"2022-02-28T23:42:02Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:02.847576-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/shpinvrep_1d64156c063a47bbbd4545c52e5fde2e", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5dcbe4d1744800a40a5f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"8de62d716486b8a0a72e50db85ad228a\"", + "X-Request-ID": "6e134fab-135f-4544-ba91-e299e653c76c", + "x-runtime": "0.030823", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "295" + }, + "Body": "{\"id\":\"shpinvrep_1d64156c063a47bbbd4545c52e5fde2e\",\"object\":\"ShipmentInvoiceReport\",\"created_at\":\"2022-02-28T23:42:02Z\",\"updated_at\":\"2022-02-28T23:42:02Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"empty\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:03.26105-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_report.json b/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_report.json new file mode 100644 index 000000000..415d1fcae --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/retrieve_shipment_report.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/shipment?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596081621d5dcae4d1744500a40a09", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"96d4be68a01a1b941f9e00a2da8c25ed\"", + "X-Request-ID": "cf33785f-a8b7-4a41-8fe8-3bc0dafdb1a1", + "x-runtime": "0.043593", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "283" + }, + "Body": "{\"id\":\"shprep_a25c8b6292f249ad90916c893b5feb26\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T23:42:02Z\",\"updated_at\":\"2022-02-28T23:42:02Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:02.051569-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/shprep_a25c8b6292f249ad90916c893b5feb26", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5dcae4d1744600a40a2d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"96d4be68a01a1b941f9e00a2da8c25ed\"", + "X-Request-ID": "f8b95578-ce22-4cf7-adb0-8a03babce0d9", + "x-runtime": "0.032870", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "283" + }, + "Body": "{\"id\":\"shprep_a25c8b6292f249ad90916c893b5feb26\",\"object\":\"ShipmentReport\",\"created_at\":\"2022-02-28T23:42:02Z\",\"updated_at\":\"2022-02-28T23:42:02Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"new\",\"url\":null,\"url_expires_at\":null,\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:02.443965-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/report/retrieve_tracker_report.json b/EasyPost.Tests.Net/cassettes/report/retrieve_tracker_report.json new file mode 100644 index 000000000..fe26729a6 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/report/retrieve_tracker_report.json @@ -0,0 +1,98 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/reports/tracker?start_date=2022-02-01&end_date=2022-02-03", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5dcbe4d1746000a40a74", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"9981fe77ff35ec2a33f29269b2ee95a0\"", + "X-Request-ID": "4c74dddb-db7e-471d-a319-be89e5f6f3a1", + "x-runtime": "0.117855", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "685" + }, + "Body": "{\"id\":\"trkrep_391a27d3e52c4eb9bf150830dce0759a\",\"object\":\"TrackerReport\",\"created_at\":\"2022-02-25T19:32:58Z\",\"updated_at\":\"2022-02-28T22:01:13Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/tracker_report/20220228/978946e53f5146c89ffa64224827c679.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234203Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=3ce048fde566929919d82cff1e0e90de845aa3997cd46e8b8ad6aa232eaad815\",\"url_expires_at\":\"2022-02-28T23:42:33Z\",\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:03.794745-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/reports/trkrep_391a27d3e52c4eb9bf150830dce0759a", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5dcce4d1746100a40a91", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"80a104f1a0680e0ea71313bb20e2ad3c\"", + "X-Request-ID": "deb52c61-88a0-4de3-be83-15220e176039", + "x-runtime": "0.034136", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "685" + }, + "Body": "{\"id\":\"trkrep_391a27d3e52c4eb9bf150830dce0759a\",\"object\":\"TrackerReport\",\"created_at\":\"2022-02-25T19:32:58Z\",\"updated_at\":\"2022-02-28T22:01:13Z\",\"start_date\":\"2022-02-01\",\"end_date\":\"2022-02-03\",\"mode\":\"test\",\"status\":\"available\",\"url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/tracker_report/20220228/978946e53f5146c89ffa64224827c679.zip?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAY27LO6YQVHEFDONM%2F20220228%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220228T234204Z&X-Amz-Expires=30&X-Amz-SignedHeaders=host&X-Amz-Signature=b8e929e62f147bf09a23cd0149f765a811055aa40b8957f693a392042e295cc6\",\"url_expires_at\":\"2022-02-28T23:42:34Z\",\"include_children\":false}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:04.189101-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/scan_form/all.json b/EasyPost.Tests.Net/cassettes/scan_form/all.json new file mode 100644 index 000000000..0b9a1e364 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/scan_form/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/scan_forms?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dd1e4d1746800a40c48", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"baf742cb6f733706f65fe105f2952d24\"", + "X-Request-ID": "6816b4ad-0be9-4807-a22c-7e3d87c1f7b9", + "x-runtime": "0.040950", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "4522" + }, + "Body": "{\"scan_forms\":[{\"id\":\"sf_b9e74ce6d52442489edd39c78dcb483a\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"tracking_codes\":[\"9400100897846109428468\"],\"address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/1cca847058204a0b8d967ae73e22f582.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_1e47e4489d19465d99473696f09c7d82\",\"confirmation\":null},{\"id\":\"sf_0bce9f3410384e3e917baaab9006cc73\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:06Z\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"tracking_codes\":[\"9400100897846109428451\"],\"address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/b2c09e215a4c4835a4e604f94f5ebbee.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_f56073d4a5b24b6fac002bae9a519cd4\",\"confirmation\":null},{\"id\":\"sf_96cb1ae7f2484ec8bf3f749a70eebbc6\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:41:11Z\",\"updated_at\":\"2022-02-28T23:41:11Z\",\"tracking_codes\":[\"9400100897846109428314\"],\"address\":{\"id\":\"adr_e74ab43d98ef11ecb6f7ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:08+00:00\",\"updated_at\":\"2022-02-28T23:41:08+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/5264d87dcab44e16ac99c54f2263cfea.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_f158681ea94c4b0ab1e2a1ba70e78305\",\"confirmation\":null},{\"id\":\"sf_73d57d421ff94b1e80bebb45c4704efa\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T22:01:15Z\",\"updated_at\":\"2022-02-28T22:01:15Z\",\"tracking_codes\":[\"9400100897846109416298\"],\"address\":{\"id\":\"adr_f234368a98e111ecaeabac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:14+00:00\",\"updated_at\":\"2022-02-28T22:01:14+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/e8e668c5dce949a985364e5b7e2df9a6.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_456ba6e832a641dfba7582544840c5bc\",\"confirmation\":null},{\"id\":\"sf_a62e1560e000483e97cd2d2730aae8bc\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T22:01:13Z\",\"updated_at\":\"2022-02-28T22:01:13Z\",\"tracking_codes\":[\"9400100897846109416281\"],\"address\":{\"id\":\"adr_f0afa7d698e111ecb0c1ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T22:01:11+00:00\",\"updated_at\":\"2022-02-28T22:01:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/4a1211345df844849c343a64553e85e3.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_740760ae262340928b3670753441399d\",\"confirmation\":null}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:09.655627-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/scan_form/create.json b/EasyPost.Tests.Net/cassettes/scan_form/create.json new file mode 100644 index 000000000..a2f589e83 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/scan_form/create.json @@ -0,0 +1,105 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5dcde4d1746300a40ac0", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_49da8b965813436a8b42ac997ce1493f", + "ETag": "W/\"97e8512753d881be26b5a5fe14bad911\"", + "X-Request-ID": "b5c7d127-d719-42ad-93c6-805964ff1e8c", + "x-runtime": "1.011860", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:05Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428451\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_9750b733efd34631b17b4e9c4ce42066\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_5f1aaa7c4d7c4e14b1225ce6a7550981\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:05Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/a4f0efcae7624f2f8cbd1a81e9eb6d09.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_018bc0f5d4f443138a1a3cae6b774c1a\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_0411323d85884a46b494dd19264ad222\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_38c477329fe444489970a23a915e392f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_240295ec9cdc413ea3ee618574078bca\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428451\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:06Z\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzI0MDI5NWVjOWNkYzQxM2VhM2VlNjE4NTc0MDc4YmNh\"},\"to_address\":{\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:06.004915-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/scan_forms", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5641" + }, + "Body": "{\"scan_form\":{\"shipments\":[{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:05Z\",\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:42:05Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:05Z\",\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:42:05Z\",\"height\":4.0,\"id\":\"prcl_9750b733efd34631b17b4e9c4ce42066\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:42:05Z\",\"date_advance\":0,\"id\":\"pl_5f1aaa7c4d7c4e14b1225ce6a7550981\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:05Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/a4f0efcae7624f2f8cbd1a81e9eb6d09.png\",\"updated_at\":\"2022-02-28T23:42:05Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:05Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_018bc0f5d4f443138a1a3cae6b774c1a\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"updated_at\":\"2022-02-28T23:42:05Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:05Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_0411323d85884a46b494dd19264ad222\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"updated_at\":\"2022-02-28T23:42:05Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:05Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_38c477329fe444489970a23a915e392f\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"updated_at\":\"2022-02-28T23:42:05Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:05Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"updated_at\":\"2022-02-28T23:42:05Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:05Z\",\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:05Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"updated_at\":\"2022-02-28T23:42:05Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:05Z\",\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:42:06Z\",\"id\":\"trk_240295ec9cdc413ea3ee618574078bca\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrXzI0MDI5NWVjOWNkYzQxM2VhM2VlNjE4NTc0MDc4YmNh\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428451\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:42:06Z\"},\"tracking_code\":\"9400100897846109428451\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"usps_zone\":\"1\"}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dcee4d1746400a40ba1", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"d3c66cb3f771aa988037d89a9d29f328\"", + "X-Request-ID": "7e938fa5-8d51-490a-9af1-5b6b53af94b4", + "x-runtime": "0.275205", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "897" + }, + "Body": "{\"id\":\"sf_0bce9f3410384e3e917baaab9006cc73\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:06Z\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"tracking_codes\":[\"9400100897846109428451\"],\"address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/b2c09e215a4c4835a4e604f94f5ebbee.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_f56073d4a5b24b6fac002bae9a519cd4\",\"confirmation\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:06.786744-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/scan_form/retrieve.json b/EasyPost.Tests.Net/cassettes/scan_form/retrieve.json new file mode 100644 index 000000000..b1608d735 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/scan_form/retrieve.json @@ -0,0 +1,153 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5dcfe4d1746500a40bcc", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_fcdadf47a75e479d9c2a62977fb28d96", + "ETag": "W/\"ee83c314aed96a39a6982761e38ecb4c\"", + "X-Request-ID": "afa24efa-edad-47dd-999f-9f6513bf5678", + "x-runtime": "0.943009", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:07Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428468\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_641d5d9cd9654ce0a7dfadbe1afa99b8\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_34cffbc014e34a26bac22d1ebf29b1ce\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:07Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/270cb79c321a4ed791758387dc493a94.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_1edf8f1febd041f1a3ffbdedfdc436d4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_0775b09ac8a6416bac85b443dbae070f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_791ae4e9ae814643902ee2982a4194c9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_4d669906d64a47c488172ebe028c3497\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428468\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzRkNjY5OTA2ZDY0YTQ3YzQ4ODE3MmViZTAyOGMzNDk3\"},\"to_address\":{\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:08.110332-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/scan_forms", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5641" + }, + "Body": "{\"scan_form\":{\"shipments\":[{\"buyer_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:07Z\",\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"created_at\":\"2022-02-28T23:42:07Z\",\"fees\":[{\"amount\":0.01,\"charged\":true,\"refunded\":false,\"type\":\"LabelFee\"},{\"amount\":5.49,\"charged\":true,\"refunded\":false,\"type\":\"PostageFee\"}],\"forms\":[],\"from_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:07Z\",\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"verifications\":{},\"zip\":\"94107\"},\"id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"peel_and_return\":false},\"parcel\":{\"created_at\":\"2022-02-28T23:42:07Z\",\"height\":4.0,\"id\":\"prcl_641d5d9cd9654ce0a7dfadbe1afa99b8\",\"length\":10.0,\"mode\":\"test\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"weight\":15.4,\"width\":8.0},\"postage_label\":{\"created_at\":\"2022-02-28T23:42:07Z\",\"date_advance\":0,\"id\":\"pl_34cffbc014e34a26bac22d1ebf29b1ce\",\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:07Z\",\"label_file_type\":\"image/png\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/270cb79c321a4ed791758387dc493a94.png\",\"updated_at\":\"2022-02-28T23:42:08Z\"},\"rates\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:07Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"updated_at\":\"2022-02-28T23:42:07Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:07Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"id\":\"rate_1edf8f1febd041f1a3ffbdedfdc436d4\",\"list_currency\":\"USD\",\"list_rate\":\"23.75\",\"mode\":\"test\",\"rate\":\"23.75\",\"retail_currency\":\"USD\",\"retail_rate\":\"27.40\",\"service\":\"Express\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"updated_at\":\"2022-02-28T23:42:07Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:07Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_0775b09ac8a6416bac85b443dbae070f\",\"list_currency\":\"USD\",\"list_rate\":\"7.22\",\"mode\":\"test\",\"rate\":\"7.22\",\"retail_currency\":\"USD\",\"retail_rate\":\"7.22\",\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"updated_at\":\"2022-02-28T23:42:07Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:07Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_791ae4e9ae814643902ee2982a4194c9\",\"list_currency\":\"USD\",\"list_rate\":\"7.37\",\"mode\":\"test\",\"rate\":\"7.37\",\"retail_currency\":\"USD\",\"retail_rate\":\"8.70\",\"service\":\"Priority\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"updated_at\":\"2022-02-28T23:42:07Z\"}],\"return_address\":{\"city\":\"San Francisco\",\"company\":\"EasyPost\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:07Z\",\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"mode\":\"test\",\"name\":\"Jack Sparrow\",\"phone\":\"5555555555\",\"state\":\"CA\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"verifications\":{},\"zip\":\"94107\"},\"selected_rate\":{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:07Z\",\"currency\":\"USD\",\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"list_currency\":\"USD\",\"list_rate\":\"5.49\",\"mode\":\"test\",\"rate\":\"5.49\",\"retail_currency\":\"USD\",\"retail_rate\":\"5.49\",\"service\":\"First\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"updated_at\":\"2022-02-28T23:42:07Z\"},\"status\":\"unknown\",\"to_address\":{\"city\":\"SAN FRANCISCO\",\"company\":\"EASYPOST\",\"country\":\"US\",\"created_at\":\"2022-02-28T23:42:07Z\",\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"mode\":\"test\",\"name\":\"JACK SPARROW\",\"phone\":\"5555555555\",\"residential\":true,\"state\":\"CA\",\"street1\":\"388 TOWNSEND ST APT 20\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"verifications\":{\"delivery\":{\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"},\"errors\":[],\"success\":true},\"zip4\":{\"errors\":[],\"success\":true}},\"zip\":\"94107-1670\"},\"tracker\":{\"carrier\":\"USPS\",\"created_at\":\"2022-02-28T23:42:08Z\",\"id\":\"trk_4d669906d64a47c488172ebe028c3497\",\"mode\":\"test\",\"public_url\":\"https://track.easypost.com/djE6dHJrXzRkNjY5OTA2ZDY0YTQ3YzQ4ODE3MmViZTAyOGMzNDk3\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428468\",\"tracking_details\":[],\"tracking_updated_at\":\"0001-01-01T00:00:00Z\",\"updated_at\":\"2022-02-28T23:42:08Z\"},\"tracking_code\":\"9400100897846109428468\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"usps_zone\":\"1\"}]}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dd0e4d1746600a40c0e", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"2eda5fe04afff2cbd02d636c1c3e035e\"", + "X-Request-ID": "af8aebe8-5590-400b-924f-5255cc192474", + "x-runtime": "0.298428", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "897" + }, + "Body": "{\"id\":\"sf_b9e74ce6d52442489edd39c78dcb483a\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"tracking_codes\":[\"9400100897846109428468\"],\"address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/1cca847058204a0b8d967ae73e22f582.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_1e47e4489d19465d99473696f09c7d82\",\"confirmation\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:08.835935-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/scan_forms/sf_b9e74ce6d52442489edd39c78dcb483a", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5dd1e4d1746700a40c2f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"2eda5fe04afff2cbd02d636c1c3e035e\"", + "X-Request-ID": "0c1ab661-4d41-43f5-b722-7e7b062593e7", + "x-runtime": "0.031167", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "897" + }, + "Body": "{\"id\":\"sf_b9e74ce6d52442489edd39c78dcb483a\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"tracking_codes\":[\"9400100897846109428468\"],\"address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/1cca847058204a0b8d967ae73e22f582.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_1e47e4489d19465d99473696f09c7d82\",\"confirmation\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:09.23414-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/all.json b/EasyPost.Tests.Net/cassettes/shipment/all.json new file mode 100644 index 000000000..6fe329c46 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/all.json @@ -0,0 +1,51 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/shipments?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dd4e4d1748300a40d18", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"ac7b757f5c0ad4523dfe7518530a39a5\"", + "X-Request-ID": "e1af67e1-c76a-40c4-9b7c-800cec08731a", + "x-runtime": "0.429957", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "41877" + }, + "Body": "{\"shipments\":[{\"created_at\":\"2022-02-28T23:42:07Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428468\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"batch_id\":\"batch_1e47e4489d19465d99473696f09c7d82\",\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_641d5d9cd9654ce0a7dfadbe1afa99b8\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_34cffbc014e34a26bac22d1ebf29b1ce\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:07Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/270cb79c321a4ed791758387dc493a94.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_1edf8f1febd041f1a3ffbdedfdc436d4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_0775b09ac8a6416bac85b443dbae070f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_791ae4e9ae814643902ee2982a4194c9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":{\"id\":\"sf_b9e74ce6d52442489edd39c78dcb483a\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"tracking_codes\":[\"9400100897846109428468\"],\"address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/1cca847058204a0b8d967ae73e22f582.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_1e47e4489d19465d99473696f09c7d82\",\"confirmation\":null},\"selected_rate\":{\"id\":\"rate_28834d975f2d45139be385f9ebbf0dce\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:07Z\",\"updated_at\":\"2022-02-28T23:42:07Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_4d669906d64a47c488172ebe028c3497\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428468\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:08Z\",\"updated_at\":\"2022-02-28T23:42:08Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:08Z\",\"shipment_id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:08Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:08Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzRkNjY5OTA2ZDY0YTQ3YzQ4ODE3MmViZTAyOGMzNDk3\"},\"to_address\":{\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0a3b6e1398f011ecbfabac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0a39847d98f011ecbfaaac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:07+00:00\",\"updated_at\":\"2022-02-28T23:42:07+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_fcdadf47a75e479d9c2a62977fb28d96\",\"object\":\"Shipment\"},{\"created_at\":\"2022-02-28T23:42:05Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428451\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"batch_id\":\"batch_f56073d4a5b24b6fac002bae9a519cd4\",\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_9750b733efd34631b17b4e9c4ce42066\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_5f1aaa7c4d7c4e14b1225ce6a7550981\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:05Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/a4f0efcae7624f2f8cbd1a81e9eb6d09.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_018bc0f5d4f443138a1a3cae6b774c1a\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_0411323d85884a46b494dd19264ad222\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_38c477329fe444489970a23a915e392f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":{\"id\":\"sf_0bce9f3410384e3e917baaab9006cc73\",\"object\":\"ScanForm\",\"created_at\":\"2022-02-28T23:42:06Z\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"tracking_codes\":[\"9400100897846109428451\"],\"address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"status\":\"created\",\"message\":null,\"form_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/scan_form/20220228/b2c09e215a4c4835a4e604f94f5ebbee.pdf\",\"form_file_type\":null,\"batch_id\":\"batch_f56073d4a5b24b6fac002bae9a519cd4\",\"confirmation\":null},\"selected_rate\":{\"id\":\"rate_f3d736a042a648819aba88d690b5e3fb\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:05Z\",\"updated_at\":\"2022-02-28T23:42:05Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_240295ec9cdc413ea3ee618574078bca\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428451\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:06Z\",\"updated_at\":\"2022-02-28T23:42:06Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:06Z\",\"shipment_id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:06Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:06Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzI0MDI5NWVjOWNkYzQxM2VhM2VlNjE4NTc0MDc4YmNh\"},\"to_address\":{\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_08f2d9a398f011ecba8eac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_08f09fcf98f011ecbde2ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:05+00:00\",\"updated_at\":\"2022-02-28T23:42:05+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_49da8b965813436a8b42ac997ce1493f\",\"object\":\"Shipment\"},{\"created_at\":\"2022-02-28T23:41:51Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428437\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"batch_id\":\"batch_83bda1d93e164e47a3fa5ba8780bfcac\",\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:51+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_603572466001446c88667cbebbd7f8d2\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_2a51549373bb47d3b18176784997beae\",\"created_at\":\"2022-02-28T23:41:52Z\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:52Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/4373c9355d32494988d0741fa1f629eb.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_9aa98f45ce9449d7b9bcfe485c9dc99c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_539e924548ed44118af46ff9b2d93e05\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_706608a88c874b3f9c05d9eb5e737c76\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:51Z\",\"updated_at\":\"2022-02-28T23:41:51Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_973ba61a9e4748e68132e401b338af03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:52Z\",\"updated_at\":\"2022-02-28T23:41:52Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_f8afa8607104487e94b774d6deacb0e2\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428437\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:53Z\",\"updated_at\":\"2022-02-28T23:41:53Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:53Z\",\"shipment_id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:53Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:53Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrX2Y4YWZhODYwNzEwNDQ4N2U5NGI3NzRkNmRlYWNiMGUy\"},\"to_address\":{\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:52+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0105d5dd98f011ecb8f9ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:51+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0103e1aa98f011ecbc2cac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:51+00:00\",\"updated_at\":\"2022-02-28T23:41:52+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_c9e2e3a498fd41309cb418dace3cd0a5\",\"object\":\"Shipment\"},{\"created_at\":\"2022-02-28T23:41:47Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428420\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"batch_id\":\"batch_f13317eee0c84befbcff1a2c455e1c4e\",\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:47+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_9e6f4c2284e44bdba5c084d8b02807ce\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:47Z\",\"updated_at\":\"2022-02-28T23:41:47Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_33c1c17bd1b24c3faad613c4c0ece531\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:48Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/d95b132f7d7a45268db1f62cdb5a8b8d.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_9da8ace026e94afb90ecd1ebc599d1a4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a28d3d8a079449f39408d70add8743b6\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f55a46928dbd4bfb80c586a49ee36a21\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_9706068615994ca78632696b98737375\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_9706068615994ca78632696b98737375\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_fd07ffd1ea2d4ee9820ff6704cbb3f7b\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428420\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:48Z\",\"updated_at\":\"2022-02-28T23:41:48Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:48Z\",\"shipment_id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:48Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:48Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZkMDdmZmQxZWEyZDRlZTk4MjBmZjY3MDRjYmIzZjdi\"},\"to_address\":{\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:48+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_feb8e1b198ef11ecbd45ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:47+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_feb715f398ef11ecb88cac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:47+00:00\",\"updated_at\":\"2022-02-28T23:41:48+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_c958dda98371438f97cb100b1a59376d\",\"object\":\"Shipment\"},{\"created_at\":\"2022-02-28T23:41:44Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428413\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"batch_id\":\"batch_470630f42b3b4c0db908695a3fce864b\",\"batch_status\":\"postage_purchased\",\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:44+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_1b383f4af1ee4f3d858a675cb4a983db\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_00eeed8bac4d4943b0564f95a6f17e0d\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:41:45Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/5a5dd743aba14ffcb64b708e843a779b.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_098a2c9d5fe54529aed5fa6a0ff495fe\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_a42f268b792646118841506389d054e0\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f07e7ed4d1cd4129a18b68a9b0ac4f89\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:44Z\",\"updated_at\":\"2022-02-28T23:41:44Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_80e0834dca834e24bdf9369563e69964\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_063b17c42acd499db404652c5594bda5\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428413\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:41:45Z\",\"updated_at\":\"2022-02-28T23:41:45Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:41:45Z\",\"shipment_id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:41:45Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:18:45Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzA2M2IxN2M0MmFjZDQ5OWRiNDA0NjUyYzU1OTRiZGE1\"},\"to_address\":{\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:45+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_fcce2fca98ef11ecbb3bac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:44+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_fccc2a1498ef11ecbcc1ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:41:44+00:00\",\"updated_at\":\"2022-02-28T23:41:45+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_e97c2c97867d4e3a937386b88700b625\",\"object\":\"Shipment\"}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:13.428811-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/buy.json b/EasyPost.Tests.Net/cassettes/shipment/buy.json new file mode 100644 index 000000000..2da1d1d6b --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/buy.json @@ -0,0 +1,105 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "888" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]},\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\"},\"reference\":\"123\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5dd5e4d1748400a40d51", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_852dbd3794be4bbfae28f91fc71a14c6", + "ETag": "W/\"9b6917c6c2c13bae19b5cee25123ee97\"", + "X-Request-ID": "305b4101-5780-4cbf-b062-0c27490b495f", + "x-runtime": "0.676337", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6400" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:13Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:14Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_ae8bcf4c058e48a38af51a83d7abd247\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_c1d50c874211440d8114e2367d09b0dc\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0e325e0098f011ecbc19ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_0b775c969c68446aaf3232f016507492\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_f3878e0eca88441886dc719aa39f5956\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f9562a75103d405c9c53ff13722318c9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d7f4e69fda634c9f9bce7411aa98585e\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_77d4a198361e4f2ba088b421b3ee3f66\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_0e306af698f011ecbc18ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0e325e0098f011ecbc19ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0e306af698f011ecbc18ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:14.575269-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments/shp_852dbd3794be4bbfae28f91fc71a14c6/buy", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "55" + }, + "Body": "{\"rate\":{\"id\":\"rate_f3878e0eca88441886dc719aa39f5956\"}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dd7e4d1748500a40d83", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"ed9992b2edec72d4de3c0c0f13c030c1\"", + "X-Request-ID": "3a18f78a-d491-4107-a9b5-056c67a90466", + "x-runtime": "0.832537", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "8497" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:13Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428475\",\"updated_at\":\"2022-02-28T23:42:15Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_ae8bcf4c058e48a38af51a83d7abd247\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_c1d50c874211440d8114e2367d09b0dc\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0e325e0098f011ecbc19ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_0b775c969c68446aaf3232f016507492\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:13Z\",\"updated_at\":\"2022-02-28T23:42:13Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_41429e872b2e4d75884606a6a3eea136\",\"created_at\":\"2022-02-28T23:42:15Z\",\"updated_at\":\"2022-02-28T23:42:15Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:15Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/3eaa3db70da44d248d65b0130ddb06e0.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_f3878e0eca88441886dc719aa39f5956\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f9562a75103d405c9c53ff13722318c9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d7f4e69fda634c9f9bce7411aa98585e\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_77d4a198361e4f2ba088b421b3ee3f66\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:14Z\",\"updated_at\":\"2022-02-28T23:42:14Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_f3878e0eca88441886dc719aa39f5956\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:15Z\",\"updated_at\":\"2022-02-28T23:42:15Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_4c82eba1ed274c74a0660c6836cc1c08\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428475\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:15Z\",\"updated_at\":\"2022-02-28T23:42:15Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzRjODJlYmExZWQyNzRjNzRhMDY2MGM2ODM2Y2MxYzA4\"},\"to_address\":{\"id\":\"adr_0e306af698f011ecbc18ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:15+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0e325e0098f011ecbc19ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:13+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0e306af698f011ecbc18ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:13+00:00\",\"updated_at\":\"2022-02-28T23:42:15+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_852dbd3794be4bbfae28f91fc71a14c6\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:15.904104-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/convert_label.json b/EasyPost.Tests.Net/cassettes/shipment/convert_label.json new file mode 100644 index 000000000..fc1ef59e8 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/convert_label.json @@ -0,0 +1,103 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5ddae4d1748800a40e2d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_96dbc60d5a114f70bdbbc8040a21666c", + "ETag": "W/\"2ab83aa2ff7f8a2422612576d0959869\"", + "X-Request-ID": "8a0581cb-975c-4c49-9c02-096b3ac9a640", + "x-runtime": "0.935912", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:18Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428482\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_11087a1298f011ecbc94ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_e3851f84a2234294a59bce268cefd38f\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_c116fbaa7b4a48239e1cde04bba4eb8f\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:19Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/d49af4dcc8ea4dedac8d4fa4b9d8546a.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_5b66ce57ed954a389b7e4231d1eb3a69\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_2af3f8b5a7db4e9583bbf5813f816d5c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec0ff036565e4fe88c9d3efa965fb6ae\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_454379211772471d9452d7da97e0be48\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_454379211772471d9452d7da97e0be48\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_461da2c9fb6a44358cf26e6d006f2b8c\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428482\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzQ2MWRhMmM5ZmI2YTQ0MzU4Y2YyNmU2ZDAwNmYyYjhj\"},\"to_address\":{\"id\":\"adr_1106214898f011ecbc93ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_11087a1298f011ecbc94ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_1106214898f011ecbc93ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:19.5889-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/shipments/shp_96dbc60d5a114f70bdbbc8040a21666c/label?file_format=ZPL", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5ddce4d1748900a40e5f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"fda1c2152c60ca53f1d3b7f6ac5526cf\"", + "X-Request-ID": "247ab874-667c-45e6-bc5b-545afe564e53", + "x-runtime": "1.552482", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "8073" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:18Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428482\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_11087a1298f011ecbc94ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_e3851f84a2234294a59bce268cefd38f\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_c116fbaa7b4a48239e1cde04bba4eb8f\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:21Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:19Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/d49af4dcc8ea4dedac8d4fa4b9d8546a.png\",\"label_pdf_url\":null,\"label_zpl_url\":\"https://easypost-files.s3-us-west-2.amazonaws.com/files/postage_label/20220228/5192422647934cd0b6233b5d77ca421b.zpl\",\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_5b66ce57ed954a389b7e4231d1eb3a69\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_2af3f8b5a7db4e9583bbf5813f816d5c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ec0ff036565e4fe88c9d3efa965fb6ae\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_454379211772471d9452d7da97e0be48\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_454379211772471d9452d7da97e0be48\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_461da2c9fb6a44358cf26e6d006f2b8c\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428482\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:19Z\",\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:19Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:19Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzQ2MWRhMmM5ZmI2YTQ0MzU4Y2YyNmU2ZDAwNmYyYjhj\"},\"to_address\":{\"id\":\"adr_1106214898f011ecbc93ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_11087a1298f011ecbc94ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_1106214898f011ecbc93ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:18+00:00\",\"updated_at\":\"2022-02-28T23:42:18+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:21.54885-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/create.json b/EasyPost.Tests.Net/cassettes/shipment/create.json new file mode 100644 index 000000000..65e6b3c4a --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "888" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]},\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\"},\"reference\":\"123\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5dd2e4d1746900a40c74", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_ee94ab94d5e54f3387a87e697b88f1f2", + "ETag": "W/\"a3d268ee2f1a62d41139de653e81cd06\"", + "X-Request-ID": "62d23cf0-9e9e-4c6b-a1ca-3c3bbc888865", + "x-runtime": "0.696368", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6400" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:10Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:10Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_0f4d25bd8961446d916a9ebc98f6545e\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_67902799f3c0456ead155ad9b0f82f7d\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0bf228c098f011ecbb82ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:10+00:00\",\"updated_at\":\"2022-02-28T23:42:10+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_c92c1a88914e42eb80fe95590c5cc64a\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_e03553e3a1f947798d2105dd987d8828\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_ee94ab94d5e54f3387a87e697b88f1f2\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_7b971c4ad87d4bf79dda8f8005bfee5c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_ee94ab94d5e54f3387a87e697b88f1f2\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d3e335cf43bc47dfacdc5ae5e25e7547\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_ee94ab94d5e54f3387a87e697b88f1f2\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_1f8067d4c9a14c80b2f2eeaa76b5aeac\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:10Z\",\"updated_at\":\"2022-02-28T23:42:10Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_ee94ab94d5e54f3387a87e697b88f1f2\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_0bf00d7a98f011eca731ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:10+00:00\",\"updated_at\":\"2022-02-28T23:42:10+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0bf228c098f011ecbb82ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:10+00:00\",\"updated_at\":\"2022-02-28T23:42:10+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0bf00d7a98f011eca731ac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:10+00:00\",\"updated_at\":\"2022-02-28T23:42:10+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_ee94ab94d5e54f3387a87e697b88f1f2\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:10.782961-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/create_empty_objects.json b/EasyPost.Tests.Net/cassettes/shipment/create_empty_objects.json new file mode 100644 index 000000000..660879610 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/create_empty_objects.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "553" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"customs_info\":{\"customs_items\":[]},\"options\":null,\"tax_identifiers\":null,\"reference\":\"\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5de4e4d1779f00a40fe2", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_9334d9644ffc4bf6bc66ed8493b17917", + "ETag": "W/\"7c34a1428cedfcb9339d2f8e530cb655\"", + "X-Request-ID": "3c3d9a22-6dd1-49e7-a65c-dffb449a83fe", + "x-runtime": "0.703903", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5958" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:28Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:28Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_d3e0f0324c144aeea6b8646ad1fb6251\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"contents_explanation\":null,\"contents_type\":\"merchandise\",\"customs_certify\":false,\"customs_signer\":null,\"eel_pfc\":null,\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[]},\"from_address\":{\"id\":\"adr_16a8f32e98f011ec80c7ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:28+00:00\",\"updated_at\":\"2022-02-28T23:42:28+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_985d60c6f3074341b65c0646f9ffea2d\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_bae9abbd831d468ba080495230426ac5\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_9334d9644ffc4bf6bc66ed8493b17917\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_7c4f17fa13b9457f90d8108fded7a084\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_9334d9644ffc4bf6bc66ed8493b17917\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_93495f6be428486fa3960d132dae0865\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_9334d9644ffc4bf6bc66ed8493b17917\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_ad02f62bc94b4df7b21d11d8532765cb\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:28Z\",\"updated_at\":\"2022-02-28T23:42:28Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_9334d9644ffc4bf6bc66ed8493b17917\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_16a6db0d98f011ec823aac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:28+00:00\",\"updated_at\":\"2022-02-28T23:42:28+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_16a8f32e98f011ec80c7ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:28+00:00\",\"updated_at\":\"2022-02-28T23:42:28+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_16a6db0d98f011ec823aac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:28+00:00\",\"updated_at\":\"2022-02-28T23:42:28+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_9334d9644ffc4bf6bc66ed8493b17917\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:28.702522-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/create_tax_identifiers.json b/EasyPost.Tests.Net/cassettes/shipment/create_tax_identifiers.json new file mode 100644 index 000000000..bef5ad49b --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/create_tax_identifiers.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "565" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"tax_identifiers\":[{\"entity\":\"SENDER\",\"tax_id_type\":\"IOSS\",\"tax_id\":\"12345\",\"issuing_country\":\"GB\"}]}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596082621d5de5e4d177a000a41008", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_5e14a164a37346a3ab51829ff57f9f26", + "ETag": "W/\"6a88642485f29831c06cd4510b9537e5\"", + "X-Request-ID": "20bd6ca4-5d1c-4f96-8602-732a55b3a1d9", + "x-runtime": "0.705220", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5664" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:29Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:29Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_1752801d98f011ec80d9ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:29+00:00\",\"updated_at\":\"2022-02-28T23:42:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_57af1fa765a945cc9dc97e8534ef111a\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:29Z\",\"updated_at\":\"2022-02-28T23:42:29Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_20364a264ca14806878272416553f7f5\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:29Z\",\"updated_at\":\"2022-02-28T23:42:29Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_5e14a164a37346a3ab51829ff57f9f26\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_0c98a5331e584426a6a7ded782310fd4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:29Z\",\"updated_at\":\"2022-02-28T23:42:29Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_5e14a164a37346a3ab51829ff57f9f26\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_9478993b5c694cc6a6dcaa3d08463a0f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:29Z\",\"updated_at\":\"2022-02-28T23:42:29Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_5e14a164a37346a3ab51829ff57f9f26\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_37cadf2f715c4367a4fe4a96860c48be\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:29Z\",\"updated_at\":\"2022-02-28T23:42:29Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_5e14a164a37346a3ab51829ff57f9f26\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_1750a1b498f011ec824bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:29+00:00\",\"updated_at\":\"2022-02-28T23:42:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_1752801d98f011ec80d9ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:29+00:00\",\"updated_at\":\"2022-02-28T23:42:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_1750a1b498f011ec824bac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:29+00:00\",\"updated_at\":\"2022-02-28T23:42:29+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_5e14a164a37346a3ab51829ff57f9f26\",\"object\":\"Shipment\",\"tax_identifiers\":[{\"entity\":\"SENDER\",\"tax_id\":\"HIDDEN\",\"tax_id_type\":\"IOSS\",\"issuing_country\":\"GB\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:29.930845-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/insure.json b/EasyPost.Tests.Net/cassettes/shipment/insure.json new file mode 100644 index 000000000..6a35e6fc3 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/insure.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "572" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\",\"insurance\":0}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5ddee4d1779900a40ebc", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_f2b8f222b693498da2d4e57399add734", + "ETag": "W/\"e56cafb5c1c189c973fe92509668f956\"", + "X-Request-ID": "c47e773b-0b07-4f34-9acc-33002af412b6", + "x-runtime": "0.945211", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:22Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428505\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_130ec97f98f011ec81a9ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_39e6dddaf1514b3cac015434308046d6\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_617f6e0418784c96a4fde4a4bd40a70b\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:22Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/dc097ed4a38f4cee828a33af9f6a75c0.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_b1be2059ceca48b1b877d35d60eac87a\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f16cf5050c5b4c65a30e7d0151032ec3\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_07f15aeaf2a14e86a095716627f6a785\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3fd48f81849148f9a23fc416830d8a18\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_07f15aeaf2a14e86a095716627f6a785\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_9b1c63fb4adb466c8bb09e047e3e88a9\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428505\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzliMWM2M2ZiNGFkYjQ2NmM4YmIwOWUwNDdlM2U4OGE5\"},\"to_address\":{\"id\":\"adr_130cfd3198f011ec8037ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_130ec97f98f011ec81a9ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_130cfd3198f011ec8037ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:22.975354-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments/shp_f2b8f222b693498da2d4e57399add734/insure?amount=100", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596080621d5ddfe4d1779a00a40f13", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"10a2a405c91c3864e07cbccdee23d2d3\"", + "X-Request-ID": "2d45ea1a-a2e9-4b26-8d12-8d672fdf1c70", + "x-runtime": "0.161733", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "8054" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:22Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428505\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_130ec97f98f011ec81a9ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":\"100.00\",\"order_id\":null,\"parcel\":{\"id\":\"prcl_39e6dddaf1514b3cac015434308046d6\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_617f6e0418784c96a4fde4a4bd40a70b\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:22Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/dc097ed4a38f4cee828a33af9f6a75c0.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_b1be2059ceca48b1b877d35d60eac87a\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_f16cf5050c5b4c65a30e7d0151032ec3\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_07f15aeaf2a14e86a095716627f6a785\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3fd48f81849148f9a23fc416830d8a18\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_07f15aeaf2a14e86a095716627f6a785\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:22Z\",\"updated_at\":\"2022-02-28T23:42:22Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_9b1c63fb4adb466c8bb09e047e3e88a9\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428505\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:23Z\",\"updated_at\":\"2022-02-28T23:42:23Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:23Z\",\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:23Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:23Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzliMWM2M2ZiNGFkYjQ2NmM4YmIwOWUwNDdlM2U4OGE5\"},\"to_address\":{\"id\":\"adr_130cfd3198f011ec8037ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_130ec97f98f011ec81a9ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_130cfd3198f011ec8037ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:22+00:00\",\"updated_at\":\"2022-02-28T23:42:22+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"InsuranceFee\",\"amount\":\"1.00000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:23.534242-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/refund.json b/EasyPost.Tests.Net/cassettes/shipment/refund.json new file mode 100644 index 000000000..13e156900 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/refund.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "558" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"service\":\"First\",\"carrier_accounts\":[\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"],\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5de0e4d1779b00a40f2e", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_b6b14d193593409eb6f656a04469f96a", + "ETag": "W/\"b062bbf7013ed75080dba56e004be662\"", + "X-Request-ID": "86632be1-0720-46a1-a06c-00bf5389e900", + "x-runtime": "1.120383", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6826" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:24Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428529\",\"updated_at\":\"2022-02-28T23:42:25Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_1437a0b798f011ec81d7ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_e24c42db6f934cf7a93fc234c7a5a76f\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_a8d41618e8dc4070a701e553d796e441\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:24Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/03c57b2fc09247cc9b7c92e94da9ac40.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_30556e8786534fe5afb3415d79af109c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_dd5e6237d4a343299cd7d270ec9b27b4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c209ea5bb60544baaf7132a985ea8a90\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4c2a2d65d6a34026939d7457e3a885a9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_4c2a2d65d6a34026939d7457e3a885a9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_844eaa75201f4873aaebdb5638c388b1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428529\",\"status\":\"unknown\",\"status_detail\":\"unknown\",\"created_at\":\"2022-02-28T23:42:25Z\",\"updated_at\":\"2022-02-28T23:42:25Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":null,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier\":\"USPS\",\"tracking_details\":[],\"fees\":[],\"carrier_detail\":null,\"public_url\":\"https://track.easypost.com/djE6dHJrXzg0NGVhYTc1MjAxZjQ4NzNhYWViZGI1NjM4YzM4OGIx\"},\"to_address\":{\"id\":\"adr_1435c42798f011ec81d6ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_1437a0b798f011ec81d7ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_1435c42798f011ec81d6ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:25.12533-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/shipments/shp_b6b14d193593409eb6f656a04469f96a/refund", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5de1e4d1779c00a40f72", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"59d2048b5166c5d117ccaf2b24d51cb4\"", + "X-Request-ID": "6ad8d4b8-dab3-4cb3-9bb4-b6a59eb89fa2", + "x-runtime": "0.252385", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "7967" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:24Z\",\"is_return\":false,\"messages\":[],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":\"9400100897846109428529\",\"updated_at\":\"2022-02-28T23:42:25Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_1437a0b798f011ec81d7ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_e24c42db6f934cf7a93fc234c7a5a76f\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":{\"object\":\"PostageLabel\",\"id\":\"pl_a8d41618e8dc4070a701e553d796e441\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"date_advance\":0,\"integrated_form\":\"none\",\"label_date\":\"2022-02-28T23:42:24Z\",\"label_resolution\":300,\"label_size\":\"4x6\",\"label_type\":\"default\",\"label_file_type\":\"image/png\",\"label_url\":\"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20220228/03c57b2fc09247cc9b7c92e94da9ac40.png\",\"label_pdf_url\":null,\"label_zpl_url\":null,\"label_epl2_url\":null,\"label_file\":null},\"rates\":[{\"id\":\"rate_30556e8786534fe5afb3415d79af109c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_dd5e6237d4a343299cd7d270ec9b27b4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c209ea5bb60544baaf7132a985ea8a90\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_4c2a2d65d6a34026939d7457e3a885a9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":\"submitted\",\"scan_form\":null,\"selected_rate\":{\"id\":\"rate_4c2a2d65d6a34026939d7457e3a885a9\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:24Z\",\"updated_at\":\"2022-02-28T23:42:24Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},\"tracker\":{\"id\":\"trk_844eaa75201f4873aaebdb5638c388b1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428529\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:25Z\",\"updated_at\":\"2022-02-28T23:42:25Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:25Z\",\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:25Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:25Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzg0NGVhYTc1MjAxZjQ4NzNhYWViZGI1NjM4YzM4OGIx\"},\"to_address\":{\"id\":\"adr_1435c42798f011ec81d6ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_1437a0b798f011ec81d7ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_1435c42798f011ec81d6ac1f6bc7b362\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:24+00:00\",\"updated_at\":\"2022-02-28T23:42:24+00:00\",\"name\":\"JACK SPARROW\",\"company\":\"EASYPOST\",\"street1\":\"388 TOWNSEND ST APT 20\",\"street2\":null,\"city\":\"SAN FRANCISCO\",\"state\":\"CA\",\"zip\":\"94107-1670\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":true,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{\"zip4\":{\"success\":true,\"errors\":[],\"details\":null},\"delivery\":{\"success\":true,\"errors\":[],\"details\":{\"latitude\":37.77551,\"longitude\":-122.39697,\"time_zone\":\"America/Los_Angeles\"}}}},\"forms\":[],\"fees\":[{\"object\":\"Fee\",\"type\":\"LabelFee\",\"amount\":\"0.01000\",\"charged\":true,\"refunded\":false},{\"object\":\"Fee\",\"type\":\"PostageFee\",\"amount\":\"5.49000\",\"charged\":true,\"refunded\":false}],\"id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:25.835316-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/regenerate_rates.json b/EasyPost.Tests.Net/cassettes/shipment/regenerate_rates.json new file mode 100644 index 000000000..9617c77ba --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/regenerate_rates.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "888" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]},\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\"},\"reference\":\"123\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596086621d5dd8e4d1748600a40dc8", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_8f12158d0f6f43bfae5f8725e5123ecf", + "ETag": "W/\"a7012c475f5893b710e0978a4d532af7\"", + "X-Request-ID": "e44a3dd8-2add-446d-95e7-6aecbb233bd1", + "x-runtime": "0.675732", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6400" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:16Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:17Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_abe68bdf2d1641e1aa1f07bb91c37b0f\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:16Z\",\"updated_at\":\"2022-02-28T23:42:16Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_1588c91952d4430aa64351cc83cb4037\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:16Z\",\"updated_at\":\"2022-02-28T23:42:16Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0fb07c9198f011ecbfc1ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:16+00:00\",\"updated_at\":\"2022-02-28T23:42:16+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_13e697ea68244409be6713d6f1862085\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:16Z\",\"updated_at\":\"2022-02-28T23:42:16Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_ded9a4e254e843e2845ebce171896230\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:17Z\",\"updated_at\":\"2022-02-28T23:42:17Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_16e4418439214308802e709206547b8c\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:17Z\",\"updated_at\":\"2022-02-28T23:42:17Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c89662b4e9d1426483b8d3417164fdc7\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:17Z\",\"updated_at\":\"2022-02-28T23:42:17Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_69c21623286748bfa8b34b441c4098f5\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:17Z\",\"updated_at\":\"2022-02-28T23:42:17Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_0fae70cf98f011ecbc64ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:16+00:00\",\"updated_at\":\"2022-02-28T23:42:16+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0fb07c9198f011ecbfc1ac1f6bc72124\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:16+00:00\",\"updated_at\":\"2022-02-28T23:42:16+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0fae70cf98f011ecbc64ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:16+00:00\",\"updated_at\":\"2022-02-28T23:42:16+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:17.028209-08:00" + }, + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments/shp_8f12158d0f6f43bfae5f8725e5123ecf/rerate", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5dd9e4d1748700a40e09", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"ff860d9d351158dc2bc49903f242a970\"", + "X-Request-ID": "8d6180db-284f-49da-8638-39540994e83d", + "x-runtime": "0.648504", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2060" + }, + "Body": "{\"rates\":[{\"id\":\"rate_6a7c87b75a5c4bf284197e25840964fd\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_692a4e5c096f4b64883822cc0fa99ff5\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_d2126c6f25f242eebeea7ff747af777f\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_009cfe07484a43879922b21ac2d252b6\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:18Z\",\"updated_at\":\"2022-02-28T23:42:18Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_8f12158d0f6f43bfae5f8725e5123ecf\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:18.152532-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/retrieve.json b/EasyPost.Tests.Net/cassettes/shipment/retrieve.json new file mode 100644 index 000000000..a6cc644e3 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/retrieve.json @@ -0,0 +1,103 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "888" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"},\"customs_info\":{\"eel_pfc\":\"NOEEI 30.37(a)\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"contents_type\":\"merchandise\",\"contents_explanation\":\"\",\"restriction_type\":\"none\",\"non_delivery_option\":\"return\",\"customs_items\":[{\"description\":\"Sweet shirts\",\"quantity\":2,\"weight\":11,\"value\":23.0,\"hs_tariff_number\":654321,\"origin_country\":\"US\"}]},\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\"},\"reference\":\"123\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596081621d5dd3e4d1748100a40cb3", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_6c72eae65eb440679d130576af571750", + "ETag": "W/\"5849f870fff9b97695361cd5ea107c37\"", + "X-Request-ID": "e8cf458d-df5d-4786-b0eb-e2a617556089", + "x-runtime": "0.658985", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6400" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:11Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:11Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_e187fcf7118f4ad18e40829af1b15706\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_faafe0917d734b889d734069b167d68b\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0c9d9a7498f011ecbbadac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_7954a91d435040c0ac8d92be09d20a6a\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_6fa11e4ec9b14a388c357c610e646274\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_403bdc8e092d4a8a90aa1af7bd3d8a03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_73f14cf2d9d04f35ab55689bcc41cef7\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3574613c417f45cfb75a8b5eb1d8ab36\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_0c9bb86198f011eca74eac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0c9d9a7498f011ecbbadac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0c9bb86198f011eca74eac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_6c72eae65eb440679d130576af571750\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:11.833316-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/shipments/shp_6c72eae65eb440679d130576af571750", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5dd4e4d1748200a40ce4", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"5849f870fff9b97695361cd5ea107c37\"", + "X-Request-ID": "39ed40eb-7c2b-48bb-bdb8-3f1b36df0ae1", + "x-runtime": "0.112635", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "6400" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:11Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"label_format\":\"PNG\",\"invoice_number\":\"123\",\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":\"123\",\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:11Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":{\"id\":\"cstinfo_e187fcf7118f4ad18e40829af1b15706\",\"object\":\"CustomsInfo\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"contents_explanation\":\"\",\"contents_type\":\"merchandise\",\"customs_certify\":true,\"customs_signer\":\"Dr. Steve Brule\",\"eel_pfc\":\"NOEEI 30.37(a)\",\"non_delivery_option\":\"return\",\"restriction_comments\":null,\"restriction_type\":\"none\",\"mode\":\"test\",\"declaration\":null,\"customs_items\":[{\"id\":\"cstitem_faafe0917d734b889d734069b167d68b\",\"object\":\"CustomsItem\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"description\":\"Sweet shirts\",\"hs_tariff_number\":\"654321\",\"origin_country\":\"US\",\"quantity\":2,\"value\":\"23.0\",\"weight\":11.0,\"code\":null,\"mode\":\"test\",\"manufacturer\":null,\"currency\":null,\"eccn\":null,\"printed_commodity_identifier\":null}]},\"from_address\":{\"id\":\"adr_0c9d9a7498f011ecbbadac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_7954a91d435040c0ac8d92be09d20a6a\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_6fa11e4ec9b14a388c357c610e646274\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_403bdc8e092d4a8a90aa1af7bd3d8a03\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_73f14cf2d9d04f35ab55689bcc41cef7\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3574613c417f45cfb75a8b5eb1d8ab36\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:11Z\",\"updated_at\":\"2022-02-28T23:42:11Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_6c72eae65eb440679d130576af571750\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_0c9bb86198f011eca74eac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_0c9d9a7498f011ecbbadac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_0c9bb86198f011eca74eac1f6bc7bdc6\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:11+00:00\",\"updated_at\":\"2022-02-28T23:42:11+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_6c72eae65eb440679d130576af571750\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:12.331573-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/shipment/smartrate.json b/EasyPost.Tests.Net/cassettes/shipment/smartrate.json new file mode 100644 index 000000000..c2e23cd7b --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/shipment/smartrate.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/shipments", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "464" + }, + "Body": "{\"shipment\":{\"to_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"from_address\":{\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\"},\"parcel\":{\"length\":\"10\",\"width\":\"8\",\"height\":\"4\",\"weight\":\"15.4\"}}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596084621d5de2e4d1779d00a40f95", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/shipments/shp_77fbeef2299c4a288e55c1d3448dbfda", + "ETag": "W/\"f642a36a1f96bc85c312945082fa58ad\"", + "X-Request-ID": "693f0f74-6b59-44a7-abb0-1aae0a29ed01", + "x-runtime": "0.722257", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "5562" + }, + "Body": "{\"created_at\":\"2022-02-28T23:42:26Z\",\"is_return\":false,\"messages\":[{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_439c162b0a4d4a8f9bed142444cdef7f\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_8b201fc1e6f7468c882001e5fe931dc2\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_eb30a0b502a643cb992af1de1f4c81aa\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_34e1b9a3b5fe49f18ddb57f4eb1f5f85\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_91b014b45ac74d74995a647d42dc8f96\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"},{\"carrier\":\"UPS\",\"carrier_account_id\":\"ca_2ac51decaeda426ca40418b65c405483\",\"type\":\"rate_error\",\"message\":\"Invalid Access License number\"}],\"mode\":\"test\",\"options\":{\"currency\":\"USD\",\"payment\":{\"type\":\"SENDER\"},\"date_advance\":0},\"reference\":null,\"status\":\"unknown\",\"tracking_code\":null,\"updated_at\":\"2022-02-28T23:42:27Z\",\"batch_id\":null,\"batch_status\":null,\"batch_message\":null,\"customs_info\":null,\"from_address\":{\"id\":\"adr_15a91e0698f011ecbd4aac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:26+00:00\",\"updated_at\":\"2022-02-28T23:42:26+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"insurance\":null,\"order_id\":null,\"parcel\":{\"id\":\"prcl_ecc5e9f800ff4a279e2e77e19abb481a\",\"object\":\"Parcel\",\"created_at\":\"2022-02-28T23:42:26Z\",\"updated_at\":\"2022-02-28T23:42:26Z\",\"length\":10.0,\"width\":8.0,\"height\":4.0,\"predefined_package\":null,\"weight\":15.4,\"mode\":\"test\"},\"postage_label\":null,\"rates\":[{\"id\":\"rate_975c354b79914c1f9d3ea2afe95c2a07\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:27Z\",\"updated_at\":\"2022-02-28T23:42:27Z\",\"mode\":\"test\",\"service\":\"Priority\",\"carrier\":\"USPS\",\"rate\":\"7.37\",\"currency\":\"USD\",\"retail_rate\":\"8.70\",\"retail_currency\":\"USD\",\"list_rate\":\"7.37\",\"list_currency\":\"USD\",\"delivery_days\":1,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":1,\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_c865d1567e3d4ceabde829f8e6489dc1\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:27Z\",\"updated_at\":\"2022-02-28T23:42:27Z\",\"mode\":\"test\",\"service\":\"First\",\"carrier\":\"USPS\",\"rate\":\"5.49\",\"currency\":\"USD\",\"retail_rate\":\"5.49\",\"retail_currency\":\"USD\",\"list_rate\":\"5.49\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_5da82834cf3d480d8ae58c08981b05c4\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:27Z\",\"updated_at\":\"2022-02-28T23:42:27Z\",\"mode\":\"test\",\"service\":\"ParcelSelect\",\"carrier\":\"USPS\",\"rate\":\"7.22\",\"currency\":\"USD\",\"retail_rate\":\"7.22\",\"retail_currency\":\"USD\",\"list_rate\":\"7.22\",\"list_currency\":\"USD\",\"delivery_days\":2,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":2,\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"},{\"id\":\"rate_3a8fc071e0344c80ae60064fd11c0f65\",\"object\":\"Rate\",\"created_at\":\"2022-02-28T23:42:27Z\",\"updated_at\":\"2022-02-28T23:42:27Z\",\"mode\":\"test\",\"service\":\"Express\",\"carrier\":\"USPS\",\"rate\":\"23.75\",\"currency\":\"USD\",\"retail_rate\":\"27.40\",\"retail_currency\":\"USD\",\"list_rate\":\"23.75\",\"list_currency\":\"USD\",\"delivery_days\":null,\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"est_delivery_days\":null,\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\"}],\"refund_status\":null,\"scan_form\":null,\"selected_rate\":null,\"tracker\":null,\"to_address\":{\"id\":\"adr_15a739c398f011ecbd48ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:26+00:00\",\"updated_at\":\"2022-02-28T23:42:26+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"usps_zone\":1,\"return_address\":{\"id\":\"adr_15a91e0698f011ecbd4aac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:26+00:00\",\"updated_at\":\"2022-02-28T23:42:26+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"buyer_address\":{\"id\":\"adr_15a739c398f011ecbd48ac1f6b0a0d1e\",\"object\":\"Address\",\"created_at\":\"2022-02-28T23:42:26+00:00\",\"updated_at\":\"2022-02-28T23:42:26+00:00\",\"name\":\"Jack Sparrow\",\"company\":\"EasyPost\",\"street1\":\"388 Townsend St\",\"street2\":\"Apt 20\",\"city\":\"San Francisco\",\"state\":\"CA\",\"zip\":\"94107\",\"country\":\"US\",\"phone\":\"5555555555\",\"email\":null,\"mode\":\"test\",\"carrier_facility\":null,\"residential\":null,\"federal_tax_id\":null,\"state_tax_id\":null,\"verifications\":{}},\"forms\":[],\"fees\":[],\"id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"object\":\"Shipment\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:27.076511-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/shipments/shp_77fbeef2299c4a288e55c1d3448dbfda/smartrate", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5de3e4d1779e00a40fc8", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"4d839f3a6c041c4d2096e82499d5d6c5\"", + "X-Request-ID": "548b9f2b-b141-478e-bd58-394d326f9359", + "x-runtime": "0.092994", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2620" + }, + "Body": "{\"result\":[{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:27Z\",\"currency\":\"USD\",\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"delivery_days\":1,\"est_delivery_days\":1,\"id\":\"rate_975c354b79914c1f9d3ea2afe95c2a07\",\"list_currency\":\"USD\",\"list_rate\":7.37,\"mode\":\"test\",\"object\":\"Rate\",\"rate\":7.37,\"retail_currency\":\"USD\",\"retail_rate\":8.7,\"service\":\"Priority\",\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"time_in_transit\":{\"percentile_50\":1,\"percentile_75\":1,\"percentile_85\":1,\"percentile_90\":1,\"percentile_95\":1,\"percentile_97\":2,\"percentile_99\":3},\"updated_at\":\"2022-02-28T23:42:27Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:27Z\",\"currency\":\"USD\",\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_c865d1567e3d4ceabde829f8e6489dc1\",\"list_currency\":\"USD\",\"list_rate\":5.49,\"mode\":\"test\",\"object\":\"Rate\",\"rate\":5.49,\"retail_currency\":\"USD\",\"retail_rate\":5.49,\"service\":\"First\",\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"time_in_transit\":{\"percentile_50\":1,\"percentile_75\":1,\"percentile_85\":1,\"percentile_90\":2,\"percentile_95\":2,\"percentile_97\":3,\"percentile_99\":4},\"updated_at\":\"2022-02-28T23:42:27Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:27Z\",\"currency\":\"USD\",\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"delivery_days\":2,\"est_delivery_days\":2,\"id\":\"rate_5da82834cf3d480d8ae58c08981b05c4\",\"list_currency\":\"USD\",\"list_rate\":7.22,\"mode\":\"test\",\"object\":\"Rate\",\"rate\":7.22,\"retail_currency\":\"USD\",\"retail_rate\":7.22,\"service\":\"ParcelSelect\",\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"time_in_transit\":{\"percentile_50\":2,\"percentile_75\":3,\"percentile_85\":3,\"percentile_90\":4,\"percentile_95\":5,\"percentile_97\":7,\"percentile_99\":11},\"updated_at\":\"2022-02-28T23:42:27Z\"},{\"carrier\":\"USPS\",\"carrier_account_id\":\"ca_7642d249fdcf47bcb5da9ea34c96dfcf\",\"created_at\":\"2022-02-28T23:42:27Z\",\"currency\":\"USD\",\"delivery_date\":null,\"delivery_date_guaranteed\":false,\"delivery_days\":null,\"est_delivery_days\":null,\"id\":\"rate_3a8fc071e0344c80ae60064fd11c0f65\",\"list_currency\":\"USD\",\"list_rate\":23.75,\"mode\":\"test\",\"object\":\"Rate\",\"rate\":23.75,\"retail_currency\":\"USD\",\"retail_rate\":27.4,\"service\":\"Express\",\"shipment_id\":\"shp_77fbeef2299c4a288e55c1d3448dbfda\",\"time_in_transit\":{\"percentile_50\":1,\"percentile_75\":1,\"percentile_85\":1,\"percentile_90\":2,\"percentile_95\":3,\"percentile_97\":5,\"percentile_99\":7},\"updated_at\":\"2022-02-28T23:42:27Z\"}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:27.575342-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/tracker/all.json b/EasyPost.Tests.Net/cassettes/tracker/all.json new file mode 100644 index 000000000..ccba79473 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/tracker/all.json @@ -0,0 +1,51 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/trackers?page_size=5", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596080621d5de7e4d177bb00a410a2", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"d0f8064deec9033f057e508eb7b8963e\"", + "X-Request-ID": "fb81bccf-bda8-4a35-a27a-236860746b47", + "x-runtime": "0.129545", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "8348" + }, + "Body": "{\"trackers\":[{\"id\":\"trk_fe5153623fbb4103867853b9751025f1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"EZ1000000001\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:31Z\",\"updated_at\":\"2022-02-28T23:42:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:31Z\",\"shipment_id\":null,\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[{\"object\":\"Fee\",\"type\":\"TrackerFee\",\"amount\":\"0.00000\",\"charged\":false,\"refunded\":false}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZlNTE1MzYyM2ZiYjQxMDM4Njc4NTNiOTc1MTAyNWYx\"},{\"id\":\"trk_e2a032f4e59e47a7af7fe8c6c41db1f9\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"EZ1000000001\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:30Z\",\"updated_at\":\"2022-02-28T23:42:30Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:30Z\",\"shipment_id\":null,\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[{\"object\":\"Fee\",\"type\":\"TrackerFee\",\"amount\":\"0.00000\",\"charged\":false,\"refunded\":false}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrX2UyYTAzMmY0ZTU5ZTQ3YTdhZjdmZThjNmM0MWRiMWY5\"},{\"id\":\"trk_844eaa75201f4873aaebdb5638c388b1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428529\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:25Z\",\"updated_at\":\"2022-02-28T23:42:25Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:25Z\",\"shipment_id\":\"shp_b6b14d193593409eb6f656a04469f96a\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:25Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:25Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzg0NGVhYTc1MjAxZjQ4NzNhYWViZGI1NjM4YzM4OGIx\"},{\"id\":\"trk_9b1c63fb4adb466c8bb09e047e3e88a9\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428505\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:23Z\",\"updated_at\":\"2022-02-28T23:42:23Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:23Z\",\"shipment_id\":\"shp_f2b8f222b693498da2d4e57399add734\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:23Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:23Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzliMWM2M2ZiNGFkYjQ2NmM4YmIwOWUwNDdlM2U4OGE5\"},{\"id\":\"trk_461da2c9fb6a44358cf26e6d006f2b8c\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"9400100897846109428482\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:19Z\",\"updated_at\":\"2022-02-28T23:42:19Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:19Z\",\"shipment_id\":\"shp_96dbc60d5a114f70bdbbc8040a21666c\",\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:19Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:19Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrXzQ2MWRhMmM5ZmI2YTQ0MzU4Y2YyNmU2ZDAwNmYyYjhj\"}],\"has_more\":true}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:32.025404-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/tracker/create.json b/EasyPost.Tests.Net/cassettes/tracker/create.json new file mode 100644 index 000000000..23d5156b0 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/tracker/create.json @@ -0,0 +1,54 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/trackers", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "61" + }, + "Body": "{\"tracker\":{\"tracking_code\":\"EZ1000000001\",\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5de6e4d177a100a4104f", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/trackers/trk_e2a032f4e59e47a7af7fe8c6c41db1f9", + "ETag": "W/\"64ac2acb79f66f83678fdefaf8342cb4\"", + "X-Request-ID": "187937b7-2a2a-481f-925b-bde097dca46d", + "x-runtime": "0.131882", + "x-node": "bigweb2nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1724" + }, + "Body": "{\"id\":\"trk_e2a032f4e59e47a7af7fe8c6c41db1f9\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"EZ1000000001\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:30Z\",\"updated_at\":\"2022-02-28T23:42:30Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:30Z\",\"shipment_id\":null,\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:30Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrX2UyYTAzMmY0ZTU5ZTQ3YTdhZjdmZThjNmM0MWRiMWY5\",\"fees\":[{\"object\":\"Fee\",\"type\":\"TrackerFee\",\"amount\":\"0.00000\",\"charged\":false,\"refunded\":false}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:30.475355-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/tracker/create_list.json b/EasyPost.Tests.Net/cassettes/tracker/create_list.json new file mode 100644 index 000000000..b238005d4 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/tracker/create_list.json @@ -0,0 +1,53 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/trackers/create_list", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "125" + }, + "Body": "{\"trackers\":{\"0\":{\"tracking_code\":\"EZ1000000001\"},\"1\":{\"tracking_code\":\"EZ1000000002\"},\"2\":{\"tracking_code\":\"EZ1000000003\"}}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5de8e4d177bc00a410be", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"44136fa355b3678a1146ad16f7e8649e\"", + "X-Request-ID": "8cd99bd3-f26b-4dce-ac8a-f8e10a828717", + "x-runtime": "0.040121", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "Body": "{}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:32.475394-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/tracker/retrieve.json b/EasyPost.Tests.Net/cassettes/tracker/retrieve.json new file mode 100644 index 000000000..9422d9b5f --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/tracker/retrieve.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/trackers", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "61" + }, + "Body": "{\"tracker\":{\"tracking_code\":\"EZ1000000001\",\"carrier\":\"USPS\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596087621d5de6e4d177a200a41070", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "Location": "/api/v2/trackers/trk_fe5153623fbb4103867853b9751025f1", + "ETag": "W/\"66ad25d9e9cf684e3c5f5d793f16fcb2\"", + "X-Request-ID": "5a6ca53c-e14f-44f4-bad7-700e3a650bf0", + "x-runtime": "0.167708", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1724" + }, + "Body": "{\"id\":\"trk_fe5153623fbb4103867853b9751025f1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"EZ1000000001\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:31Z\",\"updated_at\":\"2022-02-28T23:42:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:31Z\",\"shipment_id\":null,\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"finalized\":true,\"is_return\":false,\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZlNTE1MzYyM2ZiYjQxMDM4Njc4NTNiOTc1MTAyNWYx\",\"fees\":[{\"object\":\"Fee\",\"type\":\"TrackerFee\",\"amount\":\"0.00000\",\"charged\":false,\"refunded\":false}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:31.03836-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/trackers/trk_fe5153623fbb4103867853b9751025f1", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5de7e4d177ba00a41091", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"5793db94b09a954fee37e845015eb0bc\"", + "X-Request-ID": "a9c96f22-67cb-4f93-8001-7b76569804bc", + "x-runtime": "0.049358", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "1689" + }, + "Body": "{\"id\":\"trk_fe5153623fbb4103867853b9751025f1\",\"object\":\"Tracker\",\"mode\":\"test\",\"tracking_code\":\"EZ1000000001\",\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"created_at\":\"2022-02-28T23:42:31Z\",\"updated_at\":\"2022-02-28T23:42:31Z\",\"signed_by\":null,\"weight\":null,\"est_delivery_date\":\"2022-02-28T23:42:31Z\",\"shipment_id\":null,\"carrier\":\"USPS\",\"tracking_details\":[{\"object\":\"TrackingDetail\",\"message\":\"Pre-Shipment Info Sent to USPS\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-28T23:42:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":null,\"state\":null,\"country\":null,\"zip\":null}},{\"object\":\"TrackingDetail\",\"message\":\"Shipping Label Created\",\"description\":null,\"status\":\"pre_transit\",\"status_detail\":\"status_update\",\"datetime\":\"2022-01-29T12:19:31Z\",\"source\":\"USPS\",\"carrier_code\":null,\"tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"}}],\"fees\":[{\"object\":\"Fee\",\"type\":\"TrackerFee\",\"amount\":\"0.00000\",\"charged\":false,\"refunded\":false}],\"carrier_detail\":{\"object\":\"CarrierDetail\",\"service\":\"First-Class Package Service\",\"container_type\":null,\"est_delivery_date_local\":null,\"est_delivery_time_local\":null,\"origin_location\":\"HOUSTON TX, 77001\",\"origin_tracking_location\":{\"object\":\"TrackingLocation\",\"city\":\"HOUSTON\",\"state\":\"TX\",\"country\":null,\"zip\":\"77063\"},\"destination_location\":\"CHARLESTON SC, 29401\",\"destination_tracking_location\":null,\"guaranteed_delivery_date\":null,\"alternate_identifier\":null,\"initial_delivery_attempt\":null},\"public_url\":\"https://track.easypost.com/djE6dHJrX2ZlNTE1MzYyM2ZiYjQxMDM4Njc4NTNiOTc1MTAyNWYx\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:31.475412-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/user/retrieve.json b/EasyPost.Tests.Net/cassettes/user/retrieve.json new file mode 100644 index 000000000..e4f38fa3e --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/user/retrieve.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/users/user_608a91d0487e419bb465e5acbc999056", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5de8e4d177bd00a410d8", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"91d51eebc1dacba07645c6ee3c31c5b8\"", + "X-Request-ID": "946ca184-4f97-4396-8457-ca5829f371a4", + "x-runtime": "0.048852", + "x-node": "bigweb4nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "227" + }, + "Body": "{\"id\":\"user_608a91d0487e419bb465e5acbc999056\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test User\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2022-02-28T18:34:59Z\",\"children\":[]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:32.925358-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/user/retrieve_me.json b/EasyPost.Tests.Net/cassettes/user/retrieve_me.json new file mode 100644 index 000000000..aab869d19 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/user/retrieve_me.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/users", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5de9e4d177be00a410ee", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"88fcd92bc2e40f67dffe7830e19ef6d1\"", + "X-Request-ID": "409dafde-6766-4674-a73a-7b020e4b5790", + "x-runtime": "0.183504", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2822" + }, + "Body": "{\"id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"object\":\"User\",\"parent_id\":null,\"name\":\"EasyPost C# Client Library Tests\",\"phone_number\":\"5555555555\",\"verified\":true,\"created_at\":\"2018-04-20T16:42:21Z\",\"balance\":\"0.00000\",\"price_per_shipment\":\"0.01000\",\"recharge_amount\":null,\"secondary_recharge_amount\":null,\"recharge_threshold\":null,\"has_billing_method\":null,\"cc_fee_rate\":\"0.0\",\"default_insurance_amount\":null,\"insurance_fee_rate\":\"0.01\",\"insurance_fee_minimum\":\"1.00\",\"email\":\"dev+easypost-csharp@easypost.com\",\"children\":[{\"id\":\"user_3be0e8a06f1b425ba90d7fdbf2c78997\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Child Account Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2020-03-08T07:05:43Z\",\"children\":[]},{\"id\":\"user_07c1506ed5da42ebb9135a1e97ad82c0\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"foo first\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:23:06Z\",\"children\":[]},{\"id\":\"user_49b4891132d74199aad14ac83a3750ef\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:29:50Z\",\"children\":[]},{\"id\":\"user_a36909cecad24438abb5cb4b53b3ff73\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:31:27Z\",\"children\":[]},{\"id\":\"user_75e78b527f1f4f9da025aecb77b76832\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T14:49:55Z\",\"children\":[]},{\"id\":\"user_f4d92abebea4483d899d7dcd2e21bae1\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:34Z\",\"children\":[]},{\"id\":\"user_1038109a904244e5a9263b3f9446e321\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:49Z\",\"children\":[]},{\"id\":\"user_b56c49ba47dc4e11aa7882fe2c49a20c\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:08:38Z\",\"children\":[]},{\"id\":\"user_790e63c3403043628cf0bd601f11dd4d\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-09-30T07:11:00Z\",\"children\":[]},{\"id\":\"user_608a91d0487e419bb465e5acbc999056\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test User\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2022-02-28T18:34:59Z\",\"children\":[]}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:33.525416-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/user/update.json b/EasyPost.Tests.Net/cassettes/user/update.json new file mode 100644 index 000000000..989ff8bae --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/user/update.json @@ -0,0 +1,102 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/users", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5deae4d177bf00a41116", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"88fcd92bc2e40f67dffe7830e19ef6d1\"", + "X-Request-ID": "686e1325-c482-425f-b8bc-da6f24c7c99c", + "x-runtime": "0.148098", + "x-node": "bigweb7nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-canary": "direct", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2822" + }, + "Body": "{\"id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"object\":\"User\",\"parent_id\":null,\"name\":\"EasyPost C# Client Library Tests\",\"phone_number\":\"5555555555\",\"verified\":true,\"created_at\":\"2018-04-20T16:42:21Z\",\"balance\":\"0.00000\",\"price_per_shipment\":\"0.01000\",\"recharge_amount\":null,\"secondary_recharge_amount\":null,\"recharge_threshold\":null,\"has_billing_method\":null,\"cc_fee_rate\":\"0.0\",\"default_insurance_amount\":null,\"insurance_fee_rate\":\"0.01\",\"insurance_fee_minimum\":\"1.00\",\"email\":\"dev+easypost-csharp@easypost.com\",\"children\":[{\"id\":\"user_3be0e8a06f1b425ba90d7fdbf2c78997\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Child Account Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2020-03-08T07:05:43Z\",\"children\":[]},{\"id\":\"user_07c1506ed5da42ebb9135a1e97ad82c0\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"foo first\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:23:06Z\",\"children\":[]},{\"id\":\"user_49b4891132d74199aad14ac83a3750ef\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:29:50Z\",\"children\":[]},{\"id\":\"user_a36909cecad24438abb5cb4b53b3ff73\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:31:27Z\",\"children\":[]},{\"id\":\"user_75e78b527f1f4f9da025aecb77b76832\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T14:49:55Z\",\"children\":[]},{\"id\":\"user_f4d92abebea4483d899d7dcd2e21bae1\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:34Z\",\"children\":[]},{\"id\":\"user_1038109a904244e5a9263b3f9446e321\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:49Z\",\"children\":[]},{\"id\":\"user_b56c49ba47dc4e11aa7882fe2c49a20c\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:08:38Z\",\"children\":[]},{\"id\":\"user_790e63c3403043628cf0bd601f11dd4d\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-09-30T07:11:00Z\",\"children\":[]},{\"id\":\"user_608a91d0487e419bb465e5acbc999056\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test User\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2022-02-28T18:34:59Z\",\"children\":[]}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:34.075412-08:00" + }, + { + "Request": { + "Method": "PUT", + "URI": "https://api.easypost.com/v2/users/user_4d78588f2f744bf6886aa67ddb870865", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "38" + }, + "Body": "{\"user\":{\"phone_number\":\"5555555555\"}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5deae4d177c000a4114a", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"88fcd92bc2e40f67dffe7830e19ef6d1\"", + "X-Request-ID": "9320bbd0-db6c-47ae-82f3-917ee77b08ce", + "x-runtime": "0.162490", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2822" + }, + "Body": "{\"id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"object\":\"User\",\"parent_id\":null,\"name\":\"EasyPost C# Client Library Tests\",\"phone_number\":\"5555555555\",\"verified\":true,\"created_at\":\"2018-04-20T16:42:21Z\",\"balance\":\"0.00000\",\"price_per_shipment\":\"0.01000\",\"recharge_amount\":null,\"secondary_recharge_amount\":null,\"recharge_threshold\":null,\"has_billing_method\":null,\"cc_fee_rate\":\"0.0\",\"default_insurance_amount\":null,\"insurance_fee_rate\":\"0.01\",\"insurance_fee_minimum\":\"1.00\",\"email\":\"dev+easypost-csharp@easypost.com\",\"children\":[{\"id\":\"user_3be0e8a06f1b425ba90d7fdbf2c78997\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Child Account Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2020-03-08T07:05:43Z\",\"children\":[]},{\"id\":\"user_07c1506ed5da42ebb9135a1e97ad82c0\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"foo first\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:23:06Z\",\"children\":[]},{\"id\":\"user_49b4891132d74199aad14ac83a3750ef\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:29:50Z\",\"children\":[]},{\"id\":\"user_a36909cecad24438abb5cb4b53b3ff73\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:31:27Z\",\"children\":[]},{\"id\":\"user_75e78b527f1f4f9da025aecb77b76832\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T14:49:55Z\",\"children\":[]},{\"id\":\"user_f4d92abebea4483d899d7dcd2e21bae1\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:34Z\",\"children\":[]},{\"id\":\"user_1038109a904244e5a9263b3f9446e321\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:49Z\",\"children\":[]},{\"id\":\"user_b56c49ba47dc4e11aa7882fe2c49a20c\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:08:38Z\",\"children\":[]},{\"id\":\"user_790e63c3403043628cf0bd601f11dd4d\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-09-30T07:11:00Z\",\"children\":[]},{\"id\":\"user_608a91d0487e419bb465e5acbc999056\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test User\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2022-02-28T18:34:59Z\",\"children\":[]}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:34.637904-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/user/update_brand.json b/EasyPost.Tests.Net/cassettes/user/update_brand.json new file mode 100644 index 000000000..d98c4a35a --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/user/update_brand.json @@ -0,0 +1,101 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/users", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596082621d5debe4d177c100a41156", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"88fcd92bc2e40f67dffe7830e19ef6d1\"", + "X-Request-ID": "3d78d01f-f694-4a6e-a122-48897dffa2d7", + "x-runtime": "0.126550", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2822" + }, + "Body": "{\"id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"object\":\"User\",\"parent_id\":null,\"name\":\"EasyPost C# Client Library Tests\",\"phone_number\":\"5555555555\",\"verified\":true,\"created_at\":\"2018-04-20T16:42:21Z\",\"balance\":\"0.00000\",\"price_per_shipment\":\"0.01000\",\"recharge_amount\":null,\"secondary_recharge_amount\":null,\"recharge_threshold\":null,\"has_billing_method\":null,\"cc_fee_rate\":\"0.0\",\"default_insurance_amount\":null,\"insurance_fee_rate\":\"0.01\",\"insurance_fee_minimum\":\"1.00\",\"email\":\"dev+easypost-csharp@easypost.com\",\"children\":[{\"id\":\"user_3be0e8a06f1b425ba90d7fdbf2c78997\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Child Account Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2020-03-08T07:05:43Z\",\"children\":[]},{\"id\":\"user_07c1506ed5da42ebb9135a1e97ad82c0\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"foo first\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:23:06Z\",\"children\":[]},{\"id\":\"user_49b4891132d74199aad14ac83a3750ef\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:29:50Z\",\"children\":[]},{\"id\":\"user_a36909cecad24438abb5cb4b53b3ff73\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"NewTest Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-18T20:31:27Z\",\"children\":[]},{\"id\":\"user_75e78b527f1f4f9da025aecb77b76832\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T14:49:55Z\",\"children\":[]},{\"id\":\"user_f4d92abebea4483d899d7dcd2e21bae1\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:34Z\",\"children\":[]},{\"id\":\"user_1038109a904244e5a9263b3f9446e321\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:07:49Z\",\"children\":[]},{\"id\":\"user_b56c49ba47dc4e11aa7882fe2c49a20c\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-01-19T15:08:38Z\",\"children\":[]},{\"id\":\"user_790e63c3403043628cf0bd601f11dd4d\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test Name\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2021-09-30T07:11:00Z\",\"children\":[]},{\"id\":\"user_608a91d0487e419bb465e5acbc999056\",\"object\":\"User\",\"parent_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"name\":\"Test User\",\"phone_number\":\"8005550100\",\"verified\":true,\"created_at\":\"2022-02-28T18:34:59Z\",\"children\":[]}]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:35.150606-08:00" + }, + { + "Request": { + "Method": "PUT", + "URI": "https://api.easypost.com/v2/users/user_4d78588f2f744bf6886aa67ddb870865/brand", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "29" + }, + "Body": "{\"brand\":{\"color\":\"#123456\"}}" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5debe4d177c200a41167", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"faf21efd0be5afc9dd022f777c0eb704\"", + "X-Request-ID": "773c58c9-2776-40bf-bf00-b96b454d40c9", + "x-runtime": "0.023921", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "350" + }, + "Body": "{\"id\":\"brd_756695f77f784c5580160f856adaee41\",\"color\":\"#123456\",\"logo\":\"https://assets.easypost.com/assets/images/branding/easypost-primary-logo-7a2cf535f2.svg\",\"logo_href\":\"https://www.easypost.com\",\"name\":\"EasyPost\",\"ad\":null,\"ad_href\":null,\"object\":\"Brand\",\"user_id\":\"user_4d78588f2f744bf6886aa67ddb870865\",\"background_color\":null,\"theme\":\"theme1\"}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:35.547624-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/webhook/all.json b/EasyPost.Tests.Net/cassettes/webhook/all.json new file mode 100644 index 000000000..2b6ef002a --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/webhook/all.json @@ -0,0 +1,50 @@ +[ + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/webhooks", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596083621d5defe4d177e100a4122d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"d03ff1e2df7ad33907b2086ec5f9e0a9\"", + "X-Request-ID": "2bd06d26-f362-4447-b582-14800345d239", + "x-runtime": "0.029869", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "15" + }, + "Body": "{\"webhooks\":[]}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:39.875455-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/webhook/create.json b/EasyPost.Tests.Net/cassettes/webhook/create.json new file mode 100644 index 000000000..79a5537be --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/webhook/create.json @@ -0,0 +1,149 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/webhooks", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "44" + }, + "Body": "{\"webhook\":{\"url\":\"https://testcreate.com\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596083621d5dece4d177c300a41181", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"6848a883c18140124a8b8fae27b6f6ce\"", + "X-Request-ID": "068d0289-fee7-4b58-b08f-940daa9683c8", + "x-runtime": "0.113865", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "165" + }, + "Body": "{\"id\":\"hook_1b5e03ca98f011ecb76775555fd17564\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testcreate.com\",\"created_at\":\"2022-02-28T23:42:36Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:36.039392-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/webhooks/hook_1b5e03ca98f011ecb76775555fd17564", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596084621d5dece4d177db00a41199", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"6848a883c18140124a8b8fae27b6f6ce\"", + "X-Request-ID": "32177216-7d27-4e68-a290-661af81e06c1", + "x-runtime": "0.026614", + "x-node": "bigweb6nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "165" + }, + "Body": "{\"id\":\"hook_1b5e03ca98f011ecb76775555fd17564\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testcreate.com\",\"created_at\":\"2022-02-28T23:42:36Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:36.447874-08:00" + }, + { + "Request": { + "Method": "DELETE", + "URI": "https://api.easypost.com/v2/webhooks/hook_1b5e03ca98f011ecb76775555fd17564", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596081621d5dece4d177dc00a411b0", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"44136fa355b3678a1146ad16f7e8649e\"", + "X-Request-ID": "408feb0e-3e2a-44ec-b4b6-5726da3c6f16", + "x-runtime": "0.383484", + "x-node": "bigweb3nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "Body": "{}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:37.303262-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/webhook/delete.json b/EasyPost.Tests.Net/cassettes/webhook/delete.json new file mode 100644 index 000000000..18bc7c6d7 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/webhook/delete.json @@ -0,0 +1,149 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/webhooks", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "44" + }, + "Body": "{\"webhook\":{\"url\":\"https://testdelete.com\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596085621d5df0e4d177e200a41247", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"1c180c118ffe12c049cba52c17c3ed90\"", + "X-Request-ID": "a908d2a9-acc1-44cf-83b2-bfa48ddb81ee", + "x-runtime": "0.131498", + "x-node": "bigweb9nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "165" + }, + "Body": "{\"id\":\"hook_1df4a1fc98f011ecab9a1bde68f07d80\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testdelete.com\",\"created_at\":\"2022-02-28T23:42:40Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:40.400507-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/webhooks/hook_1df4a1fc98f011ecab9a1bde68f07d80", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5df0e4d177e300a4125d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"1c180c118ffe12c049cba52c17c3ed90\"", + "X-Request-ID": "3b945822-aa82-461f-ad77-48d24e5acdfc", + "x-runtime": "0.026977", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "165" + }, + "Body": "{\"id\":\"hook_1df4a1fc98f011ecab9a1bde68f07d80\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testdelete.com\",\"created_at\":\"2022-02-28T23:42:40Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:40.801524-08:00" + }, + { + "Request": { + "Method": "DELETE", + "URI": "https://api.easypost.com/v2/webhooks/hook_1df4a1fc98f011ecab9a1bde68f07d80", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596086621d5df1e4d177e400a4127b", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"44136fa355b3678a1146ad16f7e8649e\"", + "X-Request-ID": "b672be9d-8b8e-4748-ac7e-6d150029f6fb", + "x-runtime": "0.414323", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "Body": "{}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:41.637652-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net/cassettes/webhook/retrieve.json b/EasyPost.Tests.Net/cassettes/webhook/retrieve.json new file mode 100644 index 000000000..52cb386e4 --- /dev/null +++ b/EasyPost.Tests.Net/cassettes/webhook/retrieve.json @@ -0,0 +1,149 @@ +[ + { + "Request": { + "Method": "POST", + "URI": "https://api.easypost.com/v2/webhooks", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": { + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "46" + }, + "Body": "{\"webhook\":{\"url\":\"https://testretrieve.com\"}}" + }, + "Response": { + "Status": { + "Code": 201, + "Message": "Created" + }, + "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": "5f596080621d5dede4d177dd00a411db", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"7e58a0eb57a5976a1aed04020d018fde\"", + "X-Request-ID": "2f0c7224-6054-414a-b4c8-590e88d84020", + "x-runtime": "0.166080", + "x-node": "bigweb1nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "167" + }, + "Body": "{\"id\":\"hook_1c68abe498f011eca2f2137e313adcb3\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testretrieve.com\",\"created_at\":\"2022-02-28T23:42:38Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:37.839527-08:00" + }, + { + "Request": { + "Method": "GET", + "URI": "https://api.easypost.com/v2/webhooks/hook_1c68abe498f011eca2f2137e313adcb3", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596087621d5deee4d177df00a411fe", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"7e58a0eb57a5976a1aed04020d018fde\"", + "X-Request-ID": "42e0fec5-57f6-4bfb-a8ce-90b3d1dbcdc6", + "x-runtime": "0.027887", + "x-node": "bigweb5nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb1nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "167" + }, + "Body": "{\"id\":\"hook_1c68abe498f011eca2f2137e313adcb3\",\"object\":\"Webhook\",\"mode\":\"test\",\"url\":\"https://testretrieve.com\",\"created_at\":\"2022-02-28T23:42:38Z\",\"disabled_at\":null}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:38.703675-08:00" + }, + { + "Request": { + "Method": "DELETE", + "URI": "https://api.easypost.com/v2/webhooks/hook_1c68abe498f011eca2f2137e313adcb3", + "RequestHeaders": { + "Accept": "application/json", + "Authorization": "********", + "content_type": "application/json", + "User-Agent": "EasyPost/v2,CSharpClient/2.8.1,.NET/5.0.13" + }, + "ContentHeaders": {}, + "Body": "" + }, + "Response": { + "Status": { + "Code": 200, + "Message": "OK" + }, + "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": "5f596085621d5defe4d177e000a4120d", + "Cache-Control": "no-store, no-cache", + "Pragma": "no-cache", + "ETag": "W/\"44136fa355b3678a1146ad16f7e8649e\"", + "X-Request-ID": "64bda689-14ae-4598-8b29-c4923f4e3c29", + "x-runtime": "0.325983", + "x-node": "bigweb8nuq", + "x-version-label": "easypost-202202282222-e6cd2b4eed-master", + "x-backend": "easypost", + "x-proxied": "intlb2nuq 88c34981dc,extlb2nuq 88c34981dc", + "Strict-Transport-Security": "max-age=31536000; includeSubDomains; preload" + }, + "ContentHeaders": { + "Expires": "0", + "Content-Type": "application/json; charset=utf-8", + "Content-Length": "2" + }, + "Body": "{}", + "RequestMessage": null, + "HttpVersion": "1.1" + }, + "RecordedAt": "2022-02-28T15:42:39.454983-08:00" + } +] \ No newline at end of file diff --git a/EasyPost.Tests.Net50/EasyPost.Tests.Net50.csproj b/EasyPost.Tests.Net50/EasyPost.Tests.Net50.csproj index d3b66da1c..073bd8b0f 100644 --- a/EasyPost.Tests.Net50/EasyPost.Tests.Net50.csproj +++ b/EasyPost.Tests.Net50/EasyPost.Tests.Net50.csproj @@ -22,6 +22,7 @@ + @@ -35,33 +36,21 @@ AddressTest.cs - - ApiKeyTest.cs - BatchTest.cs CarrierAccountTest.cs - - CarrierTypeTest.cs - - - ClientConfigurationTest.cs - - - ClientManagerTest.cs - - - ClientTest.cs - CustomsInfoTest.cs CustomsItemTest.cs + + EasyPostTest.cs + ErrorTest.cs @@ -83,27 +72,18 @@ RateTest.cs + + RefundTest.cs + ReportTest.cs - - RequestTest.cs - - - ResourceTest.cs - ScanFormTest.cs - - SecurityTest.cs - ShipmentTest.cs - - TimeoutTest.cs - TrackerTest.cs @@ -113,6 +93,12 @@ WebhookTest.cs + + VCR.cs + + + Fixture.cs + diff --git a/EasyPost.Tests.Net60/EasyPost.Tests.Net60.csproj b/EasyPost.Tests.Net60/EasyPost.Tests.Net60.csproj index 03d77c494..b526500a8 100644 --- a/EasyPost.Tests.Net60/EasyPost.Tests.Net60.csproj +++ b/EasyPost.Tests.Net60/EasyPost.Tests.Net60.csproj @@ -22,6 +22,7 @@ + @@ -35,33 +36,21 @@ AddressTest.cs - - ApiKeyTest.cs - BatchTest.cs CarrierAccountTest.cs - - CarrierTypeTest.cs - - - ClientConfigurationTest.cs - - - ClientManagerTest.cs - - - ClientTest.cs - CustomsInfoTest.cs CustomsItemTest.cs + + EasyPostTest.cs + ErrorTest.cs @@ -83,27 +72,18 @@ RateTest.cs + + RefundTest.cs + ReportTest.cs - - RequestTest.cs - - - ResourceTest.cs - ScanFormTest.cs - - SecurityTest.cs - ShipmentTest.cs - - TimeoutTest.cs - TrackerTest.cs @@ -113,6 +93,12 @@ WebhookTest.cs + + VCR.cs + + + Fixture.cs + diff --git a/EasyPost.Tests.NetCore31/EasyPost.Tests.NetCore31.csproj b/EasyPost.Tests.NetCore31/EasyPost.Tests.NetCore31.csproj index c7a22189b..e469b671b 100644 --- a/EasyPost.Tests.NetCore31/EasyPost.Tests.NetCore31.csproj +++ b/EasyPost.Tests.NetCore31/EasyPost.Tests.NetCore31.csproj @@ -22,6 +22,7 @@ + @@ -35,33 +36,21 @@ AddressTest.cs - - ApiKeyTest.cs - BatchTest.cs CarrierAccountTest.cs - - CarrierTypeTest.cs - - - ClientConfigurationTest.cs - - - ClientManagerTest.cs - - - ClientTest.cs - CustomsInfoTest.cs CustomsItemTest.cs + + EasyPostTest.cs + ErrorTest.cs @@ -83,27 +72,18 @@ RateTest.cs + + RefundTest.cs + ReportTest.cs - - RequestTest.cs - - - ResourceTest.cs - ScanFormTest.cs - - SecurityTest.cs - ShipmentTest.cs - - TimeoutTest.cs - TrackerTest.cs @@ -113,6 +93,12 @@ WebhookTest.cs + + VCR.cs + + + Fixture.cs + diff --git a/EasyPost.Tests.NetFramework/AddressTest.cs b/EasyPost.Tests.NetFramework/AddressTest.cs index 77bc76bf4..7e74e0585 100644 --- a/EasyPost.Tests.NetFramework/AddressTest.cs +++ b/EasyPost.Tests.NetFramework/AddressTest.cs @@ -1,376 +1,116 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class AddressTest { - private Address _address; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - _address = new Address - { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; + TestSuite.SetUp(TestSuiteApiKey.Test); } - [TestMethod] - public void TestCreateAndRetrieve() + private static Address CreateBasicAddress() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Address address = Address.Create(parameters); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "Simpler Postage Inc"); - Assert.IsNull(address.name); - - Address retrieved = Address.Retrieve(address.id); - Assert.AreEqual(address.id, retrieved.id); + return Address.Create(Fixture.BasicAddress); } [TestMethod] - public void TestCreateAndVerify() + public void TestCreate() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Address address = Address.CreateAndVerify(parameters); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.IsNull(address.name); - Assert.AreEqual(address.verifications.delivery.success, true); - } + Address address = CreateBasicAddress(); - [TestMethod] - public void TestCreateInstance() - { - _address.Create(); - Assert.IsNotNull(_address.id); + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 Townsend St", address.street1); } [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestCreateWithStrictVerifications() + public void TestCreateVerifyStrict() { - Dictionary parameters = new Dictionary + Dictionary addressData = Fixture.BasicAddress; + addressData.Add("verify_strict", new List { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "123 Fake Street" - }, - { - "zip", "94107" - }, - { - "strict_verifications", new List - { - "delivery", - "zip4" - } - } - }; + true + }); + + Address address = Address.Create(addressData); - Address address = Address.Create(parameters); + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } + [TestMethod] - public void TestCreateWithVerifications() + public void TestRetrieve() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "verifications", new List - { - "delivery", - "zip4" - } - } - }; + Address address = Address.Create(Fixture.BasicAddress); - Address address = Address.Create(parameters); - Assert.IsNotNull(address.verifications.delivery); - Assert.IsNotNull(address.verifications.zip4); + Address retrievedAddress = Address.Retrieve(address.id); - parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "123 Fake Street" - }, - { - "zip", "94107" - }, - { - "verifications", new List - { - "delivery", - "zip4" - } - } - }; - - address = Address.Create(parameters); - Assert.AreEqual(address.verifications.delivery.success, false); + Assert.IsInstanceOfType(retrievedAddress, typeof(Address)); + Assert.AreEqual(address.id, retrievedAddress.id); } [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestInstanceCreateWithStrictVerifications() + public void TestAll() { - _address = new Address - { - company = "Simpler Postage Inc" - }; - _address.Create(strictVerifications: new List + AddressCollection addressCollection = Address.All(new Dictionary { - "delivery", - "zip4" + { + "page_size", Fixture.PageSize + } }); - } - [TestMethod] - public void TestInstanceCreateWithVerificationParams() - { - _address.Create(new List - { - "delivery", - "zip4" - }); - Assert.IsNotNull(_address.verifications.delivery); - Assert.IsNotNull(_address.verifications.zip4); - } + List
addresses = addressCollection.addresses; - [TestMethod] - public void TestInstanceCreateWithVerifications() - { - Address address = new Address + Assert.IsTrue(addresses.Count <= Fixture.PageSize); + Assert.IsNotNull(addressCollection.has_more); + foreach (var item in addresses) { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107", - verify = new List - { - "delivery", - "zip4" - } - }; - - address.Create(); - Assert.IsNotNull(address.verifications.delivery); - Assert.IsNotNull(address.verifications.zip4); + Assert.IsInstanceOfType(item, typeof(Address)); + } } [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestRetrieveInvalidId() => Address.Retrieve("not-an-id"); - - [TestMethod] - public void TestRetrieveAll() + public void TestCreateVerify() { - AddressCollection addressCollection = Address.All(); - Assert.IsNotNull(addressCollection); - foreach (var address in addressCollection.addresses) - { - Assert.IsNotNull(address.id); - Assert.AreEqual(address.id.Substring(0, 4), "adr_"); - } + Address address = Address.Create(Fixture.IncorrectAddressToVerify); + + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("417 MONTGOMERY ST STE 500", address.street1); } [TestMethod] - public void TestVerificationFailure() + public void TestCreateAndVerify() { - Address address = new Address + Dictionary addressData = Fixture.BasicAddress; + addressData.Add("verify_strict", new List { - company = "Simpler Postage Inc", - street1 = "1645456 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; + true + }); - address.Create(); + Address address = Address.CreateAndVerify(addressData); - try - { - address.Verify(); - } - catch (HttpException e) - { - Assert.AreEqual("ADDRESS.VERIFY.FAILURE", e.Code); - Assert.AreEqual("Unable to verify address.", e.Message); - Assert.AreEqual("E.ADDRESS.NOT_FOUND", e.Errors[0].code); - Assert.AreEqual("address", e.Errors[0].field); - Assert.AreEqual("Address not found", e.Errors[0].message); - } + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } [TestMethod] public void TestVerify() { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "residential", true - } - }; - Address address = Address.Create(parameters); - address.Verify(); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.IsNull(address.name); - Assert.IsNotNull(address.residential); - Assert.IsFalse(address.residential); - } + Address address = CreateBasicAddress(); - [TestMethod] - public void TestVerifyBeforeCreate() - { - _address.Verify(); - Assert.IsNotNull(_address.id); - } + address.Verify(); - [TestMethod] - public void TestVerifyCarrier() - { - Dictionary parameters = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - }, - { - "residential", true - } - }; - Address address = Address.Create(parameters); - address.Verify("usps"); - Assert.IsNotNull(address.id); - Assert.AreEqual(address.company, "SIMPLER POSTAGE INC"); - Assert.AreEqual(address.street1, "164 TOWNSEND ST UNIT 1"); - Assert.IsNull(address.name); + Assert.IsInstanceOfType(address, typeof(Address)); + Assert.IsTrue(address.id.StartsWith("adr_")); + Assert.AreEqual("388 TOWNSEND ST APT 20", address.street1); } } } diff --git a/EasyPost.Tests.NetFramework/ApiKeyTest.cs b/EasyPost.Tests.NetFramework/ApiKeyTest.cs deleted file mode 100644 index 12aec78ea..000000000 --- a/EasyPost.Tests.NetFramework/ApiKeyTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ApiKeyTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestAll() - { - List keys = ApiKey.All(); - Assert.AreEqual(keys.Count, 2); - } - } -} diff --git a/EasyPost.Tests.NetFramework/BatchTest.cs b/EasyPost.Tests.NetFramework/BatchTest.cs index 8e8ba8fec..c566784f3 100644 --- a/EasyPost.Tests.NetFramework/BatchTest.cs +++ b/EasyPost.Tests.NetFramework/BatchTest.cs @@ -1,232 +1,161 @@ using System.Collections.Generic; -using System.Linq; - +using System.Threading; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class BatchTest { - private Dictionary batchShipmentParameters; - private Dictionary fromAddress; - private Dictionary shipmentParameters; - private Dictionary toAddress; + [TestInitialize] + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } - public Batch CreateBatch() + private static Batch CreateBasicBatch() { - Dictionary parameters = new Dictionary + return Batch.Create(new Dictionary { - { - "reference", "EasyPostCSharpTest" - }, { "shipments", new List> { - batchShipmentParameters + Fixture.BasicShipment } } - }; - - return Batch.Create(parameters); + }); } - [TestInitialize] - public void Initialize() + private static Batch CreateOneCallBuyBatch() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - toAddress = new Dictionary + return Batch.Create(new Dictionary { { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - shipmentParameters = new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - } - }; - batchShipmentParameters = new Dictionary - { - { - "parcel", new Dictionary + "shipments", new List> { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } + Fixture.OneCallBuyShipment } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "carrier", "USPS" - }, - { - "service", "Priority" } - }; + }); } [TestMethod] - public void TestAddRemoveShipments() + public void TestCreate() { - Batch batch = Batch.Create(); - Shipment shipment = Shipment.Create(shipmentParameters); - Shipment otherShipment = Shipment.Create(shipmentParameters); + Batch batch = CreateBasicBatch(); - while (batch.state != "created") - { - batch = Batch.Retrieve(batch.id); - } + Assert.IsInstanceOfType(batch, typeof(Batch)); + Assert.IsTrue(batch.id.StartsWith("batch_")); + Assert.IsNotNull(batch.shipments); + } - batch.AddShipments(new List - { - shipment, - otherShipment - }); + [TestMethod] + public void TestRetrieve() + { + Batch batch = CreateBasicBatch(); - while (batch.shipments == null) - { - batch = Batch.Retrieve(batch.id); - } + Batch retrievedBatch = Batch.Retrieve(batch.id); - List shipmentIds = batch.shipments.Select(ship => ship.id).ToList(); - Assert.AreEqual(batch.num_shipments, 2); - CollectionAssert.Contains(shipmentIds, shipment.id); - CollectionAssert.Contains(shipmentIds, otherShipment.id); + Assert.IsInstanceOfType(retrievedBatch, typeof(Batch)); + Assert.AreEqual(batch.id, retrievedBatch.id); + } - batch.RemoveShipments(new List + [TestMethod] + public void TestAll() + { + BatchCollection batchCollection = Batch.All(new Dictionary { - shipment, - otherShipment + { + "page_size", Fixture.PageSize + } }); - Assert.AreEqual(batch.num_shipments, 0); + + List batches = batchCollection.batches; + + Assert.IsTrue(batches.Count <= Fixture.PageSize); + Assert.IsNotNull(batchCollection.has_more); + foreach (var item in batches) + { + Assert.IsInstanceOfType(item, typeof(Batch)); + } } + // TODO: C# doesn't have a CreateAndBuy method for Batch + [Ignore] [TestMethod] - public void TestCreateThenBuyThenGenerateLabelAndScanForm() + public void TestCreateAndBuy() { - Batch batch = CreateBatch(); + } - Assert.IsNotNull(batch.id); - Assert.AreEqual(batch.reference, "EasyPostCSharpTest"); - Assert.AreEqual(batch.state, "creating"); + // hard to test because the sleep time is hit-or-miss + [Ignore] + [TestMethod] + public void TestBuy() + { + var data = Fixture.OneCallBuyShipment; - while (batch.state == "creating") - { - batch = Batch.Retrieve(batch.id); - } + Batch batch = CreateOneCallBuyBatch(); batch.Buy(); - while (batch.state == "created") - { - batch = Batch.Retrieve(batch.id); - } + Assert.IsInstanceOfType(batch, typeof(Batch)); + Assert.AreEqual(1, batch.num_shipments); + } - Assert.AreEqual(batch.state, "purchased"); + // hard to test because the sleep time is hit-or-miss + [Ignore] + [TestMethod] + public void TestCreateScanForm() + { + Batch batch = CreateOneCallBuyBatch(); + batch.Buy(); - batch.GenerateLabel("pdf"); - Assert.AreEqual(batch.state, "label_generating"); + // Uncomment the following line if you need to re-record the cassette + Thread.Sleep(10000); // Wait enough time for the batch to process buying the shipment batch.GenerateScanForm(); + + // We can't assert anything meaningful here because the scanform gets queued for generation and may not be immediately available + Assert.IsInstanceOfType(batch, typeof(Batch)); } [TestMethod] - public void TestRetrieve() + public void TestAddRemoveShipment() { + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + Batch batch = Batch.Create(); - Batch retrieved = Batch.Retrieve(batch.id); - Assert.AreEqual(batch.id, retrieved.id); + + batch.AddShipments(new List + { + shipment + }); + + Assert.AreEqual(1, batch.num_shipments); + + batch.RemoveShipments(new List + { + shipment + }); + + Assert.AreEqual(0, batch.num_shipments); } + // hard to test because the sleep time is hit-or-miss + [Ignore] [TestMethod] - public void TestRetrieveAll() + public void TestLabel() { - BatchCollection batchCollection = Batch.All(); - Assert.IsNotNull(batchCollection); - foreach (var batch in batchCollection.batches) - { - Assert.IsNotNull(batch.id); - Assert.AreEqual(batch.id.Substring(0, 6), "batch_"); - } + Batch batch = CreateOneCallBuyBatch(); + batch.Buy(); + + // Uncomment the following line if you need to re-record the cassette + Thread.Sleep(10000); // Wait enough time for the batch to process buying the shipment + + batch.GenerateLabel("ZPL"); + + // We can't assert anything meaningful here because the label gets queued for generation and may not be immediately available + Assert.IsInstanceOfType(batch, typeof(Batch)); } } } diff --git a/EasyPost.Tests.NetFramework/CarrierAccountTest.cs b/EasyPost.Tests.NetFramework/CarrierAccountTest.cs index ebf2ad1cc..af5d3ab8e 100644 --- a/EasyPost.Tests.NetFramework/CarrierAccountTest.cs +++ b/EasyPost.Tests.NetFramework/CarrierAccountTest.cs @@ -1,63 +1,92 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class CarrierAccountTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Production); + } + + private static CarrierAccount CreateBasicCarrierAccount() + { + return CarrierAccount.Create(Fixture.BasicCarrierAccount); + } + + [TestMethod] + public void TestCreate() + { + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + Assert.IsInstanceOfType(carrierAccount, typeof(CarrierAccount)); + Assert.IsTrue(carrierAccount.id.StartsWith("ca_")); + } + + [TestMethod] + public void TestRetrieve() + { + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + CarrierAccount retrievedCarrierAccount = CarrierAccount.Retrieve(carrierAccount.id); + + Assert.IsInstanceOfType(retrievedCarrierAccount, typeof(CarrierAccount)); + Assert.AreEqual(carrierAccount.id, retrievedCarrierAccount.id); + } - [Ignore] [TestMethod] - public void TestCRUD() + public void TestAll() { - CarrierAccount account = CarrierAccount.Create(new Dictionary + List carrierAccounts = CarrierAccount.All(); + + foreach (var item in carrierAccounts) { - { - "type", "DhlExpressAccount" - }, - { - "description", "description" - } - }); + Assert.IsInstanceOfType(item, typeof(CarrierAccount)); + } + } - Assert.IsNotNull(account.id); - Assert.AreEqual(account.type, "DhlExpressAccount"); + [TestMethod] + public void TestUpdate() + { + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + string testDescription = "my custom description"; - account.Update(new Dictionary + Dictionary carrierAccountData = new Dictionary { { - "reference", "new-reference" + "description", testDescription } - }); - Assert.AreEqual("new-reference", account.reference); + }; + carrierAccount.Update(carrierAccountData); - account.Destroy(); - try - { - CarrierAccount.Retrieve(account.id); - Assert.Fail(); - } - catch (HttpException) - { - } + Assert.IsInstanceOfType(carrierAccount, typeof(CarrierAccount)); + Assert.IsTrue(carrierAccount.id.StartsWith("ca_")); + Assert.AreEqual(testDescription, carrierAccount.description); } [TestMethod] - public void TestAll() + public void TestDelete() { - List accounts = CarrierAccount.All(); - Assert.AreEqual(accounts[0].id, "ca_7642d249fdcf47bcb5da9ea34c96dfcf"); + CarrierAccount carrierAccount = CreateBasicCarrierAccount(); + + bool success = carrierAccount.Destroy(); + + Assert.IsTrue(success); } [TestMethod] - public void TestRetrieve() + public void TestTypes() { - CarrierAccount account = CarrierAccount.Retrieve("ca_7642d249fdcf47bcb5da9ea34c96dfcf"); - Assert.AreEqual("ca_7642d249fdcf47bcb5da9ea34c96dfcf", account.id); + List types = CarrierType.All(); + + foreach (var item in types) + { + Assert.IsInstanceOfType(item, typeof(CarrierType)); + } } } } diff --git a/EasyPost.Tests.NetFramework/CarrierTypeTest.cs b/EasyPost.Tests.NetFramework/CarrierTypeTest.cs deleted file mode 100644 index bd9541897..000000000 --- a/EasyPost.Tests.NetFramework/CarrierTypeTest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class CarrierTypeTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestAll() - { - List types = CarrierType.All(); - Assert.AreNotEqual(0, types.Count); - } - } -} diff --git a/EasyPost.Tests.NetFramework/ClientConfigurationTest.cs b/EasyPost.Tests.NetFramework/ClientConfigurationTest.cs deleted file mode 100644 index 7d1ef143b..000000000 --- a/EasyPost.Tests.NetFramework/ClientConfigurationTest.cs +++ /dev/null @@ -1,27 +0,0 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ClientConfigurationTest - { - [TestMethod] - public void TestApiKeyConstructor() - { - ClientConfiguration config = new ClientConfiguration("someApiKey"); - - Assert.AreEqual("someApiKey", config.ApiKey); - Assert.AreEqual("https://api.easypost.com/v2", config.ApiBase); - } - - [TestMethod] - public void TestApiKeyPlusBaseUrlConstructor() - { - ClientConfiguration config = new ClientConfiguration("someApiKey", "http://foobar.com"); - - Assert.AreEqual("someApiKey", config.ApiKey); - Assert.AreEqual("http://foobar.com", config.ApiBase); - } - } -} diff --git a/EasyPost.Tests.NetFramework/ClientManagerTest.cs b/EasyPost.Tests.NetFramework/ClientManagerTest.cs deleted file mode 100644 index 475257ae5..000000000 --- a/EasyPost.Tests.NetFramework/ClientManagerTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -// using Microsoft.VisualStudio.TestTools.UnitTesting; - -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class ClientManagerTest { -// [TestMethod] -// [ExpectedException(typeof(ClientNotConfigured))] -// public void TestNotConfigured() { -// ClientManager.Unconfigure(); -// ClientManager.Build(); -// } - -// [TestMethod] -// public void TestApiKey() { -// ClientManager.SetCurrent("apiKey"); -// Client client = ClientManager.Build(); -// Assert.AreEqual("apiKey", client.configuration.ApiKey); -// } - -// [TestMethod] -// public void TestApiKeyForUniqueObjects() { -// ClientManager.SetCurrent("apiKey"); -// Client client1 = ClientManager.Build(); -// Client client2 = ClientManager.Build(); - -// Assert.AreNotSame(client1, client2); -// } - -// [TestMethod] -// public void TestFactoryDelegate() { -// ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); -// Client client = ClientManager.Build(); -// Assert.AreEqual("apiKey", client.configuration.ApiKey); -// } - -// [TestMethod] -// public void TestFactoryDelegateForUniqueObjects() { -// ClientManager.SetCurrent(() => new Client(new ClientConfiguration("apiKey"))); -// Client client1 = ClientManager.Build(); -// Client client2 = ClientManager.Build(); - -// Assert.AreNotSame(client1, client2); -// } -// } -// } - - diff --git a/EasyPost.Tests.NetFramework/ClientTest.cs b/EasyPost.Tests.NetFramework/ClientTest.cs deleted file mode 100644 index e3725686c..000000000 --- a/EasyPost.Tests.NetFramework/ClientTest.cs +++ /dev/null @@ -1,64 +0,0 @@ -//using System; -//using System.Linq; -//using System.Collections.Generic; -//using Microsoft.VisualStudio.TestTools.UnitTesting; - -//public class JsonTest { -// public string key { get; set; } -//} - -//namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class ClientTest { - -// [TestMethod] -// public void TestApiKey() { -// ClientManager.SetCurrent("apiKey"); -// Assert.AreEqual("apiKey", ClientManager.Build().configuration.ApiKey); -// } - -// [TestMethod] -// public void TestApiBase() { -// Client client = new Client(new ClientConfiguration("apiKey", "https://foobar.com")); -// Assert.AreEqual(new System.Uri("https://foobar.com"), client.client.BaseUrl); -// } - -// [TestMethod] -// public void TestRestClient() { -// Client client = new Client(new ClientConfiguration("apiKey")); -// Assert.AreEqual(client.client.BaseUrl, "https://api.easypost.com/"); -// } - -// [TestMethod] -// public void TestRestClientWithOptions() { -// Client client = new Client(new ClientConfiguration("someapikey", "http://apiBase.com")); -// Assert.AreEqual(new Uri("http://apiBase.com"), client.client.BaseUrl); -// } - -// [TestMethod] -// public void TestPrepareRequest() { -// const string apiKey = "apiKey"; - -// ClientManager.SetCurrent(apiKey); -// Request request = new Request("resource"); - -// List parameters = ClientManager.Build().PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); -// CollectionAssert.Contains(parameters, "user_agent=EasyPost/v2 CSharp/" + ClientManager.Build().version); -// CollectionAssert.Contains(parameters, "authorization=Bearer " + apiKey); -// CollectionAssert.Contains(parameters, "content_type=application/json"); -// } - -// [TestMethod] -// public void TestPrepareRequestWithOptions() { -// Client client = new Client(new ClientConfiguration("someapikey", "http://foobar.com")); -// Request request = new Request("resource"); - -// List parameters = client.PrepareRequest(request).Parameters.Select(parameter => parameter.ToString()).ToList(); -// CollectionAssert.Contains(parameters, "user_agent=EasyPost/v2 CSharp/" + client.version); -// CollectionAssert.Contains(parameters, "authorization=Bearer someapikey"); -// CollectionAssert.Contains(parameters, "content_type=application/json"); -// } -// } -//} - - diff --git a/EasyPost.Tests.NetFramework/CustomsInfoTest.cs b/EasyPost.Tests.NetFramework/CustomsInfoTest.cs index 983a9687b..2eaaaa6b2 100644 --- a/EasyPost.Tests.NetFramework/CustomsInfoTest.cs +++ b/EasyPost.Tests.NetFramework/CustomsInfoTest.cs @@ -1,84 +1,40 @@ -using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class CustomsInfoTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } - [TestMethod] - public void TestCreateAndRetrieve() + private static CustomsInfo CreateBasicCustomsInfo() { - Dictionary item = new Dictionary - { - { - "description", "TShirt" - }, - { - "quantity", 1 - }, - { - "weight", 8 - }, - { - "origin_country", "US" - } - }; + return CustomsInfo.Create(Fixture.BasicCustomsInfo); + } - CustomsInfo info = CustomsInfo.Create(new Dictionary - { - { - "customs_certify", true - }, - { - "eel_pfc", "NOEEI 30.37(a)" - }, - { - "customs_items", new List> - { - item - } - } - }); + [TestMethod] + public void TestCreate() + { + CustomsInfo customsInfo = CreateBasicCustomsInfo(); - CustomsInfo retrieved = CustomsInfo.Retrieve(info.id); - Assert.AreEqual(info.id, retrieved.id); - Assert.IsNotNull(retrieved.customs_items); + Assert.IsInstanceOfType(customsInfo, typeof(CustomsInfo)); + Assert.IsTrue(customsInfo.id.StartsWith("cstinfo_")); + Assert.AreEqual("NOEEI 30.37(a)", customsInfo.eel_pfc); } [TestMethod] - public void TestCreateWithIResource() + public void TestRetrieve() { - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = CustomsInfo.Create( - new Dictionary - { - { - "customs_certify", true - }, - { - "eel_pfc", "NOEEI 30.37(a)" - }, - { - "customs_items", new List - { - item - } - } - } - ); + CustomsInfo customsInfo = CreateBasicCustomsInfo(); + + CustomsInfo retrievedCustomsInfo = CustomsInfo.Retrieve(customsInfo.id); - Assert.IsNotNull(info.id); - Assert.AreEqual(info.customs_items.Count, 1); - Assert.AreEqual(info.customs_items[0].description, item.description); + Assert.IsInstanceOfType(retrievedCustomsInfo, typeof(CustomsInfo)); + Assert.AreEqual(customsInfo.id, retrievedCustomsInfo.id); } } } diff --git a/EasyPost.Tests.NetFramework/CustomsItemTest.cs b/EasyPost.Tests.NetFramework/CustomsItemTest.cs index 9297dc1cc..13194aae9 100644 --- a/EasyPost.Tests.NetFramework/CustomsItemTest.cs +++ b/EasyPost.Tests.NetFramework/CustomsItemTest.cs @@ -1,40 +1,40 @@ -using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class CustomsItemTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + + private static CustomsItem CreateBasicCustomsItem() + { + return CustomsItem.Create(Fixture.BasicCustomsItem); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreate() { - CustomsItem item = CustomsItem.Create(new Dictionary - { - { - "description", "TShirt" - }, - { - "quantity", 1 - }, - { - "weight", 8 - }, - { - "value", 10.0 - }, - { - "currency", "USD" - } - }); - CustomsItem retrieved = CustomsItem.Retrieve(item.id); - Assert.AreEqual(item.id, retrieved.id); - Assert.AreEqual(retrieved.value, 10.0); - Assert.AreEqual(retrieved.currency, "USD"); + CustomsItem customsItem = CreateBasicCustomsItem(); + + Assert.IsInstanceOfType(customsItem, typeof(CustomsItem)); + Assert.IsTrue(customsItem.id.StartsWith("cstitem_")); + Assert.AreEqual(23.0, customsItem.value); + } + + [TestMethod] + public void TestRetrieve() + { + CustomsItem customsItem = CreateBasicCustomsItem(); + + CustomsItem retrievedCustomsItem = CustomsItem.Retrieve(customsItem.id); + + Assert.IsInstanceOfType(retrievedCustomsItem, typeof(CustomsItem)); + Assert.AreEqual(customsItem.id, retrievedCustomsItem.id); } } } diff --git a/EasyPost.Tests.NetFramework/EasyPostTest.cs b/EasyPost.Tests.NetFramework/EasyPostTest.cs new file mode 100644 index 000000000..0022e823b --- /dev/null +++ b/EasyPost.Tests.NetFramework/EasyPostTest.cs @@ -0,0 +1,53 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace EasyPost.Tests.NetFramework +{ + [TestClass] + public class EasyPostTest + { + private const string FakeApikey = "fake_api_key"; + private const string FakeApiUrl = "https://fake.api.com"; + private const string HttpBinUrl = "https://httpbin.org/get"; + + private static ClientConfiguration GetBasicClientConfiguration() + { + return new ClientConfiguration(FakeApikey); + } + + [TestMethod] + public void TestApiKeyConstructor() + { + ClientConfiguration config = GetBasicClientConfiguration(); + + Assert.AreEqual(FakeApikey, config.ApiKey); + Assert.AreEqual("https://api.easypost.com/v2", config.ApiBase); + } + + [TestMethod] + public void TestApiKeyPlusBaseUrlConstructor() + { + ClientConfiguration config = new ClientConfiguration(FakeApikey, FakeApiUrl); + + Assert.AreEqual(FakeApikey, config.ApiKey); + Assert.AreEqual(FakeApiUrl, config.ApiBase); + } + + [TestMethod] + public void TestTimeout() + { + Client client = new Client(GetBasicClientConfiguration()); + client.ConnectTimeoutMilliseconds = 5000; + client.RequestTimeoutMilliseconds = 5000; + + Assert.AreEqual(5000, client.ConnectTimeoutMilliseconds); + Assert.AreEqual(5000, client.RequestTimeoutMilliseconds); + } + + [TestMethod] + public void TestNotConfigured() + { + ClientManager.Unconfigure(); + Assert.ThrowsException(() => new Request("resource").Execute()); + } + } +} diff --git a/EasyPost.Tests.NetFramework/ErrorTest.cs b/EasyPost.Tests.NetFramework/ErrorTest.cs index de14905e3..790a00c81 100644 --- a/EasyPost.Tests.NetFramework/ErrorTest.cs +++ b/EasyPost.Tests.NetFramework/ErrorTest.cs @@ -1,7 +1,6 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class ErrorTest @@ -11,20 +10,23 @@ public class ErrorTest [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - _error = - "{\"code\":\"E.ADDRESS.NOT_FOUND\",\"field\":\"address\",\"suggestion\":\"foobar\",\"message\":\"Address not found\"}"; + TestSuite.SetUp(TestSuiteApiKey.Test); } [TestMethod] - public void TestErrorLoad() + public void TestError() { - Error e = Error.Load(_error); - Assert.AreEqual("E.ADDRESS.NOT_FOUND", e.code); - Assert.AreEqual("Address not found", e.message); - Assert.AreEqual("address", e.field); - Assert.AreEqual("foobar", e.suggestion); + try + { + var _ = Shipment.Create(); + } + catch (HttpException error) + { + Assert.AreEqual(422, error.StatusCode); + Assert.AreEqual("SHIPMENT.INVALID_PARAMS", error.Code); + Assert.AreEqual("Unable to create shipment, one or more parameters were invalid.", error.Message); + Assert.IsTrue(error.Errors.Count == 2); + } } } } diff --git a/EasyPost.Tests.NetFramework/EventTest.cs b/EasyPost.Tests.NetFramework/EventTest.cs index 29cb63909..9f3d5c6bd 100644 --- a/EasyPost.Tests.NetFramework/EventTest.cs +++ b/EasyPost.Tests.NetFramework/EventTest.cs @@ -1,35 +1,65 @@ - +using System; +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class EventTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + + private static EventCollection GetBasicEventCollection() + { + return Event.All(new Dictionary + { + { + "page_size", Fixture.PageSize + } + }); + } [TestMethod] - public void TestLoad() => Assert.AreEqual(Resource.Load("{'id': 'barfoo'}").id, "barfoo"); + public void TestAll() + { + EventCollection eventCollection = GetBasicEventCollection(); + + List events = eventCollection.events; + + Assert.IsTrue(events.Count <= Fixture.PageSize); + Assert.IsNotNull(eventCollection.has_more); + foreach (var item in events) + { + Assert.IsInstanceOfType(item, typeof(Event)); + } + } [TestMethod] - [ExpectedException(typeof(HttpException))] public void TestRetrieve() { - // Events are archived after some time. Lets at least make sure we get a 404. - Event e = Event.Retrieve("evt_d0000c1a9c6c4614949af6931ea9fac8"); + EventCollection eventCollection = GetBasicEventCollection(); + Event _event = eventCollection.events[0]; + + Event retrievedEvent = Event.Retrieve(_event.id); + + Assert.IsInstanceOfType(retrievedEvent, typeof(Event)); + Assert.AreEqual(_event.id, retrievedEvent.id); } [TestMethod] - public void TestRetrieveAll() + public void TestRetrieveBadInput() { - EventCollection eventCollection = Event.All(); - Assert.IsNotNull(eventCollection); - foreach (var tEvent in eventCollection.events) - { - Assert.IsNotNull(tEvent.id); - Assert.AreEqual(tEvent.id.Substring(0, 4), "evt_"); - } + Assert.ThrowsException(() => Event.Retrieve("bad input")); + } + + [TestMethod] + public void TestRetrieveNoInput() + { + Assert.ThrowsException(() => Event.Retrieve("")); } } } diff --git a/EasyPost.Tests.NetFramework/Fixture.cs b/EasyPost.Tests.NetFramework/Fixture.cs new file mode 100644 index 000000000..023f0c789 --- /dev/null +++ b/EasyPost.Tests.NetFramework/Fixture.cs @@ -0,0 +1,437 @@ +using System; +using System.Collections.Generic; + +namespace EasyPost.Tests.NetFramework +{ + public static class Fixture + { + // We keep the page_size of retrieving `all` records small so cassettes stay small + public const int PageSize = 5; + + // This is the carrier account ID for the default USPS account that comes by default. All tests should use this carrier account + public const string UspsCarrierAccountId = "ca_7642d249fdcf47bcb5da9ea34c96dfcf"; + + // TODO: this ID doesn't exist for the API keys being used for the C# tests + public const string ChildUserId = "user_608a91d0487e419bb465e5acbc999056"; + + public const string Usps = "USPS"; + + public const string UspsService = "First"; + + public const string NextDayService = "NextDay"; + + // If ever these need to change due to re-recording cassettes, simply increment this date by 1 + public const string ReportStartDate = "2022-02-01"; + + // If ever these need to change due to re-recording cassettes, simply increment this date by 1 + public const string ReportEndDate = "2022-02-03"; + + public static string RandomUrl => $"https://{Guid.NewGuid().ToString().Substring(0, 8)}.com"; + + public static Dictionary BasicAddress + { + get + { + return new Dictionary + { + { + "name", "Jack Sparrow" + }, + { + "company", "EasyPost" + }, + { + "street1", "388 Townsend St" + }, + { + "street2", "Apt 20" + }, + { + "city", "San Francisco" + }, + { + "state", "CA" + }, + { + "zip", "94107" + }, + { + "country", "US" + }, + { + "phone", "5555555555" + }, + }; + } + } + + public static Dictionary IncorrectAddressToVerify + { + get + { + return new Dictionary + { + { + "verify", new List + { + true + } + }, + { + "street1", "417 montgomery streat" + }, + { + "street2", "FL 5" + }, + { + "city", "San Francisco" + }, + { + "state", "CA" + }, + { + "zip", "94104" + }, + { + "country", "US" + }, + { + "company", "EasyPost" + }, + { + "phone", "415-123-4567" + } + }; + } + } + + public static Dictionary PickupAddress + { + get + { + return new Dictionary + { + { + "name", "Dr. Steve Brule" + }, + { + "street1", "179 N Harbor Dr" + }, + { + "city", "Redondo Beach" + }, + { + "state", "CA" + }, + { + "zip", "90277" + }, + { + "country", "US" + }, + { + "phone", "3331114444" + } + }; + } + } + + public static Dictionary BasicParcel + { + get + { + return new Dictionary + { + { + "length", "10" + }, + { + "width", "8" + }, + { + "height", "4" + }, + { + "weight", "15.4" + } + }; + } + } + + public static Dictionary BasicCustomsItem + { + get + { + return new Dictionary + { + { + "description", "Sweet shirts" + }, + { + "quantity", 2 + }, + { + "weight", 11 + }, + { + "value", 23.00 + }, + { + "hs_tariff_number", 654321 + }, + { + "origin_country", "US" + } + }; + } + } + + public static Dictionary BasicCustomsInfo + { + get + { + return new Dictionary + { + { + "eel_pfc", "NOEEI 30.37(a)" + }, + { + "customs_certify", true + }, + { + "customs_signer", "Dr. Steve Brule" + }, + { + "contents_type", "merchandise" + }, + { + "contents_explanation", "" + }, + { + "restriction_type", "none" + }, + { + "non_delivery_option", "return" + }, + { + "customs_items", new List + { + BasicCustomsItem + } + } + }; + } + } + + public static Dictionary BasicCarrierAccount + { + get + { + return new Dictionary + { + { + "type", "UpsAccount" + }, + { + "credentials", new Dictionary + { + { + "account_number", "A1A1A1" + }, + { + "user_id", "USERID" + }, + { + "password", "PASSWORD" + }, + { + "access_license_number", "ALN" + } + } + } + }; + } + } + + public static Dictionary TaxIdentifier + { + get + { + return new Dictionary + { + { + "entity", "SENDER" + }, + { + "tax_id_type", "IOSS" + }, + { + "tax_id", "12345" + }, + { + "issuing_country", "GB" + } + }; + } + } + + public static Dictionary BasicShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + } + }; + } + } + + public static Dictionary FullShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + }, + { + "customs_info", BasicCustomsInfo + }, + { + "options", new Dictionary + { + { + "label_format", "PNG" // Must be PNG so we can convert to ZPL later + }, + { + "invoice_number", "123" + } + } + }, + { + "reference", "123" + } + }; + } + } + + public static Dictionary OneCallBuyShipment + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "parcel", BasicParcel + }, + { + "service", UspsService + }, + { + "carrier_accounts", new List + { + UspsCarrierAccountId + } + }, + { + "carrier", Usps + } + }; + } + } + + public static Dictionary BasicInsurance + { + get + { + Shipment shipment = Shipment.Create(OneCallBuyShipment); + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "tracking_code", shipment.tracking_code + }, + { + "carrier", Usps + }, + { + "amount", 100 + } + }; + } + } + + // This fixture will require you to add a `shipment` key with a Shipment object from a test. + // If you need to re-record cassettes, simply iterate the dates below and ensure they're one day in the future, + // USPS only does "next-day" pickups including Saturday but not Sunday or Holidays. + public static Dictionary BasicPickup + { + get + { + return new Dictionary + { + { + "address", BasicAddress + }, + { + "min_datetime", (DateTime.Today.Date + TimeSpan.FromDays(1)).ToString("yyyy-MM-dd") + }, + { + "max_datetime", (DateTime.Today.Date + TimeSpan.FromDays(2)).ToString("yyyy-MM-dd") + }, + { + "instructions", "Pickup at front door" + } + }; + } + } + + public static Dictionary BasicOrder + { + get + { + return new Dictionary + { + { + "to_address", BasicAddress + }, + { + "from_address", BasicAddress + }, + { + "shipments", new List> + { + BasicShipment + } + } + }; + } + } + } +} diff --git a/EasyPost.Tests.NetFramework/InsuranceTest.cs b/EasyPost.Tests.NetFramework/InsuranceTest.cs index 3948fb363..2f56c7ca6 100644 --- a/EasyPost.Tests.NetFramework/InsuranceTest.cs +++ b/EasyPost.Tests.NetFramework/InsuranceTest.cs @@ -1,145 +1,62 @@ +using System; using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class InsuranceTest { - private Dictionary FromAddressData { get; set; } - private Dictionary ParcelData { get; set; } - private Dictionary ToAddressData { get; set; } - private Dictionary InsuranceData { get; set; } - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - FromAddressData = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend St" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "zip", "94107" - }, - { - "country", "US" - } - }; - ToAddressData = new Dictionary() - { - { - "company", "The White House" - }, - { - "street1", "1600 Pennsylvania Avenue NW" - }, - { - "street2", "DC 20500" - }, - { - "city", "Washington" - }, - { - "state", "DC" - }, - { - "zip", "20500" - }, - { - "country", "US" - } - }; - ParcelData = new Dictionary - { - { - "weight", 8.0 - } - }; + TestSuite.SetUp(TestSuiteApiKey.Test); + } - Shipment shipment = Shipment.Create(new Dictionary - { - { - "from_address", FromAddressData - }, - { - "to_address", ToAddressData - }, - { - "parcel", ParcelData - }, - { - "service", "First" - }, - { - "carrier_accounts", new List - { - { - "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - } - } - }); + private static Insurance CreateBasicInsurance() + { + return Insurance.Create(Fixture.BasicInsurance); + } - InsuranceData = new Dictionary - { - { - "to_address", ToAddressData - }, - { - "from_address", FromAddressData - }, - { - "tracking_code", shipment.tracking_code - }, - { - "amount", "100.00" - }, - { - "carrier", "USPS" - } - }; + [TestMethod] + public void TestCreate() + { + Insurance insurance = CreateBasicInsurance(); + + Assert.IsInstanceOfType(insurance, typeof(Insurance)); + Assert.IsTrue(insurance.id.StartsWith("ins_")); + // TODO: amount really should be a number, not a string + Assert.AreEqual("100.00000", insurance.amount); } [TestMethod] - public void TestCreateAndRetrieve() + public void TestRetrieve() { - Insurance insurance = Insurance.Create(InsuranceData); - Assert.IsNotNull(insurance.id); - Assert.AreEqual("SAN FRANCISCO", insurance.from_address.city); + Insurance insurance = CreateBasicInsurance(); - Insurance retrieved = Insurance.Retrieve(insurance.id); - Assert.AreEqual(insurance.id, retrieved.id); + Insurance retrievedInsurance = Insurance.Retrieve(insurance.id); + Assert.IsInstanceOfType(retrievedInsurance, typeof(Insurance)); + Assert.AreEqual(insurance.id, retrievedInsurance.id); } [TestMethod] - public void TestRetrieveAll() + public void TestAll() { - InsuranceCollection insuranceCollection = Insurance.All(); - Assert.IsNotNull(insuranceCollection); - foreach (var insurance in insuranceCollection.insurances) + InsuranceCollection insuranceCollection = Insurance.All(new Dictionary { - Assert.IsNotNull(insurance.id); - Assert.AreEqual(insurance.id.Substring(0, 4), "ins_"); + { + "page_size", Fixture.PageSize + } + }); + + List insurances = insuranceCollection.insurances; + + Assert.IsTrue(insurances.Count <= Fixture.PageSize); + Assert.IsNotNull(insuranceCollection.has_more); + foreach (var item in insurances) + { + Assert.IsInstanceOfType(item, typeof(Insurance)); } } - - [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestRetrieveInvalidId() => Insurance.Retrieve("not-an-id"); } } diff --git a/EasyPost.Tests.NetFramework/OrderTest.cs b/EasyPost.Tests.NetFramework/OrderTest.cs index e565fe9ee..f2a26a1cd 100644 --- a/EasyPost.Tests.NetFramework/OrderTest.cs +++ b/EasyPost.Tests.NetFramework/OrderTest.cs @@ -1,211 +1,74 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class OrderTest { - private Dictionary parameters, toAddress, fromAddress; - private List> shipments; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - shipments = new List> - { - new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 18 - } - } - } - }, - new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 9 - }, - { - "width", 5 - }, - { - "height", 4 - }, - { - "weight", 18 - } - } - } - } - }; - - parameters = new Dictionary - { - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "OrderRef" - }, - { - "shipments", shipments - } - }; + TestSuite.SetUp(TestSuiteApiKey.Test); } - // [TestMethod] - // public void TestCreateFromInstance() { - // Order order = new Order() { - // to_address = Address.Create(toAddress), - // from_address = Address.Create(fromAddress), - // reference = "OrderRef", - // shipments = shipments.Select(shipment => Shipment.Create(shipment)).ToList(), - // carrier_accounts = new List() { new CarrierAccount() { id = "ca_7642d249fdcf47bcb5da9ea34c96dfcf" } } - // }; - - // order.Create(); - - // Assert.IsNotNull(order.id); - // Assert.AreEqual(order.reference, "OrderRef"); - // CollectionAssert.AreEqual( - // new List() { "ca_7642d249fdcf47bcb5da9ea34c96dfcf" }, - // new HashSet(order.shipments.SelectMany(s => s.rates).Select(r => r.carrier_account_id)).ToList() - // ); - // } + private static Order CreateBasicOrder() + { + return Order.Create(Fixture.BasicOrder); + } [TestMethod] - public void TestBuyOrder() + public void TestCreate() { - Order order = Order.Create(parameters); - order.Buy("USPS", "Priority"); + Order order = CreateBasicOrder(); - Assert.IsNotNull(order.shipments[0].postage_label); + Assert.IsInstanceOfType(order, typeof(Order)); + Assert.IsTrue(order.id.StartsWith("order_")); + Assert.IsNotNull(order.rates); } [TestMethod] - public void TestCreateAndRetrieveOrder() + public void TestRetrieve() { - Order order = Order.Create(parameters); + Order order = CreateBasicOrder(); - Assert.IsNotNull(order.id); - Assert.AreEqual(order.reference, "OrderRef"); - Order retrieved = Order.Retrieve(order.id); - Assert.AreEqual(order.id, retrieved.id); - } + Order retrievedOrder = Order.Retrieve(order.id); - [TestMethod] - [ExpectedException(typeof(ResourceAlreadyCreated))] - public void TestCreateOrderWithId() - { - Order order = new Order - { - id = "order_asjhd" - }; - order.Create(); + Assert.IsInstanceOfType(retrievedOrder, typeof(Order)); + Assert.AreEqual(order.id, retrievedOrder.id); } - [TestMethod] - [ExpectedException(typeof(HttpException))] - public void TestFailure() => Order.Create(new Dictionary()); - [TestMethod] public void TestGetRates() { - Order order = Order.Create(parameters); - List old = order.rates; + Order order = CreateBasicOrder(); + order.GetRates(); - Assert.AreNotEqual(old, order.rates); + + List rates = order.rates; + + Assert.IsNotNull(rates); + foreach (var rate in rates) + { + Assert.IsInstanceOfType(rate, typeof(Rate)); + } } [TestMethod] - public void TestOrderCarrierAccounts() + public void TestBuy() { - Dictionary carrierAccounts = - new Dictionary - { - { - "id", "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - }; - parameters.Add("carrier_accounts", carrierAccounts); - Order order = Order.Create(parameters); - - parameters.Remove("carrier_accounts"); - Order largeOrder = Order.Create(parameters); - - Assert.IsTrue(order.rates.Count < largeOrder.rates.Count); + Order order = CreateBasicOrder(); + + order.Buy(Fixture.Usps, Fixture.UspsService); + + List shipments = order.shipments; + + foreach (var shipment in shipments) + { + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsNotNull(shipment.postage_label); + } } } } diff --git a/EasyPost.Tests.NetFramework/ParcelTest.cs b/EasyPost.Tests.NetFramework/ParcelTest.cs index c83806240..6a07686c5 100644 --- a/EasyPost.Tests.NetFramework/ParcelTest.cs +++ b/EasyPost.Tests.NetFramework/ParcelTest.cs @@ -1,45 +1,40 @@ -using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class ParcelTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + + private static Parcel CreateBasicParcel() + { + return Parcel.Create(Fixture.BasicParcel); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreate() { - Parcel parcel = Parcel.Create(new Dictionary - { - { - "length", 10 - }, - { - "width", 20 - }, - { - "height", 5 - }, - { - "weight", 1.8 - } - }); - Parcel retrieved = Parcel.Retrieve(parcel.id); - Assert.AreEqual(parcel.id, retrieved.id); + Parcel parcel = CreateBasicParcel(); + + Assert.IsInstanceOfType(parcel, typeof(Parcel)); + Assert.IsTrue(parcel.id.StartsWith("prcl_")); + Assert.AreEqual(15.4, parcel.weight); } - // [TestMethod] - // public void TestPredefinedPackage() { - // Parcel parcel = new Parcel() { weight = 1.8, predefined_package = "SMALLFLATRATEBOX" }; - // Shipment shipment = new Shipment() { parcel = parcel }; - // shipment.Create(); + [TestMethod] + public void TestRetrieve() + { + Parcel parcel = CreateBasicParcel(); - // Assert.AreEqual(null, shipment.parcel.height); - // Assert.AreEqual("SMALLFLATRATEBOX", shipment.parcel.predefined_package); - // } + Parcel retrievedParcel = Parcel.Retrieve(parcel.id); + + Assert.IsInstanceOfType(retrievedParcel, typeof(Parcel)); + Assert.AreEqual(parcel.id, retrievedParcel.id); + } } } diff --git a/EasyPost.Tests.NetFramework/PickupTest.cs b/EasyPost.Tests.NetFramework/PickupTest.cs index 884c7c864..36a44cfaf 100644 --- a/EasyPost.Tests.NetFramework/PickupTest.cs +++ b/EasyPost.Tests.NetFramework/PickupTest.cs @@ -1,160 +1,73 @@ -using System; -using System.Collections.Generic; - +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class PickupTest { - private Address address; - private Dictionary parameters, parcel, toAddress, fromAddress; - private Shipment shipment; - [TestInitialize] public void Initialize() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + TestSuite.SetUp(TestSuiteApiKey.Test); + } - address = new Address - { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107", - phone = "1234567890" - }; + private static Pickup CreateBasicPickup() + { + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + Dictionary pickupData = Fixture.BasicPickup; + pickupData["shipment"] = shipment; + return Pickup.Create(pickupData); + } - parcel = new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - }; - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - shipment = Shipment.Create(new Dictionary - { - { - "parcel", parcel - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - } - }); - shipment.Buy(shipment.LowestRate()); + [TestMethod] + public void TestCreate() + { + Pickup pickup = CreateBasicPickup(); - parameters = new Dictionary - { - { - "is_account_address", false - }, - { - "instructions", "In mailbox." - }, - { - "address", address - }, - { - "shipment", shipment - }, - { - "min_datetime", DateTime.Now.AddDays(1) - }, - { - "max_datetime", DateTime.Now.AddDays(1) - } - }; + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.IsNotNull(pickup.pickup_rates); } [TestMethod] - public void TestBuyAndCancel() + public void TestRetrieve() { - Pickup pickup = Pickup.Create(parameters); + Pickup pickup = CreateBasicPickup(); - pickup.Buy(pickup.pickup_rates[0].carrier, pickup.pickup_rates[0].service); - Assert.IsNotNull(pickup.confirmation); + Pickup retrievedPickup = Pickup.Retrieve(pickup.id); - // XXX: This isn't working. - //pickup.Cancel(); - //Assert.AreEqual(pickup.status, "canceled"); + Assert.IsInstanceOfType(retrievedPickup, typeof(Pickup)); + Assert.AreEqual(pickup.id, retrievedPickup.id); } [TestMethod] - public void TestCreateAndRetrieve() + public void TestBuy() { - Pickup pickup = Pickup.Create(parameters); + //use "TestCreate" + Pickup pickup = CreateBasicPickup(); + + pickup.Buy(Fixture.Usps, Fixture.NextDayService); + + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.IsNotNull(pickup.confirmation); + Assert.AreEqual("scheduled", pickup.status); + } + + [TestMethod] + public void TestCancel() + { + //use "TestCreate" + Pickup pickup = CreateBasicPickup(); + + pickup.Buy(Fixture.Usps, Fixture.NextDayService); - Assert.IsNotNull(pickup.id); - Assert.AreEqual(pickup.address.street1, "164 Townsend Street"); + pickup.Cancel(); - Pickup retrieved = Pickup.Retrieve(pickup.id); - Assert.AreEqual(pickup.id, retrieved.id); + Assert.IsInstanceOfType(pickup, typeof(Pickup)); + Assert.IsTrue(pickup.id.StartsWith("pickup_")); + Assert.AreEqual("canceled", pickup.status); } } } diff --git a/EasyPost.Tests.NetFramework/RateTest.cs b/EasyPost.Tests.NetFramework/RateTest.cs index 509a8dbc6..44eb732e6 100644 --- a/EasyPost.Tests.NetFramework/RateTest.cs +++ b/EasyPost.Tests.NetFramework/RateTest.cs @@ -1,104 +1,26 @@ -using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class RateTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } [TestMethod] public void TestRetrieve() { - Dictionary fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - Dictionary toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - Shipment shipment = Shipment.Create(new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - } - }); + Shipment shipment = Shipment.Create(Fixture.BasicShipment); - shipment.GetRates(); Rate rate = Rate.Retrieve(shipment.rates[0].id); - Assert.AreEqual(rate.id, shipment.rates[0].id); - Assert.IsNotNull(rate.rate); - Assert.IsNotNull(rate.currency); - Assert.IsNotNull(rate.list_rate); - Assert.IsNotNull(rate.list_currency); + Assert.IsInstanceOfType(rate, typeof(Rate)); + Assert.IsTrue(rate.id.StartsWith("rate_")); + Assert.AreEqual(shipment.rates[0].id, rate.id); } } } diff --git a/EasyPost.Tests.NetFramework/RefundTest.cs b/EasyPost.Tests.NetFramework/RefundTest.cs new file mode 100644 index 000000000..488ac6e43 --- /dev/null +++ b/EasyPost.Tests.NetFramework/RefundTest.cs @@ -0,0 +1,16 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace EasyPost.Tests.NetFramework +{ + [TestClass] + public class RefundTest + { + // TODO: C# does not have a Refund class + + [TestInitialize] + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + } +} diff --git a/EasyPost.Tests.NetFramework/ReportTest.cs b/EasyPost.Tests.NetFramework/ReportTest.cs index f6754a0ba..f5f2446a9 100644 --- a/EasyPost.Tests.NetFramework/ReportTest.cs +++ b/EasyPost.Tests.NetFramework/ReportTest.cs @@ -1,27 +1,108 @@ -using System.Collections.Generic; - +using System; +using System.Collections.Generic; using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class ReportTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + + private static Report CreateBasicReport(string reportType) + { + return Report.Create(reportType, new Dictionary + { + { + "start_date", Fixture.ReportStartDate + }, + { + "end_date", Fixture.ReportEndDate + } + }); + } + + private static void TestCreateReport(string cassetteName, string reportType, string idPrefix) + { + Report report = CreateBasicReport(reportType); + + Assert.IsInstanceOfType(report, typeof(Report)); + Assert.IsTrue(report.id.StartsWith(idPrefix)); + } + + private static void TestRetrieveReport(string cassetteName, string reportType) + { + Report report = CreateBasicReport(reportType); + + Report retrievedReport = Report.Retrieve(report.id); + + Assert.IsInstanceOfType(report, typeof(Report)); + Assert.AreEqual(report.start_date, retrievedReport.start_date); + Assert.AreEqual(report.end_date, retrievedReport.end_date); + } + + [TestMethod] + public void TestCreatePaymentLogReport() + { + TestCreateReport("create_payment_log_report", "payment_log", "plrep_"); + } + + [TestMethod] + public void TestCreateRefundReport() + { + TestCreateReport("create_refund_report", "refund", "refrep_"); + } + + [TestMethod] + public void TestCreateShipmentReport() + { + TestCreateReport("create_shipment_report", "shipment", "shprep_"); + } [TestMethod] - public void TestCreateAndRetrieve() + public void TestCreateShipmentInvoiceReport() { - Dictionary parameters = new Dictionary(); - Report report = Report.Create("shipment", parameters); - Assert.IsNotNull(report.id); + TestCreateReport("create_shipment_invoice_report", "shipment_invoice", "shpinvrep_"); + } + + [TestMethod] + public void TestCreateTrackerReport() + { + TestCreateReport("create_tracker_report", "tracker", "trkrep_"); + } + + [TestMethod] + public void TestRetrievePaymentLogReport() + { + TestRetrieveReport("retrieve_payment_log_report", "payment_log"); + } + + [TestMethod] + public void TestRetrieveRefundReport() + { + TestRetrieveReport("retrieve_refund_report", "refund"); + } + + [TestMethod] + public void TestRetrieveShipmentReport() + { + TestRetrieveReport("retrieve_shipment_report", "shipment"); + } - Report retrieved = Report.Retrieve("shipment", report.id); - Assert.AreEqual(report.id, retrieved.id); + [TestMethod] + public void TestRetrieveShipmentInvoiceReport() + { + TestRetrieveReport("retrieve_shipment_invoice_report", "shipment_invoice"); + } - retrieved = Report.Retrieve(report.id); - Assert.AreEqual(report.id, retrieved.id); + [TestMethod] + public void TestRetrieveTrackerReport() + { + TestRetrieveReport("retrieve_tracker_report", "tracker"); } [TestMethod] @@ -30,13 +111,30 @@ public void TestAll() ReportList reportList = Report.All("shipment", new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } }); - Assert.AreNotEqual(0, reportList.reports.Count); - ReportList nextReportList = reportList.Next(); - Assert.AreNotEqual(reportList.reports[0].id, nextReportList.reports[0].id); + List reports = reportList.reports; + + Assert.IsTrue(reports.Count <= Fixture.PageSize); + Assert.IsNotNull(reportList.has_more); + foreach (var report in reports) + { + Assert.IsInstanceOfType(report, typeof(Report)); + } + } + + [TestMethod] + public void TestCreateNoType() + { + Assert.ThrowsException(() => Report.Create("")); + } + + [TestMethod] + public void TestAllNoType() + { + Assert.ThrowsException(() => Report.All("")); } } } diff --git a/EasyPost.Tests.NetFramework/RequestTest.cs b/EasyPost.Tests.NetFramework/RequestTest.cs deleted file mode 100644 index ba2c70902..000000000 --- a/EasyPost.Tests.NetFramework/RequestTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using RestSharp; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class RequestTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); - - [TestMethod] - public void TestAddBody() - { - Request request = new Request("resource"); - request.AddBody(new Dictionary - { - { - "foo", "bar" - } - }); - - RestRequest restRequest = (RestRequest)request; - CollectionAssert.Contains(restRequest.Parameters.Select(parameter => parameter.ToString()).ToList(), - "application/json={\"foo\":\"bar\"}"); - } - - [TestMethod] - public void TestCastToRestRequest() - { - RestRequest request = (RestRequest)new Request("resource"); - } - - // [TestMethod] - // public void TestRestRequest() { - // Request request = new Request("resource"); - // Assert.IsInstanceOfType(request.restRequest, typeof(RestRequest)); - // } - - [TestMethod] - public void TestRootElement() - { - Request request = new Request("resource"); - request.RootElement = "root"; - Assert.AreEqual(request.RootElement, "root"); - } - } -} diff --git a/EasyPost.Tests.NetFramework/ResourceTest.cs b/EasyPost.Tests.NetFramework/ResourceTest.cs deleted file mode 100644 index 16876b95a..000000000 --- a/EasyPost.Tests.NetFramework/ResourceTest.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System.Collections.Generic; - -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Newtonsoft.Json; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class ResourceTest - { - private class Inner : Resource - { - public string qux { get; set; } - } - - private class Data : Resource - { - public int bar { get; set; } - public List baz { get; set; } - public string foo { get; set; } - } - - [TestClass] - public class ResourceExtenstionTest - { - private Data dest, source; - - [TestInitialize] - public void Initialize() - { - dest = new Data - { - foo = "foo", - bar = 10, - baz = new List - { - new Inner - { - qux = "qux" - } - } - }; - source = new Data - { - foo = "oof", - bar = 42, - baz = new List - { - new Inner - { - qux = "xuq" - } - } - }; - } - - [TestMethod] - public void TestAsDictionary() - { - Dictionary dictionary = source.AsDictionary(); - - Assert.AreEqual(dictionary["foo"], "oof"); - Assert.AreEqual(dictionary["bar"], 42); - Assert.AreEqual(((List>)dictionary["baz"])[0]["qux"], "xuq"); - } - - [TestMethod] - public void TestLoad() - { - Assert.AreEqual(Resource.Load(JsonConvert.SerializeObject(source.AsDictionary())).foo, "oof"); - Assert.AreEqual(Resource.Load(JsonConvert.SerializeObject(source.AsDictionary())).baz[0].qux, - "xuq"); - Assert.AreEqual(Resource.LoadFromDictionary(source.AsDictionary()).foo, "oof"); - Assert.AreEqual(Resource.LoadFromDictionary(source.AsDictionary()).baz[0].qux, "xuq"); - } - - [TestMethod] - public void TestMerge() - { - dest.Merge(source); - - Assert.AreEqual(dest.foo, source.foo); - Assert.AreEqual(dest.bar, source.bar); - Assert.AreEqual(dest.baz[0].qux, source.baz[0].qux); - } - } - } -} diff --git a/EasyPost.Tests.NetFramework/ScanFormTest.cs b/EasyPost.Tests.NetFramework/ScanFormTest.cs index 6dfe2c8f8..5542fb2e1 100644 --- a/EasyPost.Tests.NetFramework/ScanFormTest.cs +++ b/EasyPost.Tests.NetFramework/ScanFormTest.cs @@ -1,36 +1,64 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class ScanFormTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } + + private static ScanForm GetBasicScanForm() + { + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + return ScanForm.Create(new List + { + shipment + }); + } [TestMethod] - public void TestScanFormCreateAndRetrieve() + public void TestCreate() { - ScanForm scanForm = ScanForm.Retrieve("sf_e35ae7fc59bb4482ae32efc663267104"); - Assert.AreEqual("sf_e35ae7fc59bb4482ae32efc663267104", scanForm.id); + ScanForm scanForm = GetBasicScanForm(); + + Assert.IsInstanceOfType(scanForm, typeof(ScanForm)); + Assert.IsTrue(scanForm.id.StartsWith("sf_")); } [TestMethod] - public void TestScanFormList() + public void TestRetrieve() { - Dictionary dict = new Dictionary + ScanForm scanForm = GetBasicScanForm(); + + ScanForm retrievedScanForm = ScanForm.Retrieve(scanForm.id); + + Assert.IsInstanceOfType(retrievedScanForm, typeof(ScanForm)); + Assert.AreEqual(scanForm.id, retrievedScanForm.id); + } + + [TestMethod] + public void TestAll() + { + ScanFormList scanFormList = ScanForm.All(new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } - }; - ScanFormList scanFormList = ScanForm.All(dict); - Assert.AreNotEqual(null, scanFormList.scan_forms[0].batch_id); - Assert.AreNotEqual(0, scanFormList.scan_forms.Count); - ScanFormList nextScanFormList = scanFormList.Next(); - Assert.AreNotEqual(scanFormList.scan_forms[0].id, nextScanFormList.scan_forms[0].id); + }); + + List scanForms = scanFormList.scan_forms; + + Assert.IsTrue(scanForms.Count <= Fixture.PageSize); + Assert.IsNotNull(scanFormList.has_more); + foreach (var scanForm in scanForms) + { + Assert.IsInstanceOfType(scanForm, typeof(ScanForm)); + } } } } diff --git a/EasyPost.Tests.NetFramework/SecurityTest.cs b/EasyPost.Tests.NetFramework/SecurityTest.cs deleted file mode 100644 index 69c2b4944..000000000 --- a/EasyPost.Tests.NetFramework/SecurityTest.cs +++ /dev/null @@ -1,14 +0,0 @@ -// using System.Net; -// using Microsoft.VisualStudio.TestTools.UnitTesting; - -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class SecurityTest { -// [TestMethod] -// public void TestGetProtocol() { -// Assert.AreEqual(Security.GetProtocol(), SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12); -// } -// } -// } - - diff --git a/EasyPost.Tests.NetFramework/ShipmentTest.cs b/EasyPost.Tests.NetFramework/ShipmentTest.cs index 81d634b14..b83bf4af9 100644 --- a/EasyPost.Tests.NetFramework/ShipmentTest.cs +++ b/EasyPost.Tests.NetFramework/ShipmentTest.cs @@ -1,600 +1,180 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class ShipmentTest { - private Dictionary parameters, options, toAddress, fromAddress; - - //Smart rate - [TestMethod] - public void ApiCallIsNotNull() + [TestInitialize] + public void Initialize() { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - Assert.IsNotNull(smartrateResult); + TestSuite.SetUp(TestSuiteApiKey.Test); } - [TestInitialize] - public void Initialize() + [TestMethod] + public void TestCreate() { - ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + Shipment shipment = Shipment.Create(Fixture.FullShipment); - toAddress = new Dictionary - { - { - "company", "Simpler Postage Inc" - }, - { - "street1", "164 Townsend Street" - }, - { - "street2", "Unit 1" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94107" - } - }; - fromAddress = new Dictionary - { - { - "name", "Andrew Tribone" - }, - { - "street1", "480 Fell St" - }, - { - "street2", "#3" - }, - { - "city", "San Francisco" - }, - { - "state", "CA" - }, - { - "country", "US" - }, - { - "zip", "94102" - } - }; - options = new Dictionary(); - parameters = new Dictionary - { - { - "parcel", new Dictionary - { - { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 - } - } - }, - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "reference", "ShipmentRef" - }, - { - "options", options - } - }; + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.IsNotNull(shipment.rates); + Assert.AreEqual("PNG", shipment.options.label_format); + Assert.AreEqual("123", shipment.options.invoice_number); + Assert.AreEqual("123", shipment.reference); } [TestMethod] - public void TestBuyWithInsurance() + public void TestRetrieve() { - Shipment shipment = Shipment.Create(parameters); - shipment.GetRates(); - shipment.Buy(shipment.rates.First(), "100.00"); + Shipment shipment = Shipment.Create(Fixture.FullShipment); + + Shipment retrievedShipment = Shipment.Retrieve(shipment.id); - Assert.AreEqual(shipment.insurance, "100.00"); + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.AreEqual(shipment.id, retrievedShipment.id); } [TestMethod] - public void TestCarrierAccounts() + public void TestAll() { - Address to = Address.Create(toAddress); - Address from = Address.Create(fromAddress); - Parcel parcel = Parcel.Create(new Dictionary + ShipmentList shipmentList = Shipment.All(new Dictionary { { - "length", 8 - }, - { - "width", 6 - }, - { - "height", 5 - }, - { - "weight", 10 + "page_size", Fixture.PageSize } }); - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = new CustomsInfo - { - customs_certify = "TRUE", - eel_pfc = "NOEEI 30.37(a)", - customs_items = new List - { - item - } - }; - - Shipment shipment = new Shipment - { - to_address = to, - from_address = from, - parcel = parcel, - carrier_accounts = new List - { - new CarrierAccount - { - id = "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - } - } - }; - shipment.Create(); - if (shipment.rates.Count > 0) - { - Assert.IsTrue(shipment.rates.TrueForAll(r => - r.carrier_account_id == "ca_7642d249fdcf47bcb5da9ea34c96dfcf")); - } - } + List shipments = shipmentList.shipments; - [TestMethod] - public void TestCarrierAccountsString() - { - parameters["carrier_accounts"] = new List + Assert.IsTrue(shipments.Count <= Fixture.PageSize); + Assert.IsNotNull(shipmentList.has_more); + foreach (var shipment in shipments) { - "ca_7642d249fdcf47bcb5da9ea34c96dfcf" - }; - Shipment shipment = Shipment.Create(parameters); - - foreach (Rate rate in shipment.rates) - { - Assert.AreEqual("ca_7642d249fdcf47bcb5da9ea34c96dfcf", rate.carrier_account_id); + Assert.IsInstanceOfType(shipment, typeof(Shipment)); } } [TestMethod] - public void TestCreateAndBuyPlusInsurance() - { - Shipment shipment = Shipment.Create(parameters); - Assert.IsNotNull(shipment.rates); - Assert.AreNotEqual(shipment.rates.Count, 0); - - shipment.Buy(shipment.rates[0]); - Assert.IsNotNull(shipment.postage_label); - Assert.AreNotEqual(shipment.fees.Count, 0); - CollectionAssert.AllItemsAreNotNull(shipment.fees.Select(f => f.type).ToList()); - - shipment.Insure(100.1); - Assert.AreNotEqual(shipment.insurance, 100.1); - } - - [TestMethod] - public void TestCreateAndRetrieve() + public void TestBuy() { - Shipment shipment = Shipment.Create(parameters); + Shipment shipment = Shipment.Create(Fixture.FullShipment); - Assert.IsNotNull(shipment.id); - Assert.AreEqual(shipment.reference, "ShipmentRef"); + shipment.Buy(shipment.LowestRate()); - Shipment retrieved = Shipment.Retrieve(shipment.id); - Assert.AreEqual(shipment.id, retrieved.id); - } - - [TestMethod] - [ExpectedException(typeof(ResourceAlreadyCreated))] - public void TestCreateWithId() - { - Shipment shipment = new Shipment - { - id = "shp_asdlf" - }; - shipment.Create(); - } - - [TestMethod] - public void TestCreateWithPreCreatedAttributes() - { - Shipment shipment = CreateShipmentResource(); - shipment.Create(); - Assert.IsNotNull(shipment.id); - } - - [TestMethod] - public void TestGenerateLabel() - { - Shipment shipment = BuyShipment(); - - shipment.GenerateLabel("pdf"); Assert.IsNotNull(shipment.postage_label); } [TestMethod] - public void TestGetRatesWithoutCreate() + public void TestRegenerateRates() { - Shipment shipment = CreateShipmentResource(); - shipment.GetRates(); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); - } - - [TestMethod] - public void TestRerateShipment() - { - Shipment shipment = CreateShipmentResource(); - shipment.Create(); - shipment.rates = new List(); - Assert.AreEqual(shipment.rates.Count, 0); - shipment.RegenerateRates(); - Assert.IsNotNull(shipment.rates); - Assert.AreNotEqual(shipment.rates.Count, 0); - } + Shipment shipment = Shipment.Create(Fixture.FullShipment); - [TestMethod] - public void TestRerateShipmentWithoutCreate() - { - Shipment shipment = CreateShipmentResource(); - Assert.IsNull(shipment.id); shipment.RegenerateRates(); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); - } - - [TestMethod] - public void TestGetSmartrates() - { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - //Make sure shipment id from smartrate is the same as the created one - Assert.AreEqual(shipment.rates[0].id, smartrateResult[0].id); - Assert.IsNotNull(shipment.rates); - } - [TestMethod] - public void TestInstanceOptions() - { - DateTime tomorrow = DateTime.SpecifyKind(DateTime.Now.AddDays(1), DateTimeKind.Utc); + List rates = shipment.rates; - Shipment shipment = CreateShipmentResource(); - shipment.options = new Options + Assert.IsNotNull(rates); + foreach (var rate in rates) { - label_date = tomorrow - }; - shipment.Create(); - - Assert.AreEqual(tomorrow.ToString("yyyy-MM-ddTHH:mm:ssZ"), - ((DateTime)shipment.options.label_date).ToString("yyyy-MM-ddTHH:mm:ssZ")); + Assert.IsInstanceOfType(rate, typeof(Rate)); + } } [TestMethod] - public void TestAll() + public void TestConvertLabel() { - ShipmentList shipmentList = Shipment.All(new Dictionary - { - { - "page_size", 1 - } - }); - Assert.AreNotEqual(0, shipmentList.shipments.Count); + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); + + shipment.GenerateLabel("ZPL"); - ShipmentList nextShipmentList = shipmentList.Next(); - Assert.AreNotEqual(shipmentList.shipments[0].id, nextShipmentList.shipments[0].id); + Assert.IsNotNull(shipment.postage_label.label_zpl_url); } + // If the shipment was purchased with a USPS rate, it must have had its insurance set to `0` when bought + // so that USPS doesn't automatically insure it so we could manually insure it here. [TestMethod] - public void TestLowestRate() + public void TestInsure() { - Rate lowestUSPS = new Rate - { - rate = "1.0", - carrier = "USPS", - service = "ParcelSelect" - }; - Rate highestUSPS = new Rate - { - rate = "10.0", - carrier = "USPS", - service = "Priority" - }; - Rate lowestUPS = new Rate - { - rate = "2.0", - carrier = "UPS", - service = "ParcelSelect" - }; - Rate highestUPS = new Rate - { - rate = "20.0", - carrier = "UPS", - service = "Priority" - }; + Dictionary shipmentData = Fixture.OneCallBuyShipment; + // Set to 0 so USPS doesn't insure this automatically and we can insure the shipment manually + shipmentData["insurance"] = 0; - Shipment shipment = - new Shipment - { - rates = new List - { - highestUSPS, - lowestUSPS, - highestUPS, - lowestUPS - } - }; - - Rate rate = shipment.LowestRate(); - Assert.AreEqual(rate, lowestUSPS); - - rate = shipment.LowestRate(new List - { - "UPS" - }); - Assert.AreEqual(rate, lowestUPS); + Shipment shipment = Shipment.Create(shipmentData); - rate = shipment.LowestRate(includeServices: new List - { - "Priority" - }); - Assert.AreEqual(rate, highestUSPS); + shipment.Insure(100); - rate = shipment.LowestRate(excludeCarriers: new List - { - "USPS" - }); - Assert.AreEqual(rate, lowestUPS); - - rate = shipment.LowestRate(excludeServices: new List - { - "ParcelSelect" - }); - Assert.AreEqual(rate, highestUSPS); - - rate = shipment.LowestRate(new List - { - "FedEx" - }); - Assert.IsNull(rate); + Assert.AreEqual("100.00", shipment.insurance); } + // Refunding a test shipment must happen within seconds of the shipment being created as test shipments naturally + // follow a flow of created -> delivered to cycle through tracking events in test mode - as such anything older + // than a few seconds in test mode may not be refundable. [TestMethod] - public void TestOptions() + public void TestRefund() { - string tomorrow = DateTime.Now.AddDays(1).ToString("yyyy-MM-ddTHH:mm:ssZ"); - options["label_date"] = tomorrow; - options["print_custom"] = new List> - { - new Dictionary - { - { - "value", "value" - }, - { - "name", "name" - }, - { - "barcode", true - } - } - }; - options["payment"] = new Dictionary - { - { - "type", "THIRD_PARTY" - }, - { - "account", "12345" - }, - { - "postal_code", "54321" - }, - { - "country", "US" - } - }; + Shipment shipment = Shipment.Create(Fixture.OneCallBuyShipment); - Shipment shipment = Shipment.Create(parameters); + shipment.Refund(); - Assert.AreEqual(((DateTime)shipment.options.label_date).ToString("yyyy-MM-ddTHH:mm:ssZ"), tomorrow); - Assert.AreEqual(shipment.options.print_custom[0]["value"], "value"); - Assert.AreEqual(shipment.options.print_custom[0]["name"], "name"); - Assert.AreEqual(shipment.options.print_custom[0]["barcode"], true); - Assert.AreEqual(shipment.options.payment["type"], "THIRD_PARTY"); - Assert.AreEqual(shipment.options.payment["account"], "12345"); - Assert.AreEqual(shipment.options.payment["postal_code"], "54321"); - Assert.AreEqual(shipment.options.payment["country"], "US"); + Assert.AreEqual("submitted", shipment.refund_status); } [TestMethod] - public void TestPostageInline() + public void TestSmartrate() { - options["postage_label_inline"] = true; - Shipment shipment = BuyShipment(); - Assert.IsNotNull(shipment.postage_label.label_file); - } + Shipment shipment = Shipment.Create(Fixture.BasicShipment); - [TestMethod] - public void TestRateErrorMessages() - { - parameters = new Dictionary - { - { - "to_address", toAddress - }, - { - "from_address", fromAddress - }, - { - "parcel", new Dictionary - { - { - "weight", 10 - }, - { - "predefined_package", "FEDEXBOX" - } - } - } - }; - Shipment shipment = Shipment.Create(parameters); + Assert.IsNotNull(shipment.rates); - Assert.IsNotNull(shipment.id); - Assert.AreEqual(shipment.messages[0].carrier, "USPS"); - Assert.AreEqual(shipment.messages[0].type, "rate_error"); - Assert.AreEqual(shipment.messages[0].message, - "Unable to retrieve USPS rates for another carrier's predefined_package parcel type."); + List smartRates = shipment.GetSmartrates(); + Smartrate smartrate = smartRates.First(); + Assert.AreEqual(shipment.rates[0].id, smartrate.id); + Assert.IsNotNull(smartrate.time_in_transit.percentile_50); + Assert.IsNotNull(smartrate.time_in_transit.percentile_75); + Assert.IsNotNull(smartrate.time_in_transit.percentile_85); + Assert.IsNotNull(smartrate.time_in_transit.percentile_90); + Assert.IsNotNull(smartrate.time_in_transit.percentile_95); + Assert.IsNotNull(smartrate.time_in_transit.percentile_97); + Assert.IsNotNull(smartrate.time_in_transit.percentile_99); } [TestMethod] - public void TestRefund() + public void TestCreateEmptyObjects() { - Shipment shipment = BuyShipment(); - shipment.Refund(); - Assert.IsNotNull(shipment.refund_status); - } + Dictionary shipmentData = Fixture.BasicShipment; - //Tax Identifiers - [TestMethod] - public void TestTaxIdentifiers() - { - parameters["tax_identifiers"] = new List - { - new TaxIdentifier - { - entity = "SENDER", - tax_id = "12345", - tax_id_type = "EORI", - issuing_country = "GB" - } - }; - Shipment shipment = Shipment.Create(parameters); - Assert.IsNotNull(shipment.id); - Assert.IsNotNull(shipment.rates); - TaxIdentifier taxIdentifier = shipment.tax_identifiers[0]; - Assert.AreEqual("SENDER", taxIdentifier.entity); - Assert.AreEqual("HIDDEN", taxIdentifier.tax_id); - Assert.AreEqual("EORI", taxIdentifier.tax_id_type); - Assert.AreEqual("GB", taxIdentifier.issuing_country); - - Shipment retrieved = Shipment.Retrieve(shipment.id); - - TaxIdentifier retrievedTaxIdentifier = retrieved.tax_identifiers[0]; - Assert.AreEqual("SENDER", retrievedTaxIdentifier.entity); - Assert.AreEqual("HIDDEN", retrievedTaxIdentifier.tax_id); - Assert.AreEqual("EORI", retrievedTaxIdentifier.tax_id_type); - Assert.AreEqual("GB", retrievedTaxIdentifier.issuing_country); - } + shipmentData.Add("customs_info", new Dictionary()); + (shipmentData["customs_info"] as Dictionary).Add("customs_items", new List()); + shipmentData["options"] = null; + shipmentData["tax_identifiers"] = null; + shipmentData["reference"] = ""; - //TODO: Once we have a library for recording and replaying HTTP, assert that the following values actually match an integer - [TestMethod] - public void TestTimeInTransitData() - { - Shipment shipment = Shipment.Create(parameters); - List smartrateResult = shipment.GetSmartrates(); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_50, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_75, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_85, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_90, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_95, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_97, typeof(int)); - Assert.IsInstanceOfType(smartrateResult[0].time_in_transit.percentile_99, typeof(int)); - } + Shipment shipment = Shipment.Create(shipmentData); - private Shipment BuyShipment() - { - Shipment shipment = Shipment.Create(parameters); - shipment.GetRates(); - shipment.Buy(shipment.rates.First()); - return shipment; + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.IsNotNull(shipment.options); // The EasyPost API populates some default values here + Assert.IsTrue(shipment.customs_info.customs_items.Count == 0); + Assert.IsNull(shipment.reference); } - private Shipment CreateShipmentResource() + [TestMethod] + public void TestCreateTaxIdentifiers() { - Address to = new Address + Dictionary shipmentData = Fixture.BasicShipment; + shipmentData["tax_identifiers"] = new List> { - company = "Simpler Postage Inc", - street1 = "164 Townsend Street", - street2 = "Unit 1", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94107" - }; - Address from = new Address - { - name = "Andrew Tribone", - street1 = "480 Fell St", - street2 = "#3", - city = "San Francisco", - state = "CA", - country = "US", - zip = "94102" - }; - Parcel parcel = new Parcel - { - length = 8, - width = 6, - height = 5, - weight = 10 - }; - CustomsItem item = new CustomsItem - { - description = "description", - quantity = 1 - }; - CustomsInfo info = new CustomsInfo - { - customs_certify = "TRUE", - eel_pfc = "NOEEI 30.37(a)", - customs_items = new List - { - item - } + Fixture.TaxIdentifier }; + Shipment shipment = Shipment.Create(shipmentData); - return new Shipment - { - to_address = to, - from_address = from, - parcel = parcel, - customs_info = info - }; + Assert.IsInstanceOfType(shipment, typeof(Shipment)); + Assert.IsTrue(shipment.id.StartsWith("shp_")); + Assert.AreEqual("IOSS", shipment.tax_identifiers[0].tax_id_type); } } } diff --git a/EasyPost.Tests.NetFramework/TestSuite.cs b/EasyPost.Tests.NetFramework/TestSuite.cs new file mode 100644 index 000000000..0e7f65323 --- /dev/null +++ b/EasyPost.Tests.NetFramework/TestSuite.cs @@ -0,0 +1,45 @@ +using System; +using System.Diagnostics; + +namespace EasyPost.Tests.NetFramework +{ + public enum TestSuiteApiKey + { + Test, + Production + } + + public static class TestSuite + { + private static string GetApiKey(TestSuiteApiKey apiKey) + { + string keyName = ""; + switch (apiKey) + { + case TestSuiteApiKey.Test: + keyName = "EASYPOST_TEST_API_KEY"; + break; + case TestSuiteApiKey.Production: + keyName = "EASYPOST_PROD_API_KEY"; + break; + } + + return Environment.GetEnvironmentVariable(keyName) ?? "couldnotpullapikey"; // if can't pull from environment, will use a fake key. Won't matter on replay. + } + + public static void SetUp(string apiKey) + { + ClientManager.SetCurrent(GetClientFunction(apiKey)); + } + + public static void SetUp(TestSuiteApiKey apiKey) + { + SetUp(GetApiKey(apiKey)); + } + + public static Func GetClientFunction(string apiKey) + { + return delegate { return new Client(new ClientConfiguration(apiKey)); }; + } + } +} diff --git a/EasyPost.Tests.NetFramework/TimeoutTest.cs b/EasyPost.Tests.NetFramework/TimeoutTest.cs deleted file mode 100644 index e14323af0..000000000 --- a/EasyPost.Tests.NetFramework/TimeoutTest.cs +++ /dev/null @@ -1,23 +0,0 @@ - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace EasyPost.Tests.Net -{ - [TestClass] - public class TimeoutTest - { - [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); - - [TestMethod] - public void TestTimeout() - { - Client client = new Client(new ClientConfiguration("apikey")); - client.ConnectTimeoutMilliseconds = 5000; - client.RequestTimeoutMilliseconds = 5000; - - Assert.AreEqual(5000, client.ConnectTimeoutMilliseconds); - Assert.AreEqual(5000, client.RequestTimeoutMilliseconds); - } - } -} diff --git a/EasyPost.Tests.NetFramework/TrackerTest.cs b/EasyPost.Tests.NetFramework/TrackerTest.cs index 2a1b1e165..9ea267016 100644 --- a/EasyPost.Tests.NetFramework/TrackerTest.cs +++ b/EasyPost.Tests.NetFramework/TrackerTest.cs @@ -1,55 +1,42 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class TrackerTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("NvBX2hFF44SVvTPtYjF0zQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } - [Ignore] - [TestMethod] - public void TestCreateAndRetrieve() + private static Tracker CreateBasicTracker() { - const string carrier = "USPS"; - const string trackingCode = "EZ1000000001"; + return Tracker.Create(Fixture.Usps, "EZ1000000001"); + } - Tracker tracker = Tracker.Create(carrier, trackingCode); - Assert.AreEqual(tracker.tracking_code, trackingCode); - Assert.IsNotNull(tracker.est_delivery_date); - Assert.IsNotNull(tracker.carrier); - Assert.IsNotNull(tracker.public_url); + [TestMethod] + public void TestCreate() + { + Tracker tracker = CreateBasicTracker(); - Assert.AreEqual(Tracker.Retrieve(tracker.id).id, tracker.id); + Assert.IsInstanceOfType(tracker, typeof(Tracker)); + Assert.IsTrue(tracker.id.StartsWith("trk_")); + Assert.AreEqual("pre_transit", tracker.status); } [TestMethod] - public void TestCreateTrackerList() + public void TestRetrieve() { - string[] trackingCodes = - { - "EZ1000000001", "EZ1000000002", "EZ1000000003" - }; - Dictionary trackers = new Dictionary(); + // Test trackers cycle through their "dummy" statuses automatically, the created and retrieved objects may differ + Tracker tracker = CreateBasicTracker(); - for (int i = 0; i < trackingCodes.Length; i++) - { - trackers.Add(i.ToString(), new Dictionary - { - { - "tracking_code", trackingCodes[i] - }, - { - "carrier", "USPS" - } - }); - } + Tracker retrievedTracker = Tracker.Retrieve(tracker.id); - bool response = Tracker.CreateList(trackers); - Assert.IsTrue(response); + Assert.IsInstanceOfType(retrievedTracker, typeof(Tracker)); + Assert.AreEqual(tracker.id, retrievedTracker.id); } [TestMethod] @@ -58,13 +45,53 @@ public void TestAll() TrackerList trackerList = Tracker.All(new Dictionary { { - "page_size", 1 + "page_size", Fixture.PageSize } }); - Assert.AreNotEqual(0, trackerList.trackers.Count); - TrackerList nextTrackerList = trackerList.Next(); - Assert.AreNotEqual(trackerList.trackers[0].id, nextTrackerList.trackers[0].id); + List trackers = trackerList.trackers; + + Assert.IsTrue(trackers.Count <= Fixture.PageSize); + Assert.IsNotNull(trackerList.has_more); + foreach (var tracker in trackers) + { + Assert.IsInstanceOfType(tracker, typeof(Tracker)); + } + } + + [TestMethod] + public void TestCreateList() + { + bool success = Tracker.CreateList(new Dictionary + { + { + "0", new Dictionary + { + { + "tracking_code", "EZ1000000001" + } + } + }, + { + "1", new Dictionary + { + { + "tracking_code", "EZ1000000002" + } + } + }, + { + "2", new Dictionary + { + { + "tracking_code", "EZ1000000003" + } + } + }, + }); + + // This endpoint returns nothing so we assert the function returns true + Assert.IsTrue(success); } } } diff --git a/EasyPost.Tests.NetFramework/UserTest.cs b/EasyPost.Tests.NetFramework/UserTest.cs index d152467e9..5d18bbfa6 100644 --- a/EasyPost.Tests.NetFramework/UserTest.cs +++ b/EasyPost.Tests.NetFramework/UserTest.cs @@ -1,79 +1,131 @@ using System.Collections.Generic; - using Microsoft.VisualStudio.TestTools.UnitTesting; -namespace EasyPost.Tests.Net +namespace EasyPost.Tests.NetFramework { [TestClass] public class UserTest { [TestInitialize] - public void Initialize() => ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Production); + } + + private static User RetrieveMe() + { + return User.RetrieveMe(); + } + + private static User CreateUser() + { + return User.Create(new Dictionary + { + { + "name", "Test User" + } + }); + } + + // This endpoint returns the child user keys in plain text, do not run this test. + [Ignore] + [TestMethod] + public void TestCreate() + { + User user = CreateUser(); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual("Test User", user.name); + } + + [TestMethod] + public void TestRetrieve() + { + User user = User.Retrieve(Fixture.ChildUserId); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual(Fixture.ChildUserId, user.id); + } + [TestMethod] public void TestRetrieveMe() { - User user = User.RetrieveMe(); - Assert.IsNotNull(user.id); + User user = RetrieveMe(); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + } + + [TestMethod] + public void TestUpdate() + { + User user = RetrieveMe(); + + string testPhone = "5555555555"; + + Dictionary userDict = new Dictionary + { + { + "phone_number", testPhone + } + }; + user.Update(userDict); + + Assert.IsInstanceOfType(user, typeof(User)); + Assert.IsTrue(user.id.StartsWith("user_")); + Assert.AreEqual(testPhone, user.phone_number); + } + + // Due to our inability to create child users securely, we must also skip deleting them as we cannot replace the deleted ones easily. + [Ignore] + [TestMethod] + public void TestDelete() + { + User user = CreateUser(); + + user.Destroy(); + } + + // API keys are returned as plaintext, do not run this test. + [Ignore] + [TestMethod] + public void TestAllApiKeys() + { + User user = RetrieveMe(); + + // TODO: User doesn't have a .all_api_keys() method + List apiKeys = user.api_keys; } + // API keys are returned as plaintext, do not run this test. + [Ignore] [TestMethod] - public void TestRetrieveSelf() + public void TestApiKeys() { - User user = User.Retrieve(); - Assert.IsNotNull(user.id); + User user = RetrieveMe(); - User user2 = User.Retrieve(user.id); - Assert.AreEqual(user.id, user2.id); + List apiKeys = user.api_keys; } [TestMethod] public void TestUpdateBrand() { - User user = User.Retrieve(); - Assert.IsNotNull(user.id); + User user = RetrieveMe(); - const string color = "#AA4A44"; - Dictionary details = new Dictionary() + string color = "#123456"; + Brand brand = user.UpdateBrand(new Dictionary { { "color", color } - }; - Brand brand = user.UpdateBrand(parameters: details); - Assert.IsNotNull(brand); - Assert.AreEqual(user.id, brand.user_id); + }); + + Assert.IsInstanceOfType(brand, typeof(Brand)); + // TODO: Brand doesn't have an ID Assert.AreEqual(color, brand.color); } - - // [TestMethod] - // public void TestCRUD() { - // try { - // User.Create(new Dictionary() { { "name", "foo" } }); - // Assert.Fail(); - // } catch (HttpException e) { - // Assert.AreEqual("USER.INVALID", e.Code); - // Assert.AreEqual("The user record was invalid and could not be saved.", e.Message); - // Assert.AreEqual(1, e.Errors.Count); - // Assert.AreEqual("name", e.Errors[0].field); - // Assert.AreEqual("First and last name required.", e.Errors[0].message); - // } - - // User user = User.Create(new Dictionary() { { "name", "Test Name" } }); - // Assert.AreEqual(user.api_keys.Count, 2); - // Assert.IsNotNull(user.id); - - // User other = User.Retrieve(user.id); - // Assert.AreEqual(user.id, other.id); - - // user.Update(new Dictionary() { { "name", "NewTest Name" } }); - // Assert.AreEqual("NewTest Name", user.name); - - // user.Destroy(); - // try { - // User.Retrieve(user.id); - // Assert.Fail(); - // } catch (HttpException) { } - // } } } diff --git a/EasyPost.Tests.NetFramework/WebhookTest.cs b/EasyPost.Tests.NetFramework/WebhookTest.cs index 9f81b7cf4..a122b87c2 100644 --- a/EasyPost.Tests.NetFramework/WebhookTest.cs +++ b/EasyPost.Tests.NetFramework/WebhookTest.cs @@ -1,33 +1,113 @@ // using System.Collections.Generic; // using System.Linq; // using Microsoft.VisualStudio.TestTools.UnitTesting; +// using EasyPost; -// namespace EasyPost.NetFramework.Tests { -// [TestClass] -// public class WebhookTest { -// [TestInitialize] -// public void Initialize() { -// ClientManager.SetCurrent("GxhY479LTioDWsGcEtSAfQ"); -// } +using System; +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; -// [TestMethod] -// public void TestCRUD() { -// Webhook webhook = Webhook.Create(new Dictionary() { { "url", "https://www.foobar.com" } }); -// Assert.AreEqual(webhook.url, "https://www.foobar.com"); +namespace EasyPost.Tests.NetFramework +{ + [TestClass] + public class WebhookTest + { + private string webhookId = null; -// webhook.Update(); + [TestInitialize] + public void Initialize() + { + TestSuite.SetUp(TestSuiteApiKey.Test); + } -// WebhookList webhooks = Webhook.All(); -// CollectionAssert.Contains(webhooks.Select(w => w.id).ToList(), webhook.id); + [TestCleanup] + public void Cleanup() + { + if (webhookId != null) + { + try + { + Webhook retrievedWebhook = Webhook.Retrieve(webhookId); + retrievedWebhook.Destroy(); + webhookId = null; + } + catch + { + } + } + } -// webhook.Destroy(); -// try { -// User.Retrieve(webhook.id); -// Assert.Fail(); -// } -// catch (HttpException) { } -// } -// } -// } + private static Webhook CreateBasicWebhook(string url) + { + return Webhook.Create(new Dictionary + { + { + "url", url + } + }); + } + [TestMethod] + public void TestCreate() + { + string url = "https://testcreate.com"; + Webhook webhook = CreateBasicWebhook(url); + + Assert.IsInstanceOfType(webhook, typeof(Webhook)); + Assert.IsTrue(webhook.id.StartsWith("hook_")); + Assert.AreEqual(url, webhook.url); + + webhookId = webhook.id; // trigger deletion + } + + [TestMethod] + public void TestRetrieve() + { + string url = "https://testretrieve.com"; + + + Webhook webhook = CreateBasicWebhook(url); + + Webhook retrievedWebhook = Webhook.Retrieve(webhook.id); + + Assert.IsInstanceOfType(retrievedWebhook, typeof(Webhook)); + Assert.AreEqual(webhook.id, retrievedWebhook.id); + + webhookId = webhook.id; // trigger deletion + } + + [TestMethod] + public void TestAll() + { + List webhooks = Webhook.All(); + + foreach (var item in webhooks) + { + Assert.IsInstanceOfType(item, typeof(Webhook)); + } + } + + // Cannot be easily tested - requires a disabled webhook + [Ignore] + [TestMethod] + public void TestUpdate() + { + } + + [TestMethod] + public void TestDelete() + { + string url = "https://testdelete.com"; + + + Webhook webhook = CreateBasicWebhook(url); + Webhook retrievedWebhook = Webhook.Retrieve(webhook.id); + + bool success = retrievedWebhook.Destroy(); + + // This endpoint/method does not return anything, just make sure the request doesn't fail + Assert.IsTrue(success); + } + } +} diff --git a/EasyPost.Tests.NetFramework35/EasyPost.Tests.NetFramework35.csproj b/EasyPost.Tests.NetFramework35/EasyPost.Tests.NetFramework35.csproj index af0609502..e75b4c738 100644 --- a/EasyPost.Tests.NetFramework35/EasyPost.Tests.NetFramework35.csproj +++ b/EasyPost.Tests.NetFramework35/EasyPost.Tests.NetFramework35.csproj @@ -8,7 +8,7 @@ AnyCPU - EasyPost.TestsNet + EasyPost.Tests.NetFramework35; @@ -35,39 +35,30 @@ AddressTest.cs - - ApiKeyTest.cs - BatchTest.cs CarrierAccountTest.cs - - CarrierTypeTest.cs - - - ClientConfigurationTest.cs - - - ClientManagerTest.cs - - - ClientTest.cs - CustomsInfoTest.cs CustomsItemTest.cs + + EasyPostTest.cs + ErrorTest.cs EventTest.cs + + Fixture.cs + InsuranceTest.cs @@ -83,26 +74,20 @@ RateTest.cs + + RefundTest.cs + ReportTest.cs - - RequestTest.cs - - - ResourceTest.cs - ScanFormTest.cs - - SecurityTest.cs - ShipmentTest.cs - - TimeoutTest.cs + + TestSuite.cs TrackerTest.cs diff --git a/EasyPost.sln b/EasyPost.sln index cdf8883f4..de45fcdb1 100644 --- a/EasyPost.sln +++ b/EasyPost.sln @@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyPost.Tests.Net50", "Eas EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EasyPost.Tests.Net60", "EasyPost.Tests.Net60\EasyPost.Tests.Net60.csproj", "{D7D73ECC-7DA6-4EDA-97AD-D9AAB29A4895}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Scotch", "Scotch\Scotch.csproj", "{0760BEC5-5629-4B1D-9B1F-BF84AC34D0F9}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,6 +53,10 @@ Global {D7D73ECC-7DA6-4EDA-97AD-D9AAB29A4895}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D7D73ECC-7DA6-4EDA-97AD-D9AAB29A4895}.Debug|Any CPU.Build.0 = Debug|Any CPU {D7D73ECC-7DA6-4EDA-97AD-D9AAB29A4895}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0760BEC5-5629-4B1D-9B1F-BF84AC34D0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0760BEC5-5629-4B1D-9B1F-BF84AC34D0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0760BEC5-5629-4B1D-9B1F-BF84AC34D0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0760BEC5-5629-4B1D-9B1F-BF84AC34D0F9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index 0b2a139f9..e243c9834 100644 --- a/README.md +++ b/README.md @@ -174,6 +174,14 @@ foreach (Form form in shipment.forms) { } ``` +### Testing + +All .NET/.NET Core versions of the library utilize a VCR tool (`Scotch`) to record and replay HTTP requests and responses via cassettes. These cassettes are used by our .NET/.NET Core unit tests; no live API calls are made once a cassette is recorded and the test is set to "replay" mode. + +The .NET Framework version of our library is incompatible with `Scotch`. As a result, live API calls are made during .NET Framework unit testing. + +Most unit tests can use a `Test` API key. Unit tests for `CarrierAccount` and `User` classes require `Production` API keys. + ### Warning about Threads NOTE: The EasyPost .NET client library (in particular, the `ClientManager` global object) is not threadsafe; do not attempt to perform requests from multiple threads in parallel. This can be particularly problematic if using multiple API keys; make sure to always use a Mutex, Monitor, or other synchronization method to ensure that concurrent requests do not enter the EasyPost library from different threads. diff --git a/Scotch/Cassette.cs b/Scotch/Cassette.cs new file mode 100644 index 000000000..005dca17a --- /dev/null +++ b/Scotch/Cassette.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace Scotch +{ + public static class Cassette + { + public static Object locker = new Object(); + + public static IEnumerable ReadCassette(string cassettePath) + { + if (!File.Exists(cassettePath)) + { + return new List(); + } + + var jsonString = File.ReadAllText(cassettePath); + var cassetteParseResult = JsonConvert.DeserializeObject>(jsonString, new VersionConverter()); + return cassetteParseResult; + } + + public static void WriteCassette(string cassettePath, IEnumerable httpInteraction) + { + var serializedInteraction = JsonConvert.SerializeObject(httpInteraction.ToList(), Formatting.Indented, new VersionConverter()); + File.WriteAllText(cassettePath, serializedInteraction.ToString()); + } + + public static void UpdateInteraction(string cassettePath, HttpInteraction httpInteraction) + { + lock (locker) + { + var existingInteractions = ReadCassette(cassettePath).ToList(); + var matchingIndex = existingInteractions.FindIndex(i => Helpers.RequestsMatch(httpInteraction.Request, i.Request)); + List newInteractions; + if (matchingIndex < 0) + { + newInteractions = existingInteractions.Append(httpInteraction).ToList(); + } + else + { + newInteractions = existingInteractions.ToList(); + newInteractions[matchingIndex] = httpInteraction; + } + + WriteCassette(cassettePath, newInteractions); + } + } + } +} diff --git a/Scotch/HttpInteraction.cs b/Scotch/HttpInteraction.cs new file mode 100644 index 000000000..fae231ee4 --- /dev/null +++ b/Scotch/HttpInteraction.cs @@ -0,0 +1,145 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Text; +using System.Threading.Tasks; + +namespace Scotch +{ + public class Request + { + public string Method { get; set; } + public string URI { get; set; } + public IDictionary RequestHeaders { get; set; } + public IDictionary ContentHeaders { get; set; } + public string Body { get; set; } + } + + public class Status + { + public HttpStatusCode Code { get; set; } + public string Message { get; set; } + } + + public class Response + { + public Status Status { get; set; } + public IDictionary ResponseHeaders { get; set; } + public IDictionary ContentHeaders { get; set; } + public string Body { get; set; } + + public Version HttpVersion { get; set; } + + public HttpResponseMessage ToHttpResponseMessage(HttpRequestMessage requestMessage) + { + var result = new HttpResponseMessage(Status.Code); + result.ReasonPhrase = Status.Message; + result.Version = HttpVersion; + foreach (var h in ResponseHeaders) + { + result.Headers.TryAddWithoutValidation(h.Key, h.Value.ToString()); + } + + var content = new ByteArrayContent(Encoding.UTF8.GetBytes(Body)); + foreach (var h in ContentHeaders) + { + content.Headers.TryAddWithoutValidation(h.Key, h.Value.ToString()); + } + + result.Content = content; + result.RequestMessage = requestMessage; + return result; + } + } + + public class HttpInteraction + { + public Request Request { get; set; } + public Response Response { get; set; } + public DateTimeOffset RecordedAt { get; set; } + } + + public static class Helpers + { + public static IDictionary ToHeaders(HttpHeaders headers, List headersToHide = null) + { + if (headersToHide == null) + { + headersToHide = new List(); + } + + IDictionary dict = new Dictionary(); + foreach (var h in headers) + { + if (headersToHide.Contains(h.Key)) + { + dict.Add(h.Key, "********"); + } + else + { + dict.Add(h.Key, string.Join(",", h.Value)); + } + } + + return dict; + } + + public static async Task ToStringAsync(HttpContent content) + { + if (content == null) + { + return ""; + } + + return await content.ReadAsStringAsync(); + } + + public static IDictionary ToContentHeaders(HttpContent content) + { + if (content == null) + { + return new Dictionary(); + } + + return ToHeaders(content.Headers); + } + + public static async Task ToRequestAsync(HttpRequestMessage request, List headersToHide = null) + { + var requestBody = await ToStringAsync(request.Content); + return new Request + { + Method = request.Method.ToString(), + URI = request.RequestUri.ToString(), + RequestHeaders = ToHeaders(request.Headers, headersToHide), + ContentHeaders = ToContentHeaders(request.Content), + Body = requestBody + }; + } + + public static async Task ToResponseAsync(HttpResponseMessage response, List headersToHide = null) + { + var responseBody = await ToStringAsync(response.Content); + return new Response + { + Status = new Status + { + Code = response.StatusCode, + Message = response.ReasonPhrase + }, + ResponseHeaders = ToHeaders(response.Headers, headersToHide), + ContentHeaders = ToContentHeaders(response.Content), + Body = responseBody, + HttpVersion = response.Version + }; + } + + public static bool RequestsMatch(Request receivedRequest, Request recordedRequest) + { + return receivedRequest.Method.Equals(recordedRequest.Method, StringComparison.OrdinalIgnoreCase) + && receivedRequest.URI.Equals(recordedRequest.URI, StringComparison.OrdinalIgnoreCase); + } + } +} diff --git a/Scotch/RecordingHandler.cs b/Scotch/RecordingHandler.cs new file mode 100644 index 000000000..fee1d1e38 --- /dev/null +++ b/Scotch/RecordingHandler.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Scotch +{ + public class RecordingHandler : DelegatingHandler + { + private string _cassettePath; + + private List _headersToHide; + + public RecordingHandler(HttpMessageHandler innerHandler, string cassettePath, List headersToHide = null) + { + base.InnerHandler = innerHandler; + _cassettePath = cassettePath; + _headersToHide = headersToHide; + } + + public RecordingHandler(string cassettePath) + { + base.InnerHandler = new HttpClientHandler(); + _cassettePath = cassettePath; + _headersToHide = new List(); + } + + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + var baseResult = base.SendAsync(request, cancellationToken); + + await Task.Run(async () => + { + var response = await baseResult; + var interactionRequest = await Helpers.ToRequestAsync(request, _headersToHide); + var interactionResponse = await Helpers.ToResponseAsync(response, _headersToHide); + var httpInteraction = new HttpInteraction + { + Request = interactionRequest, + Response = interactionResponse, + RecordedAt = DateTimeOffset.Now + }; + Cassette.UpdateInteraction(_cassettePath, httpInteraction); + }); + + return baseResult.Result; + } + } +} diff --git a/Scotch/ReplayingHandler.cs b/Scotch/ReplayingHandler.cs new file mode 100644 index 000000000..3bf7da127 --- /dev/null +++ b/Scotch/ReplayingHandler.cs @@ -0,0 +1,46 @@ +using System; +using System.Linq; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +namespace Scotch +{ + public class ReplayingHandler : DelegatingHandler + { + private string _cassettePath; + + public ReplayingHandler(HttpMessageHandler innerHandler, string cassettePath) + { + base.InnerHandler = innerHandler; + _cassettePath = cassettePath; + } + + public ReplayingHandler(string cassettePath) + { + base.InnerHandler = new HttpClientHandler(); + _cassettePath = cassettePath; + } + + protected override async Task SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) + { + var interactions = Cassette.ReadCassette(_cassettePath); + var receivedRequest = await Helpers.ToRequestAsync(request); + + HttpInteraction matchedInteraction = null; + + try + { + matchedInteraction = interactions.First(i => Helpers.RequestsMatch(receivedRequest, i.Request)); + } + catch (InvalidOperationException) + { + throw new VCRException($"No interaction found for request {receivedRequest.Method} {receivedRequest.URI}"); + } + + var matchedResponse = matchedInteraction.Response; + var responseMessage = matchedResponse.ToHttpResponseMessage(request); + return responseMessage; + } + } +} diff --git a/Scotch/Scotch.cs b/Scotch/Scotch.cs new file mode 100644 index 000000000..33f26bc6a --- /dev/null +++ b/Scotch/Scotch.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using System.Net.Http; + +namespace Scotch +{ + public enum ScotchMode + { + None = 0, + Recording = 1, + Replaying = 2 + } + + public static class HttpClients + { + private static List _credentialHeadersToHide + { + get + { + return new List + { + { + "Authorization" + } + }; + } + } + + public static HttpClient NewHttpClientWithHandler(HttpMessageHandler innerHandler, string cassettePath, ScotchMode mode, bool hideCredentials = false) + { + switch (mode) + { + case ScotchMode.Recording: + return new HttpClient(new RecordingHandler(innerHandler, cassettePath, hideCredentials ? _credentialHeadersToHide : null)); + case ScotchMode.Replaying: + return new HttpClient(new ReplayingHandler(innerHandler, cassettePath)); + case ScotchMode.None: + default: + return new HttpClient(innerHandler); + } + } + + public static HttpClient NewHttpClient(string cassettePath, ScotchMode mode, bool hideCredentials = false) + { + return NewHttpClientWithHandler(new HttpClientHandler(), cassettePath, mode, hideCredentials); + } + } +} diff --git a/Scotch/Scotch.csproj b/Scotch/Scotch.csproj new file mode 100644 index 000000000..15eeb15f2 --- /dev/null +++ b/Scotch/Scotch.csproj @@ -0,0 +1,25 @@ + + + + netcoreapp2.0 + Library + Copyright © 2018 + Scotch + 0.1.2.0 + 0.1.2.0 + Scotch + false + + + + + + + + + + + + + + diff --git a/Scotch/Tools.cs b/Scotch/Tools.cs new file mode 100644 index 000000000..23bdad4cb --- /dev/null +++ b/Scotch/Tools.cs @@ -0,0 +1,24 @@ +using System; +using System.IO; +using System.Runtime.CompilerServices; + +namespace Scotch +{ + public static class Tools + { + private static string GetSourceFileDirectory([CallerFilePath] string sourceFilePath = "") + { + if (string.IsNullOrEmpty(sourceFilePath)) + { + throw new ArgumentNullException(nameof(sourceFilePath)); + } + + return Path.GetDirectoryName(sourceFilePath); + } + + public static string GetFilePathInCurrentDirectory(string fileName) + { + return Path.Combine(GetSourceFileDirectory(), fileName); + } + } +} diff --git a/Scotch/VCRException.cs b/Scotch/VCRException.cs new file mode 100644 index 000000000..7f981be00 --- /dev/null +++ b/Scotch/VCRException.cs @@ -0,0 +1,11 @@ +using System; + +namespace Scotch +{ + public class VCRException : Exception + { + public VCRException(string message) : base(message) + { + } + } +}