Skip to content

Commit fcff156

Browse files
authored
Merge pull request #327 from bcgov/OFMCC-7019-Renewal-Reminders-Notifications
Added a new Parameter for creating reminders for existing fundings
2 parents 52b729b + d4b3fc9 commit fcff156

File tree

2 files changed

+54
-2
lines changed

2 files changed

+54
-2
lines changed

OFM.Infrastructure.WebAPI/Services/Processes/Emails/P255CreateRenewalNotificationProvider.cs

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,48 @@ private string RetrieveActiveFundings
7676
}
7777
}
7878

79+
private string RetrieveAllActiveFundings
80+
{
81+
get
82+
{
83+
var fetchXml = $"""
84+
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
85+
<entity name="ofm_funding">
86+
<attribute name="createdon" />
87+
<attribute name="ofm_application" />
88+
<attribute name="ofm_fundingid" />
89+
<attribute name="ofm_end_date" />
90+
<attribute name="ofm_start_date" />
91+
<attribute name="ofm_ministry_approval_date" />
92+
<filter>
93+
<condition attribute="ofm_application" operator="not-null" />
94+
<condition attribute="ofm_end_date" operator="not-null" />
95+
<condition attribute="statuscode" operator="eq" value="8" />
96+
<condition attribute="statecode" operator="eq" value="0" />
97+
</filter>
98+
<link-entity name="ofm_application" from="ofm_applicationid" to="ofm_application" link-type="inner" alias="ofmapp">
99+
<filter>
100+
<condition attribute="ofm_application_type" operator="eq" value="1" />
101+
102+
</filter>
103+
</link-entity>
104+
</entity>
105+
</fetch>
106+
""";
107+
79108

109+
//all funding which are approved in last 1 day and are active in the system
110+
var requestUri = $"""
111+
ofm_fundings?$select=createdon,_ofm_application_value,ofm_fundingid,ofm_end_date,ofm_start_date,ofm_ministry_approval_date&$filter=(ofm_ministry_approval_date ne null and _ofm_application_value ne null and ofm_end_date ne null and statuscode eq 8 and statecode eq 0 and ofm_application/ofm_application_type eq 1)
112+
""";
113+
114+
//For testing in DEV
115+
//var requestUri = $"""
116+
// ofm_fundings?$select=createdon,_ofm_application_value,ofm_fundingid,ofm_end_date,ofm_start_date,ofm_ministry_approval_date&$filter=_ofm_application_value ne null and ofm_end_date ne null and statuscode eq 8 and ofm_application/ofm_application_type eq 1
117+
// """;
118+
return requestUri.CleanCRLF();
119+
}
120+
}
80121
public async Task<ProcessData> GetDataAsync()
81122
{
82123
_logger.LogDebug(CustomLogEvent.Process, "Calling SendRetrieveRequestAsync");
@@ -147,8 +188,15 @@ public async Task<JsonObject> RunProcessAsync(ID365AppUserService appUserService
147188
var startTime = _timeProvider.GetTimestamp();
148189

149190
#region step 1: get Funding applications approved today
150-
var fundingData = await GetDataAsync();
151-
191+
ProcessData? fundingData = null;
192+
if (_processParams?.CreateExistingFundingReminders == true)
193+
{
194+
fundingData = await GetReminderDataAsync(RetrieveAllActiveFundings);
195+
}
196+
else
197+
{
198+
fundingData = await GetDataAsync();
199+
}
152200
if (String.IsNullOrEmpty(fundingData.Data.ToString()))
153201
{
154202
return ProcessResult.Failure(ProcessId, new String[] { "Failed to query records" }, 0, 0).SimpleProcessResult;

OFM.Infrastructure.WebAPI/Services/Processes/ProcessParameter.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ public record ProcessParameter
7070
[property: JsonPropertyName("dataImportId")]
7171
public Guid? DataImportId { get; set; }
7272

73+
//created for P255 Create renewal reminders for Existing Fundings
74+
[property: JsonPropertyName("createExistingFundingReminders")]
75+
public bool? CreateExistingFundingReminders { get; set; }
76+
7377
#region Inner Parameter Record Objects
7478

7579
public record PaymentParameter

0 commit comments

Comments
 (0)