Document the sale-date contract, and rate the packaged goods
parsePosSaleDate needed no change — RFC3339Nano already accepts the offset the
terminal now sends, and Format("2006-01-02") on a zoned time still yields the
till's own trading day rather than UTC's. But the ordering of those layouts is
load-bearing and nothing said so, and the two bare layouts are a legacy that
should be recognisable as one: they exist for terminals built before the offset,
whose bills record an instant wrong by the offset with nothing in the payload to
recover it from. Two tests pin both halves, including the case that motivated
this — 00:30 IST, where UTC has not yet rolled into the same day.
The GST script writes only the four packaged lines at 1185, which sat at 0 and
were being billed with no tax at all.
It deliberately does not touch the produce at 1135. That was written believing
every rate was 0 — read from a field name that does not exist in the response,
so the check silently returned nothing. The rows in fact hold 8, 12 and 18, and
under Indian GST fresh unbranded fruit and chilled fish are nil-rated, so
several look like overcharging. Every correction there is a reduction of a live
rate, which belongs to whoever signs the returns rather than to a script. They
are reported as REVIEW and left as found.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -412,6 +412,20 @@ func posCustomerMobile(order models.PosOrder) string {
|
||||
// The terminal sends ISO-8601. A blank one falls back to now; an unparseable
|
||||
// one is refused, because importing a sale under the wrong date corrupts every
|
||||
// daily revenue figure that reads it.
|
||||
// parsePosSaleDate reads the moment a bill was rung.
|
||||
//
|
||||
// The order of these layouts is load-bearing, and the two zoned ones must stay
|
||||
// first. A terminal that sends its offset — `2026-08-05T00:30:00+05:30` — gets
|
||||
// both readings right: the instant is correct, and Format("2006-01-02") still
|
||||
// yields the till's own trading day rather than UTC's.
|
||||
//
|
||||
// The two bare layouts exist for terminals built before the offset was added,
|
||||
// which are still in the field. `time.Parse` fills an absent zone with UTC, so
|
||||
// those bills record an instant wrong by the offset — a Coimbatore wall clock
|
||||
// read as though it were London. That is not recoverable here: nothing in the
|
||||
// payload says which zone it came from. Their business date is still right,
|
||||
// which is why the daily figures held up while billedat did not, and why these
|
||||
// are tolerated rather than refused.
|
||||
func parsePosSaleDate(raw string) (time.Time, error) {
|
||||
raw = strings.TrimSpace(raw)
|
||||
if raw == "" {
|
||||
|
||||
Reference in New Issue
Block a user