public PaymentDto BuildPaymentDto(PaymentResultVm paymentResultVm, OneOffPaymentDto oneOffPaymentDto) { var dto = new PaymentDto() { PlanInPlace = paymentResultVm.PaymentInfo.PlanInPlace, SettlementAmount = paymentResultVm.PaymentInfo.DiscountSelected && paymentResultVm.PaymentInfo.PaidInFull, LowellReference = oneOffPaymentDto.LowellReference, AuthCode = paymentResultVm.ACode, Amount = oneOffPaymentDto.PaymentAmount, SourceOfFunds = oneOffPaymentDto.SourceOfFunds + ":" + oneOffPaymentDto.SourceOfFundsOther, CardId = "", ReplayId = null, User = String.IsNullOrEmpty(paymentResultVm.PaymentInfo.UserID) ? "WebAnon" : "WebUser" }; return(dto); }
public void BuildPaymentDto_MapsAsExpected( bool testPlanInPlace, bool testDiscountSelected, bool testPaidInFull, bool expectedPlanInPlace, bool expectedSettlementAmount) { //Arrange var paymentResultVm = new PaymentResultVm() { ACode = "blah", PaymentInfo = new OneOffPaymentDto() { PlanInPlace = testPlanInPlace, DiscountSelected = testDiscountSelected, PaidInFull = testPaidInFull, UserID = "Testing..." } }; var oneOffPaymentDto = new OneOffPaymentDto() { LowellReference = "This", PaymentAmount = 12, SourceOfFunds = "A", SourceOfFundsOther = "Test" }; //Act var paymentDto = _buildPaymentDtoProcess.BuildPaymentDto(paymentResultVm, oneOffPaymentDto); //Assert Assert.AreEqual(expectedPlanInPlace, paymentDto.PlanInPlace); Assert.AreEqual(expectedSettlementAmount, paymentDto.SettlementAmount); Assert.AreEqual("This", paymentDto.LowellReference); Assert.AreEqual("blah", paymentDto.AuthCode); Assert.AreEqual(12, paymentDto.Amount); Assert.AreEqual("A:Test", paymentDto.SourceOfFunds); Assert.AreEqual("", paymentDto.CardId); Assert.AreEqual(null, paymentDto.ReplayId); Assert.AreEqual("WebUser", paymentDto.User); }
public async Task MakePayment(PaymentResultVm model, OneOffPaymentDto oneOffPaymentDto) { var dto = _buildPaymentDtoProcess.BuildPaymentDto(model, oneOffPaymentDto); await _sendPaymentProcss.SendPayment(dto); }