DEV Community

hoyeon
hoyeon

Posted on

Keep shipping quotes honest with versioned inputs

Disclosure: I am involved with Kimfast, a package-forwarding service. I used AI to help structure and edit this article. The code below is a standalone design example, not a claim about Kimfast's production implementation or conversion results.

A quote is more than one displayed number. A customer may enter a product link before purchase, while the warehouse later measures a packed parcel. If the UI shows both values as “shipping cost” without their inputs and timestamps, a reasonable user may treat an estimate as a final charge.

Model the evidence, not only the amount

A small quote record can preserve its source and state:

enum QuoteStage { PRE_PURCHASE_ESTIMATE, PACKED_MEASUREMENT, FINAL_AMOUNT }

record QuoteSnapshot {
country: string
stage: QuoteStage
amount: Decimal
currency: string
measuredWeightKg: Decimal | null
observedAt: timestamp
policyVersion: string
}

This is language-neutral pseudocode. The stage names are not a proposed public API. The useful constraint is that every amount has a country, a meaning, and the policy version used to calculate it. A later calculation creates a new snapshot instead of silently overwriting an older one.

Three invariants worth testing

Do not relabel an estimate as final. A UI component should render the stage with the amount. If the packed measurement is unavailable, it must not invent one from the product listing.

Do not reuse a quote across countries. A link for one forwarding route does not establish the cost of another. Validate the country code against the quote and the route before showing a comparison.

Do not compare unlike inputs. If one amount includes a warehouse measurement and another uses a seller's stated weight, show that difference before calculating a “savings” figure. A price comparison needs the same scope and included services.

A review table makes the boundary explicit:

Input What the UI can say What it must not infer
Product URL only Estimated amount under stated assumptions Final packed weight
Warehouse measurement Amount based on observed package dimensions Customs outcome or delivery date
Confirmed final amount Charge and the applicable conditions That all future orders cost the same

Make change observable

Keep the old snapshot when a pricing rule changes. The support team should be able to answer: which inputs produced the figure the customer saw, when was it shown, and which version of the rules was in effect? That is more useful than storing only the last amount.

The public Kimfast Spain forwarding guide describes an order flow in which the parcel is measured before payment. It is a reference for the user-facing sequence, not evidence that Kimfast has adopted the record structure above. Any quoted price or service condition should be checked against the current guide before a product screen or an external article repeats it.

Where to start

Before changing code, collect one example of each stage from the current product flow without exposing customer data. Label every UI amount with its source, units, and date. Then test transitions with missing measurements, changed country selection, and a price-rule update. If the UI cannot explain why two amounts differ, adding more decimal places will not resolve the underlying ambiguity.

A forwarding form becomes more trustworthy when the system can explain the number it shows and the conditions under which that number may change.

Top comments (0)