public void Multiply__Produces_Correct_Result(string a, string b, string c) { var(left, right) = Parse(a, b); Money18 .Multiply(left, right) .Should() .Be(c); }
public async Task <AmountConvertBySpendRuleResponse> GetAmountBySpendRuleAsync(Guid spendRuleId, Guid customerId, string from, string to, Money18 amount) { var conversionRate = await GetCurrencyRateBySpendRuleIdAsync(spendRuleId, customerId, from, to); return(new AmountConvertBySpendRuleResponse() { Amount = Money18.Multiply(amount, conversionRate.UsedRate), CurrencyCode = to, UsedRate = conversionRate.UsedRate, ConversionSource = ConversionSource.BurnRule, SpendRuleId = spendRuleId, CustomerId = customerId }); }
public async Task <OptimalAmountConvertResponse> ConvertOptimalByPartnerAsync(Guid partnerId, Guid customerId, string from, string to, Money18 amount) { var conversionRate = await GetOptimalCurrencyRateByPartnerAsync(partnerId, customerId, from, to); return(new OptimalAmountConvertResponse { Amount = Money18.Multiply(amount, conversionRate.UsedRate), ConversionSource = conversionRate.ConversionSource, CurrencyCode = to, UsedRate = conversionRate.UsedRate, SpendRuleId = conversionRate.SpendRuleId, CustomerId = customerId }); }
public async Task <AmountByConditionResponse> GetAmountConditionAsync(Guid conditionId, Guid customerId, string fromCurrency, string toCurrency, Money18 amount) { var conversionRate = await GetCurrencyRateByConditionIdAsync(conditionId, customerId, fromCurrency, toCurrency); return(new AmountByConditionResponse() { Amount = Money18.Multiply(amount, conversionRate.UsedRate), CurrencyCode = toCurrency, UsedRate = conversionRate.UsedRate, ConversionSource = ConversionSource.Condition, ConditionId = conditionId, CustomerId = customerId }); }