feat: added totals tests for end 2 end RMA flow (#8906)
what: I've added some specs and comments in the specs for where I think totals are incorrect. Lets get this test merged in as the status quo and proceed to fix these issues one by one. Additionally, this also removes the temporary_difference as its not something we use. RESOLVES CC-346 Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
@@ -4,7 +4,6 @@ import { setActionReference } from "../set-action-reference"
|
||||
|
||||
OrderChangeProcessing.registerActionType(ChangeActionType.RETURN_ITEM, {
|
||||
isDeduction: true,
|
||||
awaitRequired: true,
|
||||
operation({ action, currentOrder, options }) {
|
||||
const existing = currentOrder.items.find(
|
||||
(item) => item.id === action.details.reference_id
|
||||
|
||||
@@ -71,7 +71,6 @@ export class OrderChangeProcessing {
|
||||
transformPropertiesToBigNumber(this.order.metadata)
|
||||
|
||||
this.summary = {
|
||||
temporary_difference: 0,
|
||||
pending_difference: 0,
|
||||
difference_sum: 0,
|
||||
current_order_total: this.order.total ?? 0,
|
||||
@@ -121,13 +120,6 @@ export class OrderChangeProcessing {
|
||||
)
|
||||
}
|
||||
|
||||
if (type.awaitRequired) {
|
||||
summary.temporary_difference = MathBN.add(
|
||||
summary.temporary_difference,
|
||||
amount
|
||||
)
|
||||
}
|
||||
|
||||
if (!this.isEventDone(action) && !action.change_id) {
|
||||
summary.difference_sum = MathBN.add(summary.difference_sum, amount)
|
||||
}
|
||||
@@ -145,11 +137,6 @@ export class OrderChangeProcessing {
|
||||
...this.transactions.map((tr) => tr.amount)
|
||||
)
|
||||
|
||||
summary.temporary_difference = MathBN.sub(
|
||||
summary.difference_sum,
|
||||
summary.temporary_difference
|
||||
)
|
||||
|
||||
summary.pending_difference = MathBN.sub(
|
||||
summary.current_order_total,
|
||||
summary.transaction_total
|
||||
@@ -208,7 +195,6 @@ export class OrderChangeProcessing {
|
||||
transaction_total: new BigNumber(summary.transaction_total),
|
||||
original_order_total: new BigNumber(summary.original_order_total),
|
||||
current_order_total: new BigNumber(summary.current_order_total),
|
||||
temporary_difference: new BigNumber(summary.temporary_difference),
|
||||
pending_difference: new BigNumber(summary.pending_difference),
|
||||
difference_sum: new BigNumber(summary.difference_sum),
|
||||
paid_total: new BigNumber(summary.paid_total),
|
||||
|
||||
Reference in New Issue
Block a user