public void CalculateRemainingSumTest() { var servicePayment = new ServicePayment(); var clients = GenerateClients(2); var spaces = GenerateParkingSpaces(2); var sum = servicePayment.CalculateRemainingSum(clients, spaces); Assert.AreEqual(4.0d, sum); }
public async Task <ServicePayment> RequestApplicationPaymentAsync(Application application, decimal?filedAmount) { decimal?serviceFee, obligationAmount; var serviceType = NomenclaturesProvider.GetApplicationServiceTypes().Single(t => t.ApplicationTypeID == application.ApplicationTypeID); if (serviceType.IsFree) { serviceFee = obligationAmount = 0m; } else { if (serviceType.PaymentAmount.HasValue) { serviceFee = obligationAmount = serviceType.PaymentAmount.Value; } else { serviceFee = 0m; obligationAmount = filedAmount.Value; } } var paymentResponse = serviceType.PaymentAfterRegistration ? await PaymentIntegrationClient.InitiateServiceApplicationAsync(new ServiceRequest { ServiceFee = serviceFee.Value }) : await PaymentIntegrationClient.InitiatePaymentAsync(new PaymentRequest() { PaymentFor = application.ApplicationIdentifier, ServiceFee = serviceFee.Value, ObligationAmount = obligationAmount.Value }); var applPayment = new ServicePayment() { ServiceInstanceID = application.ApplicationID, ServiceFee = serviceFee.Value, ObligationAmount = obligationAmount.Value }; if (paymentResponse.Successfull) { applPayment.Status = PaymentStatuses.Ordered; applPayment.PaymentIdentifier = paymentResponse.PaymentIdentifier; if (serviceType.PaymentDeadline.HasValue) { applPayment.PaymentDeadline = DateTime.Now.Add(serviceType.PaymentDeadline.Value); // как се определя? } } else { applPayment.Status = PaymentStatuses.Error; applPayment.ErrorDescription = paymentResponse.Errors; } return(applPayment); }
public Clients() { ClientList = new List<Client>(); IsFirstCall = true; _service = new ServiceRestrictions(); _servicePay = new ServicePayment(); _statistics.Add("premiumSum" , 0); _statistics.Add("regularSum", 0); _statistics.Add("clientsCount", 0); }
public void AddCheckTest() { var dict = new Dictionary<string, double> { {"premiumSum", 0.0f}, {"regularSum", 0.0f}, {"clientsCount", 0} }; var servicePayment = new ServicePayment(); servicePayment.AddCheck(new Client { DepartureTime = DateTime.Now, EntryTime = DateTime.Now, Id = 1},dict ); Assert.AreEqual(1.0d, dict["clientsCount"]); }
public void CreateServicePayment(ServicePayment paymentRequest) { throw new NotImplementedException(); }
public void SavePaymentRequest(ServicePayment paymentRequest) { paymentRequest.PaymentRequestID = 1000; }