Normalize from/to dates in QR code, settlement & refund list endpoints#482
Closed
vinothksekar wants to merge 1 commit into
Closed
Normalize from/to dates in QR code, settlement & refund list endpoints#482vinothksekar wants to merge 1 commit into
vinothksekar wants to merge 1 commit into
Conversation
`qrCode.all`, `qrCode.fetchAllPayments`, `settlements.all`,
`settlements.fetchAllOndemandSettlement` and `payments.fetchMultipleRefund`
destructured `{ from, to, count, skip }` from params and then spread them
back into the request as `{ ...params, from, to, count, skip }` — a no-op
that never called `normalizeDate`. As a result these endpoints did not
convert `from`/`to` Date objects / date strings into epoch seconds the way
every other list endpoint (orders.all, payments.all, items.all,
invoices.all, addons.all) does, so passing a human date silently sent an
unconverted value to the API.
Normalize `from`/`to` via normalizeDate in these five methods (added the
util import to qrCode.js and settlements.js). normalizeDate passes numeric
timestamps through unchanged, so this is backward compatible for callers
already sending epoch seconds.
Added regression tests asserting the dates are converted (they fail
without this change).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
One thing I deliberately left out to keep this focused on the date bug: these same five methods also don't default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Five list endpoints destructure
{ from, to, count, skip }fromparamsand then spread them straight back into the request as{ ...params, from, to, count, skip }— a no-op that never callsnormalizeDate:payments.fetchMultipleRefundqrCode.allqrCode.fetchAllPaymentssettlements.allsettlements.fetchAllOndemandSettlementEvery other list endpoint (
orders.all,payments.all,items.all,invoices.all,addons.all) normalizesfrom/toso aDate/date-string is converted to epoch seconds. These five silently skip that, so passing a human-readable date sends an unconverted value to the API and the date filter is wrong.Fix
Call
normalizeDateonfrom/toin the five methods (adding the util import toqrCode.jsandsettlements.js).normalizeDatepasses numeric timestamps through unchanged, so this is backward compatible for callers already sending epoch seconds.Tests
Added regression tests asserting
from/toare converted to seconds for each fixed method. Verified they fail without the source change and pass with it. Full suite:384 passing.