Skip to content

[PW-7223] Fix for serializing Date objects to ISO 8601 format for Checkout #853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 21, 2022

Conversation

jillingk
Copy link
Contributor

@jillingk jillingk commented Oct 19, 2022

Description
Added a custom adapter for date objects in Checkout classes for merchant requesting this. Also added Unit Tests that we can keep and extend when we add with the new solution for generated models, as it's nice to check the Date object to ISO8601 conversion during these upgrades.

Tested scenarios
Unit Tests in DateSerializationTest.java

@@ -159,7 +160,7 @@ public ChannelEnum read(final JsonReader jsonReader) throws IOException {
private String countryCode = null;

@SerializedName("dateOfBirth")
@JsonAdapter(DateSerializer.class)
@JsonAdapter(DateTimeISO8601Serializer.class)
private Date dateOfBirth = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time is not necessary in this field. I think we can stick to DateSerializer here.

https://docs.adyen.com/api-explorer/Checkout/69/post/paymentSession#request-dateOfBirth

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I thought we could make it easier for ourselves and make this one ISO8601 as well since the format entails YYYY-MM-DD format and filling the field in as such will result in the same format. Plus I tried sending a full ISO8601 string (with timezone) on Postman and the API just accepts that as well, so I feel like everything ISO8601 is the way to go? Let me know what you think :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will be sending/processing a few extra bytes that will be ignored. I hope we can remove this eventually.

@jillingk jillingk merged commit a605cca into develop Oct 21, 2022
@jillingk jillingk deleted the PW-7223 branch October 21, 2022 10:10
@wboereboom wboereboom mentioned this pull request Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants