diff --git a/CHANGELOG.md b/CHANGELOG.md index 516f16d78..6806767fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG -## v7.3.0 (2024-07-15) +## Next Release + +- Add new `Claim` service for filing claims on EasyPost shipments and insurances + +## v7.3.0 (2024-07-16) - Adds new `shipment.recommendShipDate`, `smartrate.recommendShipDate`, and `smartrate.estimateDeliveryDate` functions - Routes `UpsAccount`, `UpsMailInnovationsAccount`, and `UpsSurepostAccount` create/update requests to the new `/ups_oauth_registrations` endpoint diff --git a/examples b/examples index b79c16ee6..b1f3d75c3 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit b79c16ee6c3ea1e9da707b95c0a67157fa906519 +Subproject commit b1f3d75c324c2894a6d5c622ee0b31bcc6e1acb3 diff --git a/src/main/java/com/easypost/Constants.java b/src/main/java/com/easypost/Constants.java index c470d63b7..d2c0a7781 100644 --- a/src/main/java/com/easypost/Constants.java +++ b/src/main/java/com/easypost/Constants.java @@ -3,6 +3,7 @@ import com.easypost.http.HashMapSerializer; import com.easypost.model.AddressVerification; import com.easypost.model.AddressVerificationDeserializer; +import com.easypost.model.DateDeserializer; import com.easypost.model.Error; import com.easypost.model.ErrorDeserializer; import com.easypost.model.SmartrateCollection; @@ -16,6 +17,7 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -83,7 +85,8 @@ public abstract static class Http { .registerTypeAdapter(Error.class, new ErrorDeserializer()) .registerTypeAdapter(AddressVerification.class, new AddressVerificationDeserializer()) .registerTypeAdapter(StatelessRate[].class, new StatelessRateDeserializer()) - .registerTypeAdapter(Webhook[].class, new WebhookDeserializer()).create(); + .registerTypeAdapter(Webhook[].class, new WebhookDeserializer()) + .registerTypeAdapter(Date.class, new DateDeserializer()).create(); public static final Gson PRETTY_PRINT_GSON = new GsonBuilder().setPrettyPrinting().serializeNulls() .setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES).create(); } diff --git a/src/main/java/com/easypost/model/Claim.java b/src/main/java/com/easypost/model/Claim.java new file mode 100644 index 000000000..3d8053510 --- /dev/null +++ b/src/main/java/com/easypost/model/Claim.java @@ -0,0 +1,26 @@ +package com.easypost.model; + +import java.util.Date; +import java.util.List; +import lombok.Getter; + +@Getter +public class Claim extends EasyPostResource { + private Date statusTimestamp; + private List history; + private String approvedAmount; + private String checkDeliveryAddress; + private String contactEmail; + private String description; + private String insuranceAmount; + private String insuranceId; + private String paymentMethod; + private String recipientName; + private String requestedAmount; + private String salvageValue; + private String shipmentId; + private String status; + private String statusDetail; + private String trackingCode; + private String type; +} diff --git a/src/main/java/com/easypost/model/ClaimCollection.java b/src/main/java/com/easypost/model/ClaimCollection.java new file mode 100644 index 000000000..de842214c --- /dev/null +++ b/src/main/java/com/easypost/model/ClaimCollection.java @@ -0,0 +1,34 @@ +package com.easypost.model; + +import java.util.List; +import java.util.Map; + +import com.easypost.exception.General.EndOfPaginationError; +import lombok.Getter; +import lombok.Setter; + +@Getter +public final class ClaimCollection extends PaginatedCollection { + private List claims; + + @Setter + private String type; + private String status; + + @Override + protected Map buildNextPageParameters(List claims, Integer pageSize) + throws EndOfPaginationError { + String lastId = claims.get(claims.size() - 1).getId(); + + Map parameters = new java.util.HashMap<>(); + parameters.put("before_id", lastId); + parameters.put("type", type); + parameters.put("status", status); + + if (pageSize != null) { + parameters.put("page_size", pageSize); + } + + return parameters; + } +} diff --git a/src/main/java/com/easypost/model/ClaimHistoryEntry.java b/src/main/java/com/easypost/model/ClaimHistoryEntry.java new file mode 100644 index 000000000..6083dc1ee --- /dev/null +++ b/src/main/java/com/easypost/model/ClaimHistoryEntry.java @@ -0,0 +1,11 @@ +package com.easypost.model; + +import java.util.Date; +import lombok.Getter; + +@Getter +public class ClaimHistoryEntry { + private String status; + private String statusDetail; + private Date statusTimestamp; +} diff --git a/src/main/java/com/easypost/model/DateDeserializer.java b/src/main/java/com/easypost/model/DateDeserializer.java new file mode 100644 index 000000000..f639f6c1c --- /dev/null +++ b/src/main/java/com/easypost/model/DateDeserializer.java @@ -0,0 +1,78 @@ +package com.easypost.model; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; + +import java.lang.reflect.Type; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.TimeZone; + +public class DateDeserializer implements JsonDeserializer { + private static final String[] DATE_FORMATS = new String[]{ + // Basic formats + "yyyy-MM-dd", + "yyyy-MM-dd'T'HH:mm:ss", + "yyyy-MM-dd'T'HH:mm:ss'Z'", + + // With milliseconds + "yyyy-MM-dd'T'HH:mm:ss.SSS", + "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", + + // With time zone offset + "yyyy-MM-dd'T'HH:mm:ssZ", + "yyyy-MM-dd'T'HH:mm:ssXXX", + + // Alternative time formats + "yyyy-MM-dd HH:mm:ss", + "yyyy-MM-dd HH:mm:ss.SSS", + + // Month and day only + "yyyy-MM-dd", + "MM/dd/yyyy", + "MM-dd-yyyy", + + // Year and week + "yyyy-'W'ww", + "yyyy-'W'ww-u", + + // Full date and time + "EEE, d MMM yyyy HH:mm:ss Z", + "EEE, d MMM yyyy HH:mm:ss z", + "EEEE, MMMM d, yyyy h:mm:ss a", + + // Short formats + "M/d/yy", + "M-d-yy", + "M.d.yy", + "MM/dd/yyyy", + "MM-dd-yyyy" + }; + + /** + * Deserialize the Date format from a JSON object. + * + * @param json JSON object to deserialize. + * @param type Type of the object to deserialize. + * @param context Deserialization context. + * @return Deserialized Date object. + * @throws JsonParseException if the JSON object is not a valid SmartrateCollection. + */ + @Override + public Date deserialize(JsonElement json, Type type, JsonDeserializationContext context) + throws JsonParseException { + for (String format : DATE_FORMATS) { + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + sdf.setTimeZone(TimeZone.getTimeZone("UTC")); + return sdf.parse(json.getAsString()); + } catch (ParseException e) { + throw new JsonParseException("Unable to parse this date format"); + } + } + throw new JsonParseException("Unparseable date: \"" + json.getAsString() + "\""); + } +} diff --git a/src/main/java/com/easypost/service/ClaimService.java b/src/main/java/com/easypost/service/ClaimService.java new file mode 100644 index 000000000..e16a008b2 --- /dev/null +++ b/src/main/java/com/easypost/service/ClaimService.java @@ -0,0 +1,116 @@ +package com.easypost.service; + +import java.util.Map; +import java.util.function.Function; + +import com.easypost.exception.EasyPostException; +import com.easypost.exception.General.EndOfPaginationError; +import com.easypost.http.Requestor; +import com.easypost.http.Requestor.RequestMethod; +import com.easypost.model.Claim; +import com.easypost.model.ClaimCollection; + +import lombok.SneakyThrows; + +public class ClaimService { + private final EasyPostClient client; + + /** + * ClaimService constructor. + * + * @param client The client object. + */ + ClaimService(EasyPostClient client) { + this.client = client; + } + + /** + * Create a new claim object from a map of parameters. + * + * @param params Map of parameters. + * @return Claim object + * @throws EasyPostException when the request fails. + */ + public Claim create(final Map params) throws EasyPostException { + String endpoint = "claims"; + + return Requestor.request(RequestMethod.POST, endpoint, params, Claim.class, client); + } + + /** + * Retrieve an Claim from the API. + * + * @param id The ID of the Claim to retrieve. + * @return Claim object + * @throws EasyPostException when the request fails. + */ + public Claim retrieve(final String id) throws EasyPostException { + String endpoint = "claims/" + id; + + return Requestor.request(RequestMethod.GET, endpoint, null, Claim.class, client); + } + + /** + * Get a list of Claims. + * + * @param params a map of parameters + * @return ClaimCollection object + * @throws EasyPostException when the request fails. + */ + public ClaimCollection all(final Map params) throws EasyPostException { + String type = (String) params.get("type"); + String status = (String) params.get("status"); + params.remove(type); + params.remove(status); + String endpoint = "claims"; + + ClaimCollection claimCollection = + Requestor.request(RequestMethod.GET, endpoint, params, ClaimCollection.class, client); + claimCollection.setType(type); + claimCollection.setType(status); + + return claimCollection; + } + + /** + * Cancel an Claim from the API. + * + * @param id The ID of the Claim to cancel. + * @return Claim object + * @throws EasyPostException when the request fails. + */ + public Claim cancel(final String id) throws EasyPostException { + String endpoint = String.format("claims/%s/cancel", id); + + return Requestor.request(RequestMethod.POST, endpoint, null, Claim.class, client); + } + + /** + * Get the next page of an ClaimCollection. + * + * @param collection ClaimCollection to get next page of. + * @return ClaimCollection object. + * @throws EndOfPaginationError when there are no more pages to retrieve. + */ + public ClaimCollection getNextPage(ClaimCollection collection) throws EndOfPaginationError { + return getNextPage(collection, null); + } + + /** + * Get the next page of an ClaimCollection. + * + * @param collection ClaimCollection to get next page of. + * @param pageSize The number of results to return on the next page. + * @return ClaimCollection object. + * @throws EndOfPaginationError when there are no more pages to retrieve. + */ + public ClaimCollection getNextPage( + ClaimCollection collection, Integer pageSize) throws EndOfPaginationError { + return collection.getNextPage(new Function, ClaimCollection>() { + @Override @SneakyThrows + public ClaimCollection apply(Map parameters) { + return all(parameters); + } + }, collection.getClaims(), pageSize); + } +} diff --git a/src/main/java/com/easypost/service/EasyPostClient.java b/src/main/java/com/easypost/service/EasyPostClient.java index e4c523a96..5c1a26efd 100644 --- a/src/main/java/com/easypost/service/EasyPostClient.java +++ b/src/main/java/com/easypost/service/EasyPostClient.java @@ -26,6 +26,7 @@ public class EasyPostClient { public final CarrierAccountService carrierAccount; public final CarrierMetadataService carrierMetadata; public final CarrierTypeService carrierType; + public final ClaimService claim; public final CustomsInfoService customsInfo; public final CustomsItemService customsItem; public final EndShipperService endShipper; @@ -136,6 +137,7 @@ public EasyPostClient(String apiKey, int connectTimeoutMilliseconds, int readTim this.carrierAccount = new CarrierAccountService(this); this.carrierMetadata = new CarrierMetadataService(this); this.carrierType = new CarrierTypeService(this); + this.claim = new ClaimService(this); this.customsInfo = new CustomsInfoService(this); this.customsItem = new CustomsItemService(this); this.endShipper = new EndShipperService(this); diff --git a/src/test/cassettes/claim/all.json b/src/test/cassettes/claim/all.json new file mode 100644 index 000000000..45daa7629 --- /dev/null +++ b/src/test/cassettes/claim/all.json @@ -0,0 +1,88 @@ +[ + { + "recordedAt": 1721769089, + "request": { + "body": "", + "method": "GET", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ] + }, + "uri": "https://api.easypost.com/v2/claims?%70%61%67%65%5F%73%69%7A%65\u003d%35" + }, + "response": { + "body": "{\n \"claims\": [\n {\n \"insurance_id\": \"ins_22e4bf754387428ab7a4fa911d74dd43\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/dc99a33c1939492999f2c49079090301.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/4efbc5873e1d43dab8764c46e762508f.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/412b08fc5eb746cdaa3f0bb7707b38cc.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:08:19\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:08:19\"\n }\n ],\n \"shipment_id\": \"shp_220c769f287b4a3f9f275f20630c5f2d\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066415445\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:08:19\",\n \"id\": \"clm_097e6e5e6f404fb4b7bca2b5be34ec76\",\n \"status_timestamp\": \"2024-07-23T21:08:19\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n },\n {\n \"insurance_id\": \"ins_9a6a479680bd4cfe9539338a70510693\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/a043595d2c534a7ea6271b757d5904c8.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/b37723b6eea04b3889e933367bff8cb2.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/f7f20ecca7bd436c9befaa35518af9fb.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T20:47:28\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T20:47:28\"\n }\n ],\n \"shipment_id\": \"shp_48dc72e60c9b42029263b4ddef062d2f\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066411584\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T20:47:28\",\n \"id\": \"clm_097e5b5bb5d2473b938b1659498bf9bf\",\n \"status_timestamp\": \"2024-07-23T20:47:28\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n }\n ],\n \"has_more\": false\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "2252" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb53nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "98f5faea66a01c81e7798ec500295c4a" + ], + "x-proxied": [ + "extlb1nuq fa152d4755", + "intlb4nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.041697" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/claims?%70%61%67%65%5F%73%69%7A%65\u003d%35" + }, + "duration": 577 + } +] \ No newline at end of file diff --git a/src/test/cassettes/claim/cancel.json b/src/test/cassettes/claim/cancel.json new file mode 100644 index 000000000..af5d99fd0 --- /dev/null +++ b/src/test/cassettes/claim/cancel.json @@ -0,0 +1,361 @@ +[ + { + "recordedAt": 1721769413, + "request": { + "body": "{\n \"shipment\": {\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"hs_tariff_number\": \"654321\",\n \"value\": 23.25,\n \"origin_country\": \"US\"\n }\n ],\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"contents_type\": \"merchandise\"\n },\n \"reference\": \"123\",\n \"parcel\": {\n \"length\": 10.0,\n \"width\": 8.0,\n \"weight\": 15.4,\n \"height\": 4.0\n },\n \"options\": {\n \"label_format\": \"PNG\",\n \"invoice_number\": \"123\"\n },\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"street1\": \"179 N Harbor Dr\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n },\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"street1\": \"388 Townsend St\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n }\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "response": { + "body": "{\n \"insurance\": null,\n \"fees\": [],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"selected_rate\": null,\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": null,\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_e1be9761493811efb577ac1f6bc53342\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_e1be9761493811efb577ac1f6bc53342\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"currency\": null,\n \"id\": \"cstitem_ed37ed77a0f7412ca33b6a62aa6c47f4\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_77f3938b540045cc9da7a62e5496bf43\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": null,\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_2f0ee1166ced4a9fa0b6df20988809dc\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_e1bbefa5493811efbce2ac1f6bc539aa\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_9ec8bf9b483c4727a10bf2a4e6119a78\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_e851a1755cfd46bba95320444e07456a\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_6a508cb9a6784891aa9ebdd84d6a6485\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_e1bbefa5493811efbce2ac1f6bc539aa\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"tracking_code\": null,\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "6271" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb38nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f966a01dc4e779940f002c176f" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.672239" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "location": [ + "/api/v2/shipments/shp_2ffabf823a754afdb236fdd933fc126c" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "duration": 1099 + }, + { + "recordedAt": 1721769415, + "request": { + "body": "{\n \"insurance\": \"100\",\n \"rate\": {\n \"deliveryDateGuaranteed\": false,\n \"listCurrency\": \"USD\",\n \"estDeliveryDays\": 3.0,\n \"listRate\": 6.4,\n \"carrierAccountId\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"mode\": \"test\",\n \"createdAt\": \"Jul 22, 2024, 8:00:00 PM\",\n \"carrier\": \"USPS\",\n \"retailCurrency\": \"USD\",\n \"rate\": 5.93,\n \"deliveryDays\": 3.0,\n \"billingType\": \"easypost\",\n \"service\": \"GroundAdvantage\",\n \"shipmentId\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"currency\": \"USD\",\n \"id\": \"rate_e851a1755cfd46bba95320444e07456a\",\n \"retailRate\": 8.45,\n \"object\": \"Rate\",\n \"updatedAt\": \"Jul 22, 2024, 8:00:00 PM\"\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments/shp_2ffabf823a754afdb236fdd933fc126c/buy" + }, + "response": { + "body": "{\n \"insurance\": \"100.00\",\n \"fees\": [\n {\n \"amount\": \"0.00000\",\n \"refunded\": false,\n \"type\": \"LabelFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"5.93000\",\n \"refunded\": false,\n \"type\": \"PostageFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"0.50000\",\n \"refunded\": false,\n \"type\": \"InsuranceFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n }\n ],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:55Z\",\n \"selected_rate\": {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:54Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:54Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_e851a1755cfd46bba95320444e07456a\",\n \"object\": \"Rate\"\n },\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": {\n \"fees\": [],\n \"carrier_detail\": null,\n \"created_at\": \"2024-07-23T21:16:55Z\",\n \"weight\": null,\n \"tracking_details\": [],\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"tracking_code\": \"9400100110368066416763\",\n \"status_detail\": \"unknown\",\n \"mode\": \"test\",\n \"public_url\": \"https://track.easypost.com/djE6dHJrXzNjODUyNTc2ZjMwNTRiNGNhNmFiMDY1ZDgxNmRhNTVk\",\n \"est_delivery_date\": null,\n \"carrier\": \"USPS\",\n \"updated_at\": \"2024-07-23T21:16:55Z\",\n \"signed_by\": null,\n \"id\": \"trk_3c852576f3054b4ca6ab065d816da55d\",\n \"object\": \"Tracker\",\n \"status\": \"unknown\"\n },\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_e1be9761493811efb577ac1f6bc53342\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:52+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_e1be9761493811efb577ac1f6bc53342\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"currency\": null,\n \"id\": \"cstitem_ed37ed77a0f7412ca33b6a62aa6c47f4\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_77f3938b540045cc9da7a62e5496bf43\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": {\n \"label_resolution\": 300.0,\n \"date_advance\": 0.0,\n \"label_size\": \"4x6\",\n \"integrated_form\": \"none\",\n \"label_pdf_url\": null,\n \"created_at\": \"2024-07-23T21:16:54Z\",\n \"label_type\": \"default\",\n \"label_url\": \"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20240723/e8450c60499dcf4afcb2168633b3707d42.png\",\n \"label_file\": null,\n \"label_epl2_url\": null,\n \"label_file_type\": \"image/png\",\n \"updated_at\": \"2024-07-23T21:16:55Z\",\n \"id\": \"pl_11842ef46ed34281aa0d485349eff7c1\",\n \"label_zpl_url\": null,\n \"label_date\": \"2024-07-23T21:16:54Z\",\n \"object\": \"PostageLabel\"\n },\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:52Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:52Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_2f0ee1166ced4a9fa0b6df20988809dc\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:54+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_e1bbefa5493811efbce2ac1f6bc539aa\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_9ec8bf9b483c4727a10bf2a4e6119a78\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_e851a1755cfd46bba95320444e07456a\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:53Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:53Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_6a508cb9a6784891aa9ebdd84d6a6485\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:52+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:54+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_e1bbefa5493811efbce2ac1f6bc539aa\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"tracking_code\": \"9400100110368066416763\",\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "8490" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb43nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-canary": [ + "direct" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f866a01dc6e7799411002c191d" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb4nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.955206" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/shipments/shp_2ffabf823a754afdb236fdd933fc126c/buy" + }, + "duration": 1349 + }, + { + "recordedAt": 1721769417, + "request": { + "body": "{\n \"email_evidence_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"amount\": \"100\",\n \"supporting_documentation_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"description\": \"Test description\",\n \"type\": \"damage\",\n \"invoice_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"tracking_code\": \"9400100110368066416763\",\n \"contact_email\": \"test@example.com\"\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "response": { + "body": "{\n \"insurance_id\": \"ins_0ac2c47236234589b9bd8f58484fdc59\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/64129940fc5348e299cc308130d440b2.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/ec02e95a82eb42a38b7a16ea1fe1bbe9.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/46b1022cce664a32bbede970bf735bda.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:16:56\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:16:56\"\n }\n ],\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066416763\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:16:56\",\n \"id\": \"clm_097e8fdd467f4d0e908e12bb955ce499\",\n \"status_timestamp\": \"2024-07-23T21:16:56\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "1111" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb53nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169fa66a01dc8e779942a002c1afb" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.849485" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "duration": 1250 + }, + { + "recordedAt": 1721769417, + "request": { + "body": "", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ] + }, + "uri": "https://api.easypost.com/v2/claims/clm_097e8fdd467f4d0e908e12bb955ce499/cancel" + }, + "response": { + "body": "{\n \"insurance_id\": \"ins_0ac2c47236234589b9bd8f58484fdc59\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/64129940fc5348e299cc308130d440b2.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/ec02e95a82eb42a38b7a16ea1fe1bbe9.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/46b1022cce664a32bbede970bf735bda.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:16:56\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"cancelled\",\n \"status_detail\": \"Claim cancellation was requested.\",\n \"timestamp\": \"2024-07-23T21:16:58\"\n },\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:16:56\"\n }\n ],\n \"shipment_id\": \"shp_2ffabf823a754afdb236fdd933fc126c\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066416763\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim cancellation was requested.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:16:57\",\n \"id\": \"clm_097e8fdd467f4d0e908e12bb955ce499\",\n \"status_timestamp\": \"2024-07-23T21:16:58\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"cancelled\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "1235" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb38nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f966a01dc9e779942d002c1c3a" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb4nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.053536" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/claims/clm_097e8fdd467f4d0e908e12bb955ce499/cancel" + }, + "duration": 483 + } +] \ No newline at end of file diff --git a/src/test/cassettes/claim/create.json b/src/test/cassettes/claim/create.json new file mode 100644 index 000000000..f389e9b2b --- /dev/null +++ b/src/test/cassettes/claim/create.json @@ -0,0 +1,272 @@ +[ + { + "recordedAt": 1721769407, + "request": { + "body": "{\n \"shipment\": {\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"hs_tariff_number\": \"654321\",\n \"value\": 23.25,\n \"origin_country\": \"US\"\n }\n ],\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"contents_type\": \"merchandise\"\n },\n \"reference\": \"123\",\n \"parcel\": {\n \"length\": 10.0,\n \"width\": 8.0,\n \"weight\": 15.4,\n \"height\": 4.0\n },\n \"options\": {\n \"label_format\": \"PNG\",\n \"invoice_number\": \"123\"\n },\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"street1\": \"179 N Harbor Dr\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n },\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"street1\": \"388 Townsend St\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n }\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "response": { + "body": "{\n \"insurance\": null,\n \"fees\": [],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"selected_rate\": null,\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": null,\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_de52d6e3493811ef80e0ac1f6bc539ae\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_de52d6e3493811ef80e0ac1f6bc539ae\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"currency\": null,\n \"id\": \"cstitem_4d738cdbf38448598ffb452eb790c97d\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_35a6074e872b4e0097b63a59ce15111c\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": null,\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_8c769eb6e3374e55984ddd514f82af21\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_de510f23493811efac203cecef1b359e\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_84827bdc914643b5a591d4935dcb5f96\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_382bc94144a845f899a001747b916e26\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_496efb6330184cf897d1f79062b84ca4\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_de510f23493811efac203cecef1b359e\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"tracking_code\": null,\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "6271" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb39nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f666a01dbee77993ef002c1186" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.875843" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "location": [ + "/api/v2/shipments/shp_6d9270111c6840dbb5ea5d7ca26c2807" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "duration": 1307 + }, + { + "recordedAt": 1721769409, + "request": { + "body": "{\n \"insurance\": \"100\",\n \"rate\": {\n \"deliveryDateGuaranteed\": false,\n \"listCurrency\": \"USD\",\n \"estDeliveryDays\": 3.0,\n \"listRate\": 6.4,\n \"carrierAccountId\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"mode\": \"test\",\n \"createdAt\": \"Jul 22, 2024, 8:00:00 PM\",\n \"carrier\": \"USPS\",\n \"retailCurrency\": \"USD\",\n \"rate\": 5.93,\n \"deliveryDays\": 3.0,\n \"billingType\": \"easypost\",\n \"service\": \"GroundAdvantage\",\n \"shipmentId\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"currency\": \"USD\",\n \"id\": \"rate_496efb6330184cf897d1f79062b84ca4\",\n \"retailRate\": 8.45,\n \"object\": \"Rate\",\n \"updatedAt\": \"Jul 22, 2024, 8:00:00 PM\"\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments/shp_6d9270111c6840dbb5ea5d7ca26c2807/buy" + }, + "response": { + "body": "{\n \"insurance\": \"100.00\",\n \"fees\": [\n {\n \"amount\": \"0.00000\",\n \"refunded\": false,\n \"type\": \"LabelFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"5.93000\",\n \"refunded\": false,\n \"type\": \"PostageFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"0.50000\",\n \"refunded\": false,\n \"type\": \"InsuranceFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n }\n ],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:49Z\",\n \"selected_rate\": {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:49Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:49Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_496efb6330184cf897d1f79062b84ca4\",\n \"object\": \"Rate\"\n },\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": {\n \"fees\": [],\n \"carrier_detail\": null,\n \"created_at\": \"2024-07-23T21:16:49Z\",\n \"weight\": null,\n \"tracking_details\": [],\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"tracking_code\": \"9400100110368066416756\",\n \"status_detail\": \"unknown\",\n \"mode\": \"test\",\n \"public_url\": \"https://track.easypost.com/djE6dHJrXzg4OTMzMjU0M2FjMjQ3M2I4YTk4YTk4NTQ3NzU5NDhj\",\n \"est_delivery_date\": null,\n \"carrier\": \"USPS\",\n \"updated_at\": \"2024-07-23T21:16:49Z\",\n \"signed_by\": null,\n \"id\": \"trk_889332543ac2473b8a98a9854775948c\",\n \"object\": \"Tracker\",\n \"status\": \"unknown\"\n },\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_de52d6e3493811ef80e0ac1f6bc539ae\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:46+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_de52d6e3493811ef80e0ac1f6bc539ae\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"currency\": null,\n \"id\": \"cstitem_4d738cdbf38448598ffb452eb790c97d\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_35a6074e872b4e0097b63a59ce15111c\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": {\n \"label_resolution\": 300.0,\n \"date_advance\": 0.0,\n \"label_size\": \"4x6\",\n \"integrated_form\": \"none\",\n \"label_pdf_url\": null,\n \"created_at\": \"2024-07-23T21:16:49Z\",\n \"label_type\": \"default\",\n \"label_url\": \"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20240723/e838e9e45e92134a61a4c94123b5aeda78.png\",\n \"label_file\": null,\n \"label_epl2_url\": null,\n \"label_file_type\": \"image/png\",\n \"updated_at\": \"2024-07-23T21:16:49Z\",\n \"id\": \"pl_061759cefc3644b4935b9b27778f875d\",\n \"label_zpl_url\": null,\n \"label_date\": \"2024-07-23T21:16:49Z\",\n \"object\": \"PostageLabel\"\n },\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:46Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:46Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_8c769eb6e3374e55984ddd514f82af21\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:48+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_de510f23493811efac203cecef1b359e\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_84827bdc914643b5a591d4935dcb5f96\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_382bc94144a845f899a001747b916e26\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:47Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:47Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_496efb6330184cf897d1f79062b84ca4\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:46+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:48+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_de510f23493811efac203cecef1b359e\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"tracking_code\": \"9400100110368066416756\",\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "8490" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb53nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f666a01dc0e7799409002c1337" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "1.026211" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/shipments/shp_6d9270111c6840dbb5ea5d7ca26c2807/buy" + }, + "duration": 1463 + }, + { + "recordedAt": 1721769411, + "request": { + "body": "{\n \"email_evidence_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"amount\": \"100\",\n \"supporting_documentation_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"description\": \"Test description\",\n \"type\": \"damage\",\n \"invoice_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"tracking_code\": \"9400100110368066416756\",\n \"contact_email\": \"test@example.com\"\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "response": { + "body": "{\n \"insurance_id\": \"ins_8601c937f7394ac09ec16dc9aec5b390\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/345024219d2f4d1286df783ef0d1433d.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/d8ba1d668d2a4a8a8fb0c0b598bdd066.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/f4c9fd26f1fb4cafbe515ed74138ef1a.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:16:50\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:16:50\"\n }\n ],\n \"shipment_id\": \"shp_6d9270111c6840dbb5ea5d7ca26c2807\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066416756\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:16:50\",\n \"id\": \"clm_097eca949076417890a081e39b758b97\",\n \"status_timestamp\": \"2024-07-23T21:16:50\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "1111" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb38nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f766a01dc2e779940c002c156c" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.894104" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "duration": 1346 + } +] \ No newline at end of file diff --git a/src/test/cassettes/claim/get_next_page.json b/src/test/cassettes/claim/get_next_page.json new file mode 100644 index 000000000..7bfa92606 --- /dev/null +++ b/src/test/cassettes/claim/get_next_page.json @@ -0,0 +1,91 @@ +[ + { + "recordedAt": 1721769220, + "request": { + "body": "", + "method": "GET", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ] + }, + "uri": "https://api.easypost.com/v2/claims?%70%61%67%65%5F%73%69%7A%65\u003d%35" + }, + "response": { + "body": "{\n \"claims\": [\n {\n \"insurance_id\": \"ins_22e4bf754387428ab7a4fa911d74dd43\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/dc99a33c1939492999f2c49079090301.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/4efbc5873e1d43dab8764c46e762508f.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/412b08fc5eb746cdaa3f0bb7707b38cc.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:08:19\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:08:19\"\n }\n ],\n \"shipment_id\": \"shp_220c769f287b4a3f9f275f20630c5f2d\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066415445\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:08:19\",\n \"id\": \"clm_097e6e5e6f404fb4b7bca2b5be34ec76\",\n \"status_timestamp\": \"2024-07-23T21:08:19\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n },\n {\n \"insurance_id\": \"ins_9a6a479680bd4cfe9539338a70510693\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/a043595d2c534a7ea6271b757d5904c8.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/b37723b6eea04b3889e933367bff8cb2.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/f7f20ecca7bd436c9befaa35518af9fb.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T20:47:28\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T20:47:28\"\n }\n ],\n \"shipment_id\": \"shp_48dc72e60c9b42029263b4ddef062d2f\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066411584\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T20:47:28\",\n \"id\": \"clm_097e5b5bb5d2473b938b1659498bf9bf\",\n \"status_timestamp\": \"2024-07-23T20:47:28\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n }\n ],\n \"has_more\": false\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "2252" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb43nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-canary": [ + "direct" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "98f5fae966a01d04e7798f850029c989" + ], + "x-proxied": [ + "extlb1nuq fa152d4755", + "intlb4nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.036372" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/claims?%70%61%67%65%5F%73%69%7A%65\u003d%35" + }, + "duration": 543 + } +] \ No newline at end of file diff --git a/src/test/cassettes/claim/retrieve.json b/src/test/cassettes/claim/retrieve.json new file mode 100644 index 000000000..1ed790842 --- /dev/null +++ b/src/test/cassettes/claim/retrieve.json @@ -0,0 +1,367 @@ +[ + { + "recordedAt": 1721769401, + "request": { + "body": "{\n \"shipment\": {\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"hs_tariff_number\": \"654321\",\n \"value\": 23.25,\n \"origin_country\": \"US\"\n }\n ],\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"contents_type\": \"merchandise\"\n },\n \"reference\": \"123\",\n \"parcel\": {\n \"length\": 10.0,\n \"width\": 8.0,\n \"weight\": 15.4,\n \"height\": 4.0\n },\n \"options\": {\n \"label_format\": \"PNG\",\n \"invoice_number\": \"123\"\n },\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"street1\": \"179 N Harbor Dr\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n },\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"street1\": \"388 Townsend St\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\"\n }\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "response": { + "body": "{\n \"insurance\": null,\n \"fees\": [],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"selected_rate\": null,\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": null,\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_daba1db0493811efba19ac1f6bc539aa\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_daba1db0493811efba19ac1f6bc539aa\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"currency\": null,\n \"id\": \"cstitem_19b252b3e06f490bac3a641a3305f7f6\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_eef722f7fd674cdf8fe77334dacc4a9b\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": null,\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_82899aed7a21423fb57f058e36e659d3\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_dab7e11e493811efbf7bac1f6bc539ae\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_ca19a8ff5ed14b5182c9a0c72895d485\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_0c944ff906cf4f319a53190d41930eec\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_d4cbd190e82741a190da6b206f005f7b\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277\",\n \"country\": \"US\",\n \"city\": \"Redondo Beach\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Elizabeth Swan\",\n \"company\": null,\n \"street1\": \"179 N Harbor Dr\",\n \"id\": \"adr_dab7e11e493811efbf7bac1f6bc539ae\",\n \"street2\": null,\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"tracking_code\": null,\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "6271" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb32nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-canary": [ + "direct" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169fc66a01db8e77993cf002c0bfb" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.696720" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "location": [ + "/api/v2/shipments/shp_a2950885f2f34a4fb453b95b4390acb9" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/shipments" + }, + "duration": 1141 + }, + { + "recordedAt": 1721769403, + "request": { + "body": "{\n \"insurance\": \"100\",\n \"rate\": {\n \"deliveryDateGuaranteed\": false,\n \"listCurrency\": \"USD\",\n \"estDeliveryDays\": 3.0,\n \"listRate\": 6.4,\n \"carrierAccountId\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"mode\": \"test\",\n \"createdAt\": \"Jul 22, 2024, 8:00:00 PM\",\n \"carrier\": \"USPS\",\n \"retailCurrency\": \"USD\",\n \"rate\": 5.93,\n \"deliveryDays\": 3.0,\n \"billingType\": \"easypost\",\n \"service\": \"GroundAdvantage\",\n \"shipmentId\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"currency\": \"USD\",\n \"id\": \"rate_ca19a8ff5ed14b5182c9a0c72895d485\",\n \"retailRate\": 8.45,\n \"object\": \"Rate\",\n \"updatedAt\": \"Jul 22, 2024, 8:00:00 PM\"\n }\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/shipments/shp_a2950885f2f34a4fb453b95b4390acb9/buy" + }, + "response": { + "body": "{\n \"insurance\": \"100.00\",\n \"fees\": [\n {\n \"amount\": \"0.00000\",\n \"refunded\": false,\n \"type\": \"LabelFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"5.93000\",\n \"refunded\": false,\n \"type\": \"PostageFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n },\n {\n \"amount\": \"0.50000\",\n \"refunded\": false,\n \"type\": \"InsuranceFee\",\n \"charged\": true,\n \"object\": \"Fee\"\n }\n ],\n \"batch_id\": null,\n \"batch_message\": null,\n \"batch_status\": null,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"mode\": \"test\",\n \"reference\": \"123\",\n \"usps_zone\": 4.0,\n \"is_return\": false,\n \"updated_at\": \"2024-07-23T21:16:43Z\",\n \"selected_rate\": {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:42Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:42Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_ca19a8ff5ed14b5182c9a0c72895d485\",\n \"object\": \"Rate\"\n },\n \"options\": {\n \"date_advance\": 0.0,\n \"label_format\": \"PNG\",\n \"currency\": \"USD\",\n \"payment\": {\n \"type\": \"SENDER\"\n },\n \"invoice_number\": \"123\"\n },\n \"tracker\": {\n \"fees\": [],\n \"carrier_detail\": null,\n \"created_at\": \"2024-07-23T21:16:43Z\",\n \"weight\": null,\n \"tracking_details\": [],\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"tracking_code\": \"9400100110368066416749\",\n \"status_detail\": \"unknown\",\n \"mode\": \"test\",\n \"public_url\": \"https://track.easypost.com/djE6dHJrXzA4OTI5ZGYwYjE5MDRlMjFhZmM0ZGFkYTNkZjVhY2Rk\",\n \"est_delivery_date\": null,\n \"carrier\": \"USPS\",\n \"updated_at\": \"2024-07-23T21:16:43Z\",\n \"signed_by\": null,\n \"id\": \"trk_08929df0b1904e21afc4dada3df5acdd\",\n \"object\": \"Tracker\",\n \"status\": \"unknown\"\n },\n \"return_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_daba1db0493811efba19ac1f6bc539aa\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"from_address\": {\n \"zip\": \"94107\",\n \"country\": \"US\",\n \"city\": \"San Francisco\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {},\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": null,\n \"updated_at\": \"2024-07-23T21:16:40+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"Jack Sparrow\",\n \"company\": null,\n \"street1\": \"388 Townsend St\",\n \"id\": \"adr_daba1db0493811efba19ac1f6bc539aa\",\n \"street2\": \"Apt 20\",\n \"state\": \"CA\",\n \"email\": \"test@example.com\",\n \"object\": \"Address\"\n },\n \"customs_info\": {\n \"restriction_type\": \"none\",\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"declaration\": null,\n \"mode\": \"test\",\n \"customs_items\": [\n {\n \"quantity\": 2.0,\n \"code\": null,\n \"eccn\": null,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"description\": \"Sweet shirts\",\n \"weight\": 11.0,\n \"printed_commodity_identifier\": null,\n \"origin_country\": \"US\",\n \"manufacturer\": null,\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"currency\": null,\n \"id\": \"cstitem_19b252b3e06f490bac3a641a3305f7f6\",\n \"hs_tariff_number\": \"654321\",\n \"value\": \"23.25\",\n \"object\": \"CustomsItem\"\n }\n ],\n \"restriction_comments\": null,\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"customs_certify\": true,\n \"eel_pfc\": \"NOEEI 30.37(a)\",\n \"customs_signer\": \"Steve Brule\",\n \"id\": \"cstinfo_eef722f7fd674cdf8fe77334dacc4a9b\",\n \"contents_explanation\": \"\",\n \"non_delivery_option\": \"return\",\n \"object\": \"CustomsInfo\",\n \"contents_type\": \"merchandise\"\n },\n \"postage_label\": {\n \"label_resolution\": 300.0,\n \"date_advance\": 0.0,\n \"label_size\": \"4x6\",\n \"integrated_form\": \"none\",\n \"label_pdf_url\": null,\n \"created_at\": \"2024-07-23T21:16:42Z\",\n \"label_type\": \"default\",\n \"label_url\": \"https://easypost-files.s3.us-west-2.amazonaws.com/files/postage_label/20240723/e860fafed4e2354b3ea3dbbd014b0121c2.png\",\n \"label_file\": null,\n \"label_epl2_url\": null,\n \"label_file_type\": \"image/png\",\n \"updated_at\": \"2024-07-23T21:16:43Z\",\n \"id\": \"pl_f873da76518549ffa0a2fb8a78dfd7c1\",\n \"label_zpl_url\": null,\n \"label_date\": \"2024-07-23T21:16:42Z\",\n \"object\": \"PostageLabel\"\n },\n \"parcel\": {\n \"mode\": \"test\",\n \"updated_at\": \"2024-07-23T21:16:40Z\",\n \"predefined_package\": null,\n \"length\": 10.0,\n \"width\": 8.0,\n \"created_at\": \"2024-07-23T21:16:40Z\",\n \"weight\": 15.4,\n \"id\": \"prcl_82899aed7a21423fb57f058e36e659d3\",\n \"object\": \"Parcel\",\n \"height\": 4.0\n },\n \"refund_status\": null,\n \"buyer_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:42+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_dab7e11e493811efbf7bac1f6bc539ae\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"rates\": [\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"6.40\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 3.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"8.45\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"5.93\",\n \"service\": \"GroundAdvantage\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 3.0,\n \"currency\": \"USD\",\n \"id\": \"rate_ca19a8ff5ed14b5182c9a0c72895d485\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"33.10\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"37.90\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"33.10\",\n \"service\": \"Express\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_0c944ff906cf4f319a53190d41930eec\",\n \"object\": \"Rate\"\n },\n {\n \"carrier_account_id\": \"ca_f09befdb2e9c410e95c7622ea912c18c\",\n \"list_rate\": \"8.25\",\n \"created_at\": \"2024-07-23T21:16:41Z\",\n \"delivery_days\": 2.0,\n \"list_currency\": \"USD\",\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"mode\": \"test\",\n \"carrier\": \"USPS\",\n \"delivery_date\": null,\n \"delivery_date_guaranteed\": false,\n \"retail_rate\": \"9.80\",\n \"retail_currency\": \"USD\",\n \"updated_at\": \"2024-07-23T21:16:41Z\",\n \"rate\": \"6.90\",\n \"service\": \"Priority\",\n \"billing_type\": \"easypost\",\n \"est_delivery_days\": 2.0,\n \"currency\": \"USD\",\n \"id\": \"rate_d4cbd190e82741a190da6b206f005f7b\",\n \"object\": \"Rate\"\n }\n ],\n \"scan_form\": null,\n \"to_address\": {\n \"zip\": \"90277-2506\",\n \"country\": \"US\",\n \"city\": \"REDONDO BEACH\",\n \"created_at\": \"2024-07-23T21:16:40+00:00\",\n \"verifications\": {\n \"delivery\": {\n \"success\": true,\n \"details\": {\n \"latitude\": 33.8436,\n \"time_zone\": \"America/Los_Angeles\",\n \"longitude\": -118.39177\n },\n \"errors\": []\n },\n \"zip4\": {\n \"success\": true,\n \"details\": null,\n \"errors\": []\n }\n },\n \"mode\": \"test\",\n \"federal_tax_id\": null,\n \"state_tax_id\": null,\n \"carrier_facility\": null,\n \"residential\": false,\n \"updated_at\": \"2024-07-23T21:16:42+00:00\",\n \"phone\": \"REDACTED\",\n \"name\": \"ELIZABETH SWAN\",\n \"company\": null,\n \"street1\": \"179 N HARBOR DR\",\n \"id\": \"adr_dab7e11e493811efbf7bac1f6bc539ae\",\n \"street2\": \"\",\n \"state\": \"CA\",\n \"email\": \"TEST@EXAMPLE.COM\",\n \"object\": \"Address\"\n },\n \"tracking_code\": \"9400100110368066416749\",\n \"messages\": [\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_2cdc6fb96d99484e8631d7c9620dec24\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_e6db2c19d54c4025b852d0ad81ee7f4e\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_1c4eecb124f841d7a51e7e53cdda6cd8\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_8031f3014d2b49dba089e5c14da57413\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_f363eb4e1b194798b015a07598be6ed4\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_687017c7f80044ab942b697a9607c439\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_3e92a82adac444a58f032ebcd8eb9028\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n },\n {\n \"carrier\": \"UPS\",\n \"carrier_account_id\": \"ca_6924408886ad49ac9a8468804f2b52b7\",\n \"type\": \"rate_error\",\n \"message\": \"Invalid Access License number\"\n }\n ],\n \"order_id\": null,\n \"forms\": [],\n \"status\": \"unknown\",\n \"object\": \"Shipment\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "8490" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb43nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-canary": [ + "direct" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f666a01dbae77993e9002c0d97" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb4nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.932795" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/shipments/shp_a2950885f2f34a4fb453b95b4390acb9/buy" + }, + "duration": 1349 + }, + { + "recordedAt": 1721769405, + "request": { + "body": "{\n \"email_evidence_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"amount\": \"100\",\n \"supporting_documentation_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"description\": \"Test description\",\n \"type\": \"damage\",\n \"invoice_attachments\": [\n \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAeUlEQVR42mP8//8/AwAI/AL+4Q7AIAAAAABJRU5ErkJggg\\u003d\\u003d\"\n ],\n \"tracking_code\": \"9400100110368066416749\",\n \"contact_email\": \"test@example.com\"\n}", + "method": "POST", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ], + "Content-Type": [ + "application/json" + ] + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "response": { + "body": "{\n \"insurance_id\": \"ins_fd87478c4ff2447fa678853fa6aebaff\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/75c2be22b8e7413cbf45c2259da506cd.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/90554c79fbdb47d18653644e3fc2732f.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/3743b283d3e84ab2b1959798d647421a.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:16:44\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:16:44\"\n }\n ],\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066416749\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:16:44\",\n \"id\": \"clm_097e1f7b5af5443d8ae2d16c00b47584\",\n \"status_timestamp\": \"2024-07-23T21:16:44\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 201 Created" + ], + "content-length": [ + "1111" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb36nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f666a01dbce77993eb002c0f4d" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.780805" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 201, + "message": "Created" + }, + "uri": "https://api.easypost.com/v2/claims" + }, + "duration": 1225 + }, + { + "recordedAt": 1721769405, + "request": { + "body": "", + "method": "GET", + "headers": { + "Accept-Charset": [ + "UTF-8" + ], + "User-Agent": [ + "REDACTED" + ] + }, + "uri": "https://api.easypost.com/v2/claims/clm_097e1f7b5af5443d8ae2d16c00b47584" + }, + "response": { + "body": "{\n \"insurance_id\": \"ins_fd87478c4ff2447fa678853fa6aebaff\",\n \"attachments\": [\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/75c2be22b8e7413cbf45c2259da506cd.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/90554c79fbdb47d18653644e3fc2732f.png\",\n \"https://easypost-files.s3-us-west-2.amazonaws.com/insurance/20240723/3743b283d3e84ab2b1959798d647421a.png\"\n ],\n \"check_delivery_address\": null,\n \"created_at\": \"2024-07-23T21:16:44\",\n \"description\": \"Test description\",\n \"history\": [\n {\n \"status\": \"submitted\",\n \"status_detail\": \"Claim was created.\",\n \"timestamp\": \"2024-07-23T21:16:44\"\n }\n ],\n \"shipment_id\": \"shp_a2950885f2f34a4fb453b95b4390acb9\",\n \"type\": \"damage\",\n \"tracking_code\": \"9400100110368066416749\",\n \"requested_amount\": \"100.00\",\n \"contact_email\": \"test@example.com\",\n \"status_detail\": \"Claim was created.\",\n \"mode\": \"test\",\n \"insurance_amount\": \"100.00\",\n \"updated_at\": \"2024-07-23T21:16:44\",\n \"id\": \"clm_097e1f7b5af5443d8ae2d16c00b47584\",\n \"status_timestamp\": \"2024-07-23T21:16:44\",\n \"recipient_name\": null,\n \"approved_amount\": null,\n \"payment_method\": \"easypost_wallet\",\n \"object\": \"Claim\",\n \"salvage_value\": null,\n \"status\": \"submitted\"\n}", + "httpVersion": null, + "headers": { + "null": [ + "HTTP/1.1 200 OK" + ], + "content-length": [ + "1111" + ], + "expires": [ + "0" + ], + "x-node": [ + "bigweb32nuq" + ], + "x-frame-options": [ + "SAMEORIGIN" + ], + "x-backend": [ + "easypost" + ], + "x-permitted-cross-domain-policies": [ + "none" + ], + "x-download-options": [ + "noopen" + ], + "strict-transport-security": [ + "max-age\u003d31536000; includeSubDomains; preload" + ], + "pragma": [ + "no-cache" + ], + "x-canary": [ + "direct" + ], + "x-content-type-options": [ + "nosniff" + ], + "x-xss-protection": [ + "1; mode\u003dblock" + ], + "x-ep-request-uuid": [ + "483169f866a01dbde77993ec002c109e" + ], + "x-proxied": [ + "extlb2nuq fa152d4755", + "intlb3nuq c0f5e722d1" + ], + "referrer-policy": [ + "strict-origin-when-cross-origin" + ], + "x-runtime": [ + "0.036690" + ], + "content-type": [ + "application/json; charset\u003dutf-8" + ], + "x-version-label": [ + "easypost-202407232043-ebc404c389-master" + ], + "cache-control": [ + "private, no-cache, no-store" + ] + }, + "status": { + "code": 200, + "message": "OK" + }, + "uri": "https://api.easypost.com/v2/claims/clm_097e1f7b5af5443d8ae2d16c00b47584" + }, + "duration": 462 + } +] \ No newline at end of file diff --git a/src/test/java/com/easypost/ClaimTest.java b/src/test/java/com/easypost/ClaimTest.java new file mode 100644 index 000000000..a762a98a5 --- /dev/null +++ b/src/test/java/com/easypost/ClaimTest.java @@ -0,0 +1,163 @@ +package com.easypost; + +import com.easypost.exception.EasyPostException; +import com.easypost.exception.General.EndOfPaginationError; +import com.easypost.model.Claim; +import com.easypost.model.ClaimCollection; +import com.easypost.model.Shipment; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +public final class ClaimTest { + private static TestUtils.VCR vcr; + + /** + * Set up the testing environment for this file. + * + * @throws EasyPostException when the request fails. + */ + @BeforeAll + public static void setup() throws EasyPostException { + vcr = new TestUtils.VCR("claim", TestUtils.ApiKey.TEST); + } + + /** + * Create a insured shipment object. + * @param amount the amount to insure the shipment. + * + * @return Shipment object + */ + private static Shipment createInsuredShipment(String amount) throws EasyPostException { + Shipment shipment = vcr.client.shipment.create(Fixtures.fullShipment()); + + HashMap params = new HashMap<>(); + params.put("rate", shipment.lowestRate()); + params.put("insurance", amount); + + return vcr.client.shipment.buy(shipment.getId(), params); + } + + /** + * Test creating a claim object. + * + * @throws EasyPostException when the request fails. + */ + @Test + public void testCreate() throws EasyPostException { + vcr.setUpTest("create"); + String amount = "100"; + Shipment shipment = ClaimTest.createInsuredShipment(amount); + HashMap claimData = Fixtures.basicClaim(); + claimData.put("amount", amount); + claimData.put("tracking_code", shipment.getTrackingCode()); + Claim claim = vcr.client.claim.create(claimData); + + assertInstanceOf(Claim.class, claim); + assertTrue(claim.getId().startsWith("clm_")); + } + + /** + * Test retrieving an claim object. + * + * @throws EasyPostException when the request fails. + */ + @Test + public void testRetrieve() throws EasyPostException { + vcr.setUpTest("retrieve"); + + String amount = "100"; + Shipment shipment = ClaimTest.createInsuredShipment(amount); + HashMap claimData = Fixtures.basicClaim(); + claimData.put("amount", amount); + claimData.put("tracking_code", shipment.getTrackingCode()); + Claim claim = vcr.client.claim.create(claimData); + + Claim retrievedClaim = vcr.client.claim.retrieve(claim.getId()); + + assertInstanceOf(Claim.class, retrievedClaim); + assertEquals(claim.getId(), retrievedClaim.getId()); + } + + /** + * Test retrieving all claim objects. + * + * @throws EasyPostException when the request fails. + */ + @Test + public void testAll() throws EasyPostException { + vcr.setUpTest("all"); + + Map params = new HashMap<>(); + params.put("page_size", Fixtures.pageSize()); + + ClaimCollection claimCollection = vcr.client.claim.all(params); + + List claims = claimCollection.getClaims(); + + assertTrue(claims.size() <= Fixtures.pageSize()); + assertNotNull(claimCollection.getHasMore()); + assertTrue(claims.stream().allMatch(claim -> claim != null)); + } + + /** + * Test retrieving the next page. + * + * @throws EasyPostException when the request fails. + */ + @Test + public void testGetNextPage() throws EasyPostException { + vcr.setUpTest("get_next_page"); + + Map params = new HashMap<>(); + params.put("page_size", Fixtures.pageSize()); + ClaimCollection collection = vcr.client.claim.all(params); + + try { + ClaimCollection nextPage = vcr.client.claim.getNextPage(collection, Fixtures.pageSize()); + + assertNotNull(nextPage); + + String firstIdOfFirstPage = collection.getClaims().get(0).getId(); + String firstIdOfSecondPage = nextPage.getClaims().get(0).getId(); + + assertNotEquals(firstIdOfFirstPage, firstIdOfSecondPage); + } catch (EndOfPaginationError e) { // There's no next page, that's not a failure + assertTrue(true); + } catch (Exception e) { // Any other exception is a failure + fail(); + } + } + + /** + * Test cancelling a filed claim. + * + * @throws EasyPostException when the request fails. + */ + @Test + public void testCancelClaim() throws EasyPostException { + vcr.setUpTest("cancel"); + + String amount = "100"; + Shipment shipment = ClaimTest.createInsuredShipment(amount); + HashMap claimData = Fixtures.basicClaim(); + claimData.put("amount", amount); + claimData.put("tracking_code", shipment.getTrackingCode()); + Claim claim = vcr.client.claim.create(claimData); + Claim cancelledClaim = vcr.client.claim.cancel(claim.getId()); + + assertInstanceOf(Claim.class, cancelledClaim); + assertTrue(cancelledClaim.getId().startsWith("clm_")); + assertEquals("cancelled", cancelledClaim.getStatus()); + } +} diff --git a/src/test/java/com/easypost/Fixtures.java b/src/test/java/com/easypost/Fixtures.java index 0cd2399d8..143d4592f 100644 --- a/src/test/java/com/easypost/Fixtures.java +++ b/src/test/java/com/easypost/Fixtures.java @@ -249,6 +249,18 @@ public static HashMap basicCarrierAccount() { return Objects.requireNonNull(getFixtureData()).carrierAccounts.basic; } + /** + * Get the default claim. + * + * @return The default claim + */ + public static HashMap basicClaim() { + /* + This fixture will require you to append a `tracking_code` and `amount`. + */ + return Objects.requireNonNull(getFixtureData()).claims.basic; + } + /** * Get the default insurance. * diff --git a/src/test/java/com/easypost/fixtures/FixtureStructure.java b/src/test/java/com/easypost/fixtures/FixtureStructure.java index 1ffff9416..9dbb725b5 100644 --- a/src/test/java/com/easypost/fixtures/FixtureStructure.java +++ b/src/test/java/com/easypost/fixtures/FixtureStructure.java @@ -3,6 +3,7 @@ import com.easypost.fixtures.components.Addresses; import com.easypost.fixtures.components.CarrierAccounts; import com.easypost.fixtures.components.CarrierStrings; +import com.easypost.fixtures.components.Claims; import com.easypost.fixtures.components.CreditCards; import com.easypost.fixtures.components.CustomsInfos; import com.easypost.fixtures.components.CustomsItems; @@ -30,6 +31,9 @@ public final class FixtureStructure { @SerializedName ("carrier_strings") public CarrierStrings carrierStrings; + @SerializedName ("claims") + public Claims claims; + @SerializedName ("credit_cards") public CreditCards creditCards; diff --git a/src/test/java/com/easypost/fixtures/components/Claims.java b/src/test/java/com/easypost/fixtures/components/Claims.java new file mode 100644 index 000000000..616d532c4 --- /dev/null +++ b/src/test/java/com/easypost/fixtures/components/Claims.java @@ -0,0 +1,10 @@ +package com.easypost.fixtures.components; + +import com.google.gson.annotations.SerializedName; + +import java.util.HashMap; + +public final class Claims { + @SerializedName ("basic") + public HashMap basic; +}