File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Source/Ecommerce.Domain/Common/ValueObjects Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -8,30 +8,30 @@ namespace Ecommerce.Domain.Common.ValueObjects;
88
99public sealed class Price : ValueObject
1010{
11- public decimal Value { get ; }
11+ public long ValueInCents { get ; }
1212
13- public static Price Empty => new ( decimal . Zero ) ;
13+ public static Price Empty => new ( 0 ) ;
1414
1515 public const Currency BASE_CURRENCY = Currency . ETB ;
1616
1717 private Price ( ) { }
1818
19- private Price ( decimal value )
19+ private Price ( long valueInCents )
2020 {
21- Value = value ;
21+ ValueInCents = valueInCents ;
2222 }
2323
2424 /// <summary>
2525 /// Create a new Price object. Make sure the value is in the <see cref="BASE_CURRENCY"/>.
2626 /// </summary>
2727 /// <param name="valueInBaseCurrency"></param>
2828 /// <returns></returns>
29- public static Price CreateInBaseCurrency ( decimal valueInBaseCurrency )
29+ public static Price CreateInBaseCurrency ( long valueInBaseCurrencyCents )
3030 {
31- return new ( valueInBaseCurrency ) ;
31+ return new ( valueInBaseCurrencyCents ) ;
3232 }
3333
34- public static implicit operator decimal ( Price price ) => price . Value ;
34+ public static implicit operator decimal ( Price price ) => price . ValueInCents ;
3535
3636 public static bool IsValidCurrency ( string currency )
3737 {
@@ -50,6 +50,6 @@ public static Result<Currency> ToCurrency(string currency)
5050
5151 public override IEnumerable < object > GetEqualityComponents ( )
5252 {
53- yield return Value ;
53+ yield return ValueInCents ;
5454 }
5555}
You can’t perform that action at this time.
0 commit comments