feat: update institution plan calculator to use total amount directly and remove workshop list parameter
This commit is contained in:
@@ -67,13 +67,13 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// و هنوز در دیتابیس ثبت نشده اند
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="workshopList"></param>
|
||||
/// <param name="totalPaymentMonth"></param>
|
||||
/// <param name="duration"></param>
|
||||
/// <param name="paymentModel"></param>
|
||||
/// <param name="contractStartType"></param>
|
||||
/// <param name="paymentModel"></param>
|
||||
/// <returns></returns>
|
||||
Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
List<WorkshopTempViewModel> workshopList,
|
||||
double totalPaymentMonth,
|
||||
InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth");
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -514,18 +514,19 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
}
|
||||
|
||||
public async Task<ReviewAndPaymentViewModel> GetTotalPaymentAndWorkshopList(long contractingPartyTempId,
|
||||
List<WorkshopTempViewModel> workshops, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth")
|
||||
double totalPaymentMonth, InstitutionContractDuration duration = InstitutionContractDuration.TwelveMonths, string contractStartType = "currentMonth")
|
||||
{
|
||||
//دریافت کارگاه ها
|
||||
|
||||
double totalPayment1MonthDouble = 0;
|
||||
|
||||
//بدست آوردن جمع کل برای یک ماه
|
||||
foreach (var workshop in workshops)
|
||||
{
|
||||
totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
|
||||
}
|
||||
// //بدست آوردن جمع کل برای یک ماه
|
||||
// foreach (var workshop in workshops)
|
||||
// {
|
||||
// totalPayment1MonthDouble += workshop.WorkshopServicesAmount;
|
||||
// }
|
||||
|
||||
totalPayment1MonthDouble = totalPaymentMonth;
|
||||
if (totalPayment1MonthDouble == 0)
|
||||
return new ReviewAndPaymentViewModel();
|
||||
|
||||
|
||||
@@ -609,8 +609,7 @@ public class institutionContractController : AdminBaseController
|
||||
public async Task<ActionResult<InstitutionPlanCalculatorResponse>> InstitutionPlanCalculator(
|
||||
[FromBody] InstitutionPlanCalculatorRequest request)
|
||||
{
|
||||
var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(0,
|
||||
request.workshopList, contractStartType: request.ContractStartType,duration:request.Duration);
|
||||
var res = await _temporaryClientRegistration.GetTotalPaymentAndWorkshopList(0, request.TotalAmountMonth,duration: request.Duration, contractStartType: request.ContractStartType);
|
||||
var response = new InstitutionPlanCalculatorResponse
|
||||
{
|
||||
Installments = res.MonthlyInstallments,
|
||||
@@ -680,7 +679,7 @@ public class WorkshopServiceCalculatorResponse
|
||||
public string TotalAmount { get; set; }
|
||||
}
|
||||
|
||||
public record InstitutionPlanCalculatorRequest(List<WorkshopTempViewModel> workshopList,
|
||||
public record InstitutionPlanCalculatorRequest(double TotalAmountMonth,
|
||||
InstitutionContractDuration Duration = InstitutionContractDuration.TwelveMonths,
|
||||
string PaymentModel = "OneTime",
|
||||
string ContractStartType = "currentMonth");
|
||||
|
||||
Reference in New Issue
Block a user