Skip to content

Conversation

@armando-rodriguez-cko
Copy link
Contributor

This pull request introduces a new custom date type, APIShortDate, to enforce strict handling of API date fields in the yyyy-MM-dd format. The main changes include implementing this type, updating relevant data structures to use it, and adding comprehensive tests to ensure correct parsing and formatting.

API Date Handling Improvements:

  • Added a new APIShortDate type in common/apishortdate.go that supports only the yyyy-MM-dd format, with custom JSON marshal/unmarshal logic to reject other date/time formats.
  • Updated the InstrumentData struct's DateOfSignature field in instruments/nas/instuments.go to use *common.APIShortDate instead of *time.Time, ensuring only valid short dates are accepted.

Test Coverage Enhancements:

  • Added a new test suite in test/apishortdate_test.go covering valid/invalid formats, round-trip marshalling, and edge cases for APIShortDate.
  • Updated test helpers and integration tests to use and validate the new APIShortDate type, including changes in instruments/nas/client_test.go and test/instruments_test.go. [1] [2] [3]

Codebase Cleanup:

  • Removed unnecessary imports of time in instruments/nas/instuments.go since date handling is now abstracted by APIShortDate.
  • Minor import reordering for clarity in test files.

@armando-rodriguez-cko armando-rodriguez-cko requested a review from a team December 18, 2025 16:57
@armando-rodriguez-cko armando-rodriguez-cko linked an issue Dec 18, 2025 that may be closed by this pull request
1 task
@sonarqubecloud
Copy link

@david-ruiz-cko david-ruiz-cko merged commit 32d0984 into master Dec 22, 2025
4 checks passed
@david-ruiz-cko david-ruiz-cko deleted the issue/157 branch December 22, 2025 07:58
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.

Time parse error on get payment instrument

5 participants