feat(dashboard,core-flows,types,order): change order accepts price updates (#9476)
* chore: change order can accept price updates * chore: add changes to transformed order * chore: fix transform * chore: transform raw unit price
This commit is contained in:
@@ -13,6 +13,7 @@ OrderChangeProcessing.registerActionType(ChangeActionType.ITEM_UPDATE, {
|
||||
(item) => item.id === action.details.reference_id
|
||||
)
|
||||
|
||||
const unitPrice = action.details.unit_price
|
||||
const existing = currentOrder.items[existingIndex]
|
||||
|
||||
existing.detail.quantity ??= 0
|
||||
@@ -26,6 +27,13 @@ OrderChangeProcessing.registerActionType(ChangeActionType.ITEM_UPDATE, {
|
||||
existing.quantity = quant
|
||||
existing.detail.quantity = quant
|
||||
|
||||
if (unitPrice) {
|
||||
const unitPriceBN = new BigNumber(unitPrice)
|
||||
|
||||
existing.unit_price = unitPriceBN
|
||||
existing.detail.unit_price = unitPriceBN
|
||||
}
|
||||
|
||||
setActionReference(existing, action, options)
|
||||
|
||||
return MathBN.mult(existing.unit_price, quantityDiff)
|
||||
|
||||
Reference in New Issue
Block a user