Skip to content

Shipments cannot be retrieved for transactions with invalid addresses #30

@drxkstoltzfus

Description

@drxkstoltzfus

Description

If a batch contains a shipment that cannot be purchased due to an address validation failure, the failed shipment cannot be retrieved by using the SDKs shipments().get().shipmentId(shippoShipmentId).call() method due to a deserialization exception. The exception is thrown because the amountLocal field returns a null value but has a constraint that does not allow that field to be null when creating the shipment object.

Reproduction Steps

  • Create a batch with a shipment that contains an invalid city as part of the address
  • Purchase the batch
  • Attempt to retrieve the shipment information for the shipment with the invalid city
  • The SDK throws a deserialization exception because the amountLocal field is null

The expected behavior here is that the shipment should be retrieved and deserialized without issues since the amountLocal field is marked as required in the API specification.

Stack Trace

Caused by: java.lang.IllegalArgumentException: amountLocal cannot be null
	at com.goshippo.shippo_sdk.utils.Utils.checkNotNull(Utils.java:499) ~[shippo-sdk-1.0.0-beta.jar:na]
	at com.goshippo.shippo_sdk.models.components.Rate.<init>(Rate.java:187) ~[shippo-sdk-1.0.0-beta.jar:na]
	at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502) ~[na:na]
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486) ~[na:na]
	at com.fasterxml.jackson.databind.introspect.AnnotatedConstructor.call(AnnotatedConstructor.java:126) ~[jackson-databind-2.18.2.jar:2.18.2]
	at com.fasterxml.jackson.databind.deser.std.StdValueInstantiator.createFromObjectWith(StdValueInstantiator.java:291) ~[jackson-databind-2.18.2.jar:2.18.2]

Batch Shipment Result

{
  "status": "TRANSACTION_FAILED",
  "messages": [
       "failed_address_validation: Recipient address invalid: The City in the address submitted is invalid. Remember, city names cannot begin with numbers."
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions