Skip to content

Unit ACH payment deserialization fails on unrecognized status 'PendingReview' #62

Description

@ndclayton

Generated enums like AchPaymentAllOfAttributes.StatusEnum (and the identical pattern in BookPaymentAllOfAttributes.StatusEnum) use a @JsonCreator-annotated fromValue(String) factory method that throws IllegalArgumentException when the value isn't one of the enum's known constants:

@JsonCreator
public static StatusEnum fromValue(String value) {
  for (StatusEnum b : StatusEnum.values()) {
    if (b.value.equals(value)) {
      return b;
    }
  }
  throw new IllegalArgumentException("Unexpected value '" + value + "'");
}

Because this uses a custom @JsonCreator factory rather than Jackson's built-in enum-by-name resolution, standard Jackson leniency options (e.g. DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL) have no effect — the factory method's exception propagates regardless, surfacing as a ValueInstantiationException that fails deserialization of the entire response object, not just the one field.

Observed in practice: the API returned a payment status of 'PendingReview', which isn't present in StatusEnum (PENDING, REJECTED, CLEARING, SENT, CANCELED, RETURNED). This causes createPayment to throw even though the underlying HTTP response was a successful 2xx — the payment was created, but the client can never read its ID, status, or any other field from the response.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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