();
}
public void PostInitialize(IApplicationBuilder appBuilder)
diff --git a/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.js b/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.js
index e314473af..7ac11b4a1 100644
--- a/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.js
+++ b/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.js
@@ -11,6 +11,24 @@ angular.module('virtoCommerce.coreModule.currency')
blade.metafields = blade.metafields ? blade.metafields : metaFormsService.getMetaFields('currencyDetail');
+ blade.roundingTypes = [
+ 'Rounding001',
+ 'Rounding005Up',
+ 'Rounding005Down',
+ 'Rounding01Up',
+ 'Rounding01Down',
+ 'Rounding05',
+ 'Rounding1',
+ 'Rounding1Up'
+ ];
+ blade.midpointRoundings = [
+ 'ToEven',
+ 'AwayFromZero',
+ 'ToZero',
+ 'ToNegativeInfinity',
+ 'ToPositiveInfinity'
+ ];
+
$scope.saveChanges = function () {
blade.isLoading = true;
@@ -37,7 +55,7 @@ angular.module('virtoCommerce.coreModule.currency')
function initializeBlade(data) {
if (blade.isNew) data = { exchangeRate: 1.00 };
-
+
blade.currentEntity = angular.copy(data);
blade.origEntity = data;
blade.isLoading = false;
diff --git a/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.tpl.html b/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.tpl.html
index b17bc257e..21e69fc9e 100644
--- a/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.tpl.html
+++ b/src/VirtoCommerce.CoreModule.Web/Scripts/currency/blades/currency-detail.tpl.html
@@ -50,4 +50,27 @@
{{ 'core.blades.currency-detail.descriptions.custom-formatting' | translate }}
-
\ No newline at end of file
+
+
+
+
diff --git a/src/VirtoCommerce.CoreModule.Web/Scripts/virtoCommerce-core.js b/src/VirtoCommerce.CoreModule.Web/Scripts/virtoCommerce-core.js
index fb562aa72..250c0f562 100644
--- a/src/VirtoCommerce.CoreModule.Web/Scripts/virtoCommerce-core.js
+++ b/src/VirtoCommerce.CoreModule.Web/Scripts/virtoCommerce-core.js
@@ -43,6 +43,16 @@ angular.module(moduleName, [
name: 'customFormatting',
title: 'core.blades.currency-detail.labels.custom-formatting',
templateUrl: 'currencyDetail-customFormatting.html'
+ },
+ {
+ name: 'midpointRounding',
+ title: 'core.blades.currency-detail.labels.midpoint-rounding',
+ templateUrl: 'currencyDetail-midpointRounding.html'
+ },
+ {
+ name: 'roundingType',
+ title: 'core.blades.currency-detail.labels.rounding-type',
+ templateUrl: 'currencyDetail-roundingType.html'
}
]);
}]);
diff --git a/tests/VirtoCommerce.CoreModule.Tests/DefaultMoneyRoundingPolicyTests.cs b/tests/VirtoCommerce.CoreModule.Tests/DefaultMoneyRoundingPolicyTests.cs
new file mode 100644
index 000000000..e1d2d313d
--- /dev/null
+++ b/tests/VirtoCommerce.CoreModule.Tests/DefaultMoneyRoundingPolicyTests.cs
@@ -0,0 +1,88 @@
+using System;
+using System.Collections.Generic;
+using VirtoCommerce.CoreModule.Core.Currency;
+using VirtoCommerce.CoreModule.Core.Enums;
+using Xunit;
+
+namespace VirtoCommerce.CoreModule.Tests
+{
+ public class DefaultMoneyRoundingPolicyTests
+ {
+ [Theory]
+ [MemberData(nameof(Data))]
+ public void CanRound(decimal amount, decimal expected, RoundingType roundingType, MidpointRounding midpointRounding)
+ {
+ // Arrange
+ var roundPolicy = new DefaultMoneyRoundingPolicy();
+ var currency = new Currency();
+ currency.RoundingType = roundingType.ToString();
+ currency.MidpointRounding = midpointRounding.ToString();
+
+ // Act
+ var result = roundPolicy.RoundMoney(amount, currency);
+
+ // Assert
+ Assert.Equal(expected, result);
+ }
+
+ public static IEnumerable