public BookingAvailabilityInfo(string accommodationId, string accommodationName, AccommodationInfo accommodationInfo, RoomContractSet roomContractSet, string zoneName, string localityName, string countryName, string countryCode, string address, GeoPoint coordinates, DateTime checkInDate, DateTime checkOutDate, int numberOfNights, int supplier, List <AppliedMarkup> appliedMarkups, MoneyAmount convertedSupplierPrice, MoneyAmount originalSupplierPrice, string availabilityId, string htId, List <PaymentTypes> availablePaymentTypes, bool isDirectContract, Deadline agentDeadline, Deadline supplierDeadline, CreditCardRequirement?cardRequirement, AvailabilityRequest availabilityRequest) { AccommodationId = accommodationId; AccommodationName = accommodationName; AccommodationInfo = accommodationInfo; RoomContractSet = roomContractSet; ZoneName = zoneName; LocalityName = localityName; CountryName = countryName; CountryCode = countryCode; Address = address; Coordinates = coordinates; CheckInDate = checkInDate; CheckOutDate = checkOutDate; NumberOfNights = numberOfNights; Supplier = supplier; AppliedMarkups = appliedMarkups; ConvertedSupplierPrice = convertedSupplierPrice; OriginalSupplierPrice = originalSupplierPrice; AvailabilityId = availabilityId; HtId = htId; AvailablePaymentTypes = availablePaymentTypes; IsDirectContract = isDirectContract; AgentDeadline = agentDeadline; SupplierDeadline = supplierDeadline; CardRequirement = cardRequirement; AvailabilityRequest = availabilityRequest; }
public async Task UpdateAmount(int id, decimal amount) { Statement dbStatement = await statementRepository.Get(id); dbStatement.UpdateAmount(MoneyAmount.Create(amount)); await statementRepository.Save(dbStatement); }
public async ValueTask <PriceProcessFunction> Get(MarkupPolicy policy, MarkupSubjectInfo subject) { // Discounts are only supported for global markups for now if (policy.SubjectScopeType != SubjectMarkupScopeTypes.Global) { return(price => new ValueTask <MoneyAmount>(price)); } return(moneyAmount => { var currentAmount = moneyAmount; foreach (var discount in GetAgentDiscounts()) { currentAmount = new MoneyAmount { Amount = currentAmount.Amount * (100 - discount.DiscountPercent) / 100, Currency = currentAmount.Currency }; } return new ValueTask <MoneyAmount>(currentAmount); }); List <Discount> GetAgentDiscounts() => _discountStorage.Get(d => d.TargetPolicyId == policy.Id && d.TargetAgencyId == subject.AgencyId && d.IsActive); }
public async Task <Result <CreditCardVoidResult> > Void(CreditCardVoidMoneyRequest request, CreditCardPaymentInfo paymentInfo, string maskedNumber, MoneyAmount moneyAmount, string referenceCode, UserInfo user, int agentId) { return(await VoidInPayfort() .Tap(WriteAuditLog)); Task <Result <CreditCardVoidResult> > VoidInPayfort() => _payfortService.Void(request); Task WriteAuditLog(CreditCardVoidResult voidResult) { var eventData = new CreditCardLogEventData($"Void money for the payment '{referenceCode}'", voidResult.ExternalCode, voidResult.Message, paymentInfo.InternalReferenceCode); return(_creditCardAuditService.Write(CreditCardEventType.Void, maskedNumber, moneyAmount.Amount, user, eventData, referenceCode, agentId, moneyAmount.Currency)); } }
public InternalSlimCancellationPolicies(DateTime fromDate, DateTime toDate, MoneyAmount penaltyAmount, double percent) { FromDate = fromDate; ToDate = toDate; PenaltyAmount = penaltyAmount; Percent = percent; }
public async Task Add(string referenceCode, ServiceTypes serviceType, MoneyAmount convertedSupplierPrice, MoneyAmount originalSupplierPrice, Deadline deadline, int supplier, SupplierPaymentType paymentType, DateTime paymentDate) { var now = _dateTimeProvider.UtcNow(); var supplierOrder = new SupplierOrder { Created = now, Modified = now, ConvertedPrice = convertedSupplierPrice.Amount, ConvertedCurrency = convertedSupplierPrice.Currency, Price = originalSupplierPrice.Amount, Currency = originalSupplierPrice.Currency, RefundableAmount = 0, State = SupplierOrderState.Created, Supplier = supplier, Type = serviceType, ReferenceCode = referenceCode, Deadline = deadline, PaymentDate = paymentDate, PaymentType = paymentType }; _context.SupplierOrders.Add(supplierOrder); await _context.SaveChangesAsync(); _context.Detach(supplierOrder); }
public PaymentDetails(MoneyAmount totalAmount, Discount discount, List <SeasonPriceDetails> seasonPrices, List <string> remarks) { TotalAmount = totalAmount; Discount = discount; SeasonPrices = seasonPrices; Remarks = remarks; }
/// <summary> /// Deactivates a policy /// </summary> /// <param name="mCost">Cost of the deactivation in money (relative)</param> /// <param name="gCost">Cost of the deactivation in glory (relative)</param> internal void Deactivate(out int mCost, out int gCost) { mCost = MoneyAmount.GetValueOrDefault(0); gCost = GloryAmount.GetValueOrDefault(0); actualValue = minValue; Active = false; }
public DataWithMarkup(TData data, List <AppliedMarkup> appliedMarkups, MoneyAmount convertedSupplierPrice, MoneyAmount originalSupplierPrice) { Data = data; AppliedMarkups = appliedMarkups; ConvertedSupplierPrice = convertedSupplierPrice; OriginalSupplierPrice = originalSupplierPrice; }
/// <summary> /// Computes a full description of the value /// </summary> /// <returns>A long description</returns> public string CompletePresentation() { string pres = "==" + Name + "=="; pres += Environment.NewLine; pres += Description + Environment.NewLine; pres += "Valeur : <" + minValue + " :" + Value + ": " + maxValue + ">" + Environment.NewLine; if (MoneyAmount.HasValue && MoneyAmount.GetValueOrDefault(0) < 0) { pres += "Coûte " + MoneyImpacted + " pièces d'or par tour" + Environment.NewLine; } if (MoneyAmount.HasValue && MoneyAmount.GetValueOrDefault(0) > 0) { pres += "Rapporte " + MoneyImpacted + " pièces d'or par tour" + Environment.NewLine; } if (GloryAmount.HasValue && GloryAmount.GetValueOrDefault(0) < 0) { pres += "Coûte " + Math.Abs(GloryAmount.Value) + " gloire" + Environment.NewLine; } if (GloryAmount.HasValue && GloryAmount.GetValueOrDefault(0) > 0) { pres += "Rapporte " + GloryImpacted + " gloire par tour" + Environment.NewLine; } pres += "Actuellement " + ((Active != false) ? "en action" : "hors action"); return(pres); }
public PaymentDetails(MoneyAmount totalAmount, Discount discount, List <string> remarks = null) { TotalAmount = totalAmount; Discount = discount; remarks ??= new List <string>(0); Remarks = remarks; }
public SeasonDailyPrice(DateTime fromDate, DateTime toDate, MoneyAmount dailyAmount, MoneyAmount dailyAmountWithDiscount, Discount discount) { DailyAmount = dailyAmount; DailyAmountWithDiscount = dailyAmountWithDiscount; FromDate = fromDate; ToDate = toDate; Discount = discount; }
public void WhenThreeDigitPenniesSet_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(852); var result = sut.FormattedPoundsAndPenceNoSign; Assert.AreEqual("£8.52", result); }
public void WhenTwoDigitPenniesSet_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(85); var result = sut.FormattedPoundsAndPenceNoComma; Assert.That(result, Is.EqualTo("£0.85")); }
public void WhenNegativePennies_ShouldReturnNegativePoundsAndPence() { var sut = new MoneyAmount(-12345); var result = sut.PoundsAndPennies; Assert.AreEqual(-123.45M, result); }
public void WhenOneHundredAndElevenPennies_ShouldReturnOnePoundElevenPennies() { var sut = new MoneyAmount(111); var result = sut.PoundsAndPennies; Assert.AreEqual(1.11M, result); }
public void WhenMaxPennies_ShouldReturnAsPoundsAndPence() { var sut = new MoneyAmount(2147483647); var result = sut.PoundsAndPennies; Assert.AreEqual(21474836.47M, result); }
public void WhenNegativePenniesSet_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(-852); var result = sut.FormattedPoundsAndPenceNoComma; Assert.That(result, Is.EqualTo("-£8.52")); }
public void WhenOneThousandPounds_ShouldReturnFormattedWithNoComma() { var sut = new MoneyAmount(100000); var result = sut.FormattedPoundsAndPenceNoComma; Assert.That(result, Is.EqualTo("£1000.00")); }
public void WhenZeroPennies_ShouldReturnZero() { var sut = new MoneyAmount(0); var result = sut.PoundsAndPennies; Assert.AreEqual(0, result); }
public void Update(MoneyAmount budgetedAmount, MoneyAmount transactionsTotal, MoneyAmount allocationsTotal) { UpdateTime = DateTime.Now; BudgetedAmount = budgetedAmount; TransactionsTotal = transactionsTotal; AllocationsTotal = allocationsTotal; }
public void WhenPenniesIsMaxInt_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(2147483647); var result = sut.FormattedPoundsAndPenceNoSign; Assert.AreEqual("£21,474,836.47", result); }
private static void TestRefundBill_Assert(string refundId, MoneyAmount moneyAmount, RefundResponse refundResponse) { Assert.AreEqual(refundId, refundResponse.RefundId, "Same refund id"); Assert.AreEqual(moneyAmount.ValueDecimal, refundResponse.Amount.ValueDecimal, "Same amount value"); Assert.AreEqual(moneyAmount.CurrencyEnum, refundResponse.Amount.CurrencyEnum, "Same currency value"); Assert.AreEqual(RefundStatusEnum.Partial, refundResponse.StatusEnum, "Status preset"); }
public void WhenNegativePenniesSet_ShouldReturnFormattedPoundsAndPenceWithoutSign() { var sut = new MoneyAmount(-852); var result = sut.FormattedPoundsAndPenceNoSign; Assert.AreEqual("£8.52", result); }
public void WhenZeroPennies_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(0); var result = sut.FormattedPoundsAndPence; Assert.That(result, Is.EqualTo("£0.00")); }
public void WhenOneThousandPounds_ShouldAddCommaToFormattedString() { var sut = new MoneyAmount(100000); var result = sut.FormattedPoundsAndPenceNoSign; Assert.AreEqual("£1,000.00", result); }
public void WhenPenniesIsMaxInt_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(2147483647); var result = sut.FormattedPoundsAndPence; Assert.That(result, Is.EqualTo("£21,474,836.47")); }
public CancellationPolicyDetails(DateTime fromDate, DateTime toDate, MoneyAmount penaltyAmount, double percent, string?description = null) { FromDate = fromDate; ToDate = toDate; PenaltyAmount = penaltyAmount; Description = description ?? string.Empty; Percent = percent; }
public void WhenThreeDigitPenniesSet_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(852); var result = sut.FormattedPoundsAndPence; Assert.That(result, Is.EqualTo("£8.52")); }
public void WhenZeroPennies_ShouldReturnFormattedPoundsAndPence() { var sut = new MoneyAmount(0); var result = sut.FormattedPoundsAndPenceNoSign; Assert.AreEqual("£0.00", result); }