fix(order): carry item weight through the contract-to-model transformer

CreateOrderContractToModel and AddToOrderContractToModel copied every order
item field except Weight, so a weight sent by the client never reached the
processor and every weight-based line failed with "product ... is sold by
weight and requires a weight".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
efrilm
2026-09-06 22:44:55 +07:00
co-authored by Claude Opus 5
parent ebf666c004
commit f2701882dc
2 changed files with 50 additions and 0 deletions
@@ -17,6 +17,7 @@ func CreateOrderContractToModel(req *contract.CreateOrderRequest) *models.Create
ProductID: item.ProductID,
ProductVariantID: item.ProductVariantID,
Quantity: item.Quantity,
Weight: item.Weight,
UnitPrice: item.UnitPrice, // Now optional
Modifiers: item.Modifiers,
Notes: item.Notes,
@@ -58,6 +59,7 @@ func AddToOrderContractToModel(req *contract.AddToOrderRequest) *models.AddToOrd
ProductID: item.ProductID,
ProductVariantID: item.ProductVariantID,
Quantity: item.Quantity,
Weight: item.Weight,
UnitPrice: item.UnitPrice, // Now optional
Modifiers: item.Modifiers,
Notes: item.Notes,