Skip to content
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

Improve deserialisation and payment contexts updates #450

Merged

Conversation

armando-rodriguez-cko
Copy link
Contributor

Description

This PR improves deserialisation processes and updates key features in the payment contexts and test implementations, ensuring enhanced flexibility and robustness when handling diverse input formats and data structures.

Changes Made

Improved Deserialisation:

  • Enhanced the GsonSerializer to handle various date formats:
    • ISO-8601 Instants (yyyy-MM-ddTHH:mm:ssZ).
    • Numeric date formats like yyyyMMdd.
    • Standard date formats like yyyy-MM-dd.
  • Incorporated fallback mechanisms to gracefully parse dates using multiple predefined formats, ensuring no crashes occur when invalid or unexpected date formats are received.

Updates to Payment Contexts:

  • Adjusted PaymentContextsAirlineData to handle tickets as a single entity rather than a list, improving clarity and alignment with processing expectations.

Test Enhancements:

  • Added unit tests to validate deserialisation for all supported date formats:
    • Covered cases with numeric formats (yyyyMMdd).
    • Handled edge cases like missing or invalid date values.
  • Extended tests for payment contexts:
    • Included scenarios for Klarna and PayPal responses in mock data.
    • Validated serialisation and deserialisation for payment context objects.

Mock Data Updates:

  • Updated JSON mocks to align with the latest payment context changes, ensuring consistency across tests.
  • Added more realistic test cases to simulate production-like scenarios, including complex payment processing details.

Impact

  • Improves the SDK's robustness and flexibility by handling diverse and non-standard input formats.
  • Enhances reliability in deserialisation, reducing the likelihood of errors during runtime.
  • Strengthens test coverage to ensure the system remains stable under edge cases.

Additional Notes

  • No breaking changes were introduced, maintaining full backward compatibility with existing implementations.
  • These updates ensure a smoother developer experience by explicitly handling edge cases and improving diagnostics for deserialisation errors.

@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team November 21, 2024 13:49
@armando-rodriguez-cko armando-rodriguez-cko changed the title Improve deserialisation and updates Improve deserialisation and payment contexts updates Nov 21, 2024
@armando-rodriguez-cko armando-rodriguez-cko force-pushed the feature/improve-deserialization-and-updates branch from 642607a to 244b317 Compare November 21, 2024 14:27
@armando-rodriguez-cko armando-rodriguez-cko force-pushed the feature/improve-deserialization-and-updates branch from def5366 to ec9b8c4 Compare November 21, 2024 18:51
@armando-rodriguez-cko armando-rodriguez-cko merged commit f574901 into master Nov 27, 2024
4 checks passed
@armando-rodriguez-cko armando-rodriguez-cko deleted the feature/improve-deserialization-and-updates branch November 27, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants