Skip to content

Commit

Permalink
Merge branch 'release/3.813.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
vc-ci committed Nov 22, 2024
2 parents 79f2941 + cc196dd commit 5811e81
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.812.0</VersionPrefix>
<VersionPrefix>3.813.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public decimal RoundMoney(decimal amount, Currency currency)
{
var roundingType = EnumUtility.SafeParse(currency.RoundingType, RoundingType.Rounding001);
var midpointRounding = EnumUtility.SafeParse(currency.MidpointRounding, MidpointRounding.AwayFromZero);
return Round(amount, currency.NumberFormat.NumberDecimalDigits, roundingType, midpointRounding);
return Round(amount, currency.NumberFormat.CurrencyDecimalDigits, roundingType, midpointRounding);
}

/// <summary>
Expand Down
5 changes: 3 additions & 2 deletions src/VirtoCommerce.CoreModule.Core/Currency/Money.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,12 @@ public decimal TruncatedAmount
public static Money operator -(Money first, Money second)
=> new Money(first.InternalAmount - second.ConvertTo(first.Currency).InternalAmount, first.Currency);

[Obsolete("Multiplying Money by Money makes no sense", DiagnosticId = "VC0009", UrlFormat = "https://docs.virtocommerce.org/products/products-virto3-versions/")]
public static Money operator *(Money first, Money second)
=> new Money(first.InternalAmount * second.ConvertTo(first.Currency).InternalAmount, first.Currency);

public static Money operator /(Money first, Money second)
=> new Money(first.InternalAmount / second.ConvertTo(first.Currency).InternalAmount, first.Currency);
public static decimal operator /(Money first, Money second)
=> first.InternalAmount / second.ConvertTo(first.Currency).InternalAmount;

public static bool operator ==(Money money, long value) => !(money is null) && money.InternalAmount == value;

Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.CoreModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.Core</id>
<version>3.812.0</version>
<version>3.813.0</version>
<version-tag />
<platformVersion>3.853.0</platformVersion>
<title>Commerce core module</title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using VirtoCommerce.CoreModule.Core.Common;
using VirtoCommerce.CoreModule.Core.Currency;
using VirtoCommerce.CoreModule.Core.Enums;
using Xunit;
Expand All @@ -14,7 +15,7 @@ public void CanRound(decimal amount, decimal expected, RoundingType roundingType
{
// Arrange
var roundPolicy = new DefaultMoneyRoundingPolicy();
var currency = new Currency();
var currency = new Currency(new Language("en-US"), code: null);
currency.RoundingType = roundingType.ToString();
currency.MidpointRounding = midpointRounding.ToString();

Expand Down

0 comments on commit 5811e81

Please sign in to comment.