Skip to content

Commit 445d27d

Browse files
Merge pull request #275 from bcgov/UpdateLast45dayRuleforNextTerm
Update the payment rule for applying next term in advance
2 parents f021610 + aa8c1a2 commit 445d27d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

OFM.Infrastructure.WebAPI/Services/Processes/Payments/P520GenerateAllowancePaymentProvider.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private async Task<JsonObject> ProcessTransportationPayments(Application baseApp
413413
{
414414
if (approvedSA.ofm_allowance_type == ecc_allowance_type.Transportation)
415415
{
416-
if (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value,firstAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value))
416+
if ((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value,firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3))
417417

418418
{
419419
int retroActiveMonthsCount = approvedSA.ofm_retroactive_date!.HasValue ? (approvedSA.ofm_start_date.Value.Year - approvedSA.ofm_retroactive_date!.Value.Year) * 12 + approvedSA.ofm_start_date.Value.Month - approvedSA.ofm_retroactive_date.Value.Month : 0;
@@ -490,21 +490,21 @@ private async Task<JsonObject> CreateSinglePayment(SupplementaryApplication appr
490490
DateTime effectiveDate = invoiceDate;
491491
//this applies if supplementary application is submitted within last 45 days to last 30 days.
492492

493-
if ((CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
493+
if (((CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
494494
{
495495
invoiceReceivedDate = paymentDate.GetFirstDayOfFollowingNextMonth(holidaysList);
496496
invoiceDate = invoiceReceivedDate.GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
497497
effectiveDate = invoiceDate;
498498
}
499-
else if ((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
499+
else if (((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
500500
{
501501
invoiceReceivedDate = paymentDate.GetFirstDayOfFollowingMonth(holidaysList);
502502
invoiceDate = invoiceReceivedDate.GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
503503
effectiveDate = invoiceDate;
504504
}
505505

506506

507-
if (approvedSA.ofm_retroactive_date is not null && !(CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
507+
if (approvedSA.ofm_retroactive_date is not null && !((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
508508
{
509509
// Date calculation logic is different for mid-year supp application. Overriding regular date logic above
510510
// Invoice received date is always the last business date of previous month except for first payment of the First funding year, it is 5 business day after the last business day of the last month.
@@ -570,20 +570,20 @@ private async Task<JsonObject> CreatePaymentsInBatch(Application baseApplication
570570
DateTime effectiveDate = invoiceDate;
571571

572572
//this applies if supplementary application is submitted within 45 days.
573-
if ((CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
573+
if (((CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLastMonth(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
574574
{
575575
invoiceReceivedDate = paymentDate.GetFirstDayOfFollowingNextMonth(holidaysList);
576576
invoiceDate = invoiceReceivedDate.GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
577577
effectiveDate = invoiceDate;
578-
}else if ((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
578+
}else if (((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
579579
{
580580
invoiceReceivedDate = paymentDate.GetFirstDayOfFollowingMonth(holidaysList);
581581
invoiceDate = invoiceReceivedDate.GetCFSInvoiceDate(holidaysList, _BCCASApi.PayableInDays);
582582
effectiveDate = invoiceDate;
583583
}
584584

585585

586-
if (approvedSA.ofm_retroactive_date is not null && !(CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) || CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value)))
586+
if (approvedSA.ofm_retroactive_date is not null && !((CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, firstAnniversaryDate) && approvedSA.ofm_renewal_term == 1) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, secondAnniversaryDate) && approvedSA.ofm_renewal_term == 2) || (CheckSubmissionIsWithinLast45days(approvedSA.ofm_submittedon.Value, fundingEndDate.Value) && approvedSA.ofm_renewal_term == 3)))
587587
{
588588
// Date calculation logic is different for mid-year supp application. Overriding regular date logic above
589589
// Invoice received date is always the last business date of previous month except for first payment of the First funding year, it is 5 business day after the last business day of the last month.

0 commit comments

Comments
 (0)