EasyPost/easypost-java

[Feat]: Event missing status field

Closed this issue · 2 comments

Feature Request Is New

  • I have verified that the requested feature does not already exist or has not already been requested.

Description of the feature

We want to examine the failure and pending status of the events that come to our webhook at regular intervals.
There is status information in the json view of the event coming from the webhook. However, due to the absence of this field in the Event class, this field is not mapped while deserializing.

Event json value

{
  "description": "tracker.created",
  "mode": "test",
  "previous_attributes": {},
  "created_at": "2023-03-24T23:48:57.000Z",
  "pending_urls": [
    "https://151c-78-175-233-110.ngrok.io/api/v1/integrations/easypost/webhooks"
  ],
  "completed_urls": [],
  "updated_at": "2023-03-24T23:49:34.000Z",
  "id": "evt_712b8b3eca9e11edb535551547f44e8a",
  "user_id": "user_74a9dc2c74214b8c82c53602ee3bf2fa",
  "status": "failed",
  "object": "Event"
}

Event class

@Getter
public final class Event extends EasyPostResource {
    private String description;
    private Map<String, Object> result;
    private Map<String, Object> previousAttributes;
    private List<String> pendingUrls;
    private List<String> completedUrls;
}

When we add the status information as below, we can get it while deserializing. As a workaround solution, we solved this situation by overriding the eventService as follows.

Our solution

@Data
public class CustomEvent extends EasyPostResource {
  private String description;
  private Map<String, Object> result;
  private Map<String, Object> previousAttributes;
  private List<String> pendingUrls;
  private List<String> completedUrls;

  private String status;
}

  public CustomEvent retrieve(final String id) throws EasyPostException {
    String endpoint = "events/" + id;
    return Requestor.request(RequestMethod.GET, endpoint, null, CustomEvent.class, easyPostClient);
  }

Could you add the status field to the event class?

Hey @yasnmert, this is indeed missing, thanks for reporting this! We'll have a patch up for this shortly.

Thank you