Skip to content

VCST-5104: Add OrderTotals#497

Merged
ksavosteev merged 8 commits into
devfrom
feat/VCST-5104
Jun 29, 2026
Merged

VCST-5104: Add OrderTotals#497
ksavosteev merged 8 commits into
devfrom
feat/VCST-5104

Conversation

@ksavosteev

@ksavosteev ksavosteev commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Description

References

QA-test:

Jira-link:

https://virtocommerce.atlassian.net/browse/VCST-5104

Artifact URL:

https://vc3prerelease.blob.core.windows.net/packages/VirtoCommerce.Orders_3.1010.0-pr-497-b4da.zip


Note

Medium Risk
Refactors order total calculation and rounding paths for multi-currency orders, which can change reported totals when items, shipments, or payments use different currencies.

Overview
Adds per-currency order totals so mixed-currency orders expose subtotal, tax, discount, and grand total for each currency involved, not only the order’s primary currency.

A new OrderTotal model and CustomerOrder.OrderTotals collection are populated when totals are calculated. DefaultCustomerOrderTotalsCalculator now groups line items, shipments, and payments by currency, runs the existing rollup/rounding logic per currency (using each currency’s rounding policy), and maps the results into OrderTotals. The primary-currency entry still updates the main order’s scalar total fields. API surface includes WithOrderTotals on CustomerOrderResponseGroup, with ReduceDetails, Clone, and price stripping handling the new collection.

The admin customer order items blade shows a currency column, extra summary rows for non-primary orderTotals, a wider layout, and localized currency labels. Unit tests set explicit Currency on test data to match the new calculation paths.

Reviewed by Cursor Bugbot for commit b4dae47. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.tpl.html Outdated
</div>
<div class="order-items-summary__item __total">
<span class="order-items-summary__value">{{ orderTotal.total | currency:orderTotal.currencyCode | showPrice:blade.isVisiblePrices}}</span>
</div>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternate currency summary mismatch

Medium Severity

The extra-currency summary on the items blade binds orderTotal.discountTotal, orderTotal.taxTotal, and orderTotal.total, while the primary summary uses item-scoped fields (subTotalDiscount, subTotalTaxTotal, and net item total). Those OrderTotal values are order-wide per currency, so alternate-currency rows can show shipping, payment, and fee-inclusive totals that do not match the labeled item subtotal row above.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c081dee. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8425793. Configure here.

{
item.ReduceDetails(responseGroup);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RestoreDetails skips OrderTotals

Low Severity

RestoreDetails copies scalar price fields from the persisted order when the caller lacks price-read permission, but it does not restore OrderTotals, which this PR adds and clears in ReduceDetails when prices or order totals are omitted from the response group.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 8425793. Configure here.

@sonarqubecloud

Copy link
Copy Markdown

@ksavosteev ksavosteev merged commit 38d579d into dev Jun 29, 2026
9 checks passed
@ksavosteev ksavosteev deleted the feat/VCST-5104 branch June 29, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant