Skip to content

Commit

Permalink
Merge branch 'develop' into release/2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Krishna Metpalli authored and Sai Krishna Metpalli committed Jul 24, 2024
2 parents 98bd354 + 81fc76b commit c764cff
Show file tree
Hide file tree
Showing 26 changed files with 273 additions and 83 deletions.
1 change: 1 addition & 0 deletions gitops/charts/traffic-court-dev-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ global:

arc-dispute-api:
image:
tag: "2.2.12"
tag: "2.3.0"
pullPolicy: Always
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,32 @@ public AgencyLookupService(IConnectionMultiplexer redis, IMemoryCache cache, ILo
: base("Agencies", redis, cache, TimeSpan.FromHours(1), logger)
{
}

public async Task<Agency?> GetByIdAsync(string agencyId)
{
if (string.IsNullOrEmpty(agencyId))
{
return null;
}

var agencies = await GetAgenciesAsync(agency => agency.Id == agencyId);
if (agencies.Count == 0)
{
return null;
}

if (agencies.Count > 1)
{
_logger.LogInformation("{Count} agencies were returned matching {Id}, returning first value", agencies.Count, agencyId);
}

return agencies[0];
}

private async Task<List<Agency>> GetAgenciesAsync(Func<Agency, bool> predicate)
{
var values = await GetListAsync();
var sections = values.Where(predicate).ToList();
return sections;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@ namespace TrafficCourts.Common.Features.Lookups;

public interface IAgencyLookupService : ICachedLookupService<Agency>
{
/// <summary>
/// Returns a specific Agency from the Redis Cache based on the agency id
/// </summary>
/// <param name="agencyId"></param>
/// <returns></returns>
Task<Agency?> GetByIdAsync(string agencyId);
}
Binary file not shown.
Binary file not shown.
22 changes: 17 additions & 5 deletions src/backend/TrafficCourts/Staff.Service/Services/DisputeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,17 @@ public async Task CancelDisputeAsync(long disputeId, string cancelledReason, Cla
GetUserName(user));
await _bus.PublishWithLog(_logger, fileHistoryRecord, cancellationToken);

// Publish file history of cancellation email
fileHistoryRecord.AuditLogEntryType = FileHistoryAuditLogEntryType.EMCA;
await _bus.PublishWithLog(_logger, fileHistoryRecord, cancellationToken);
// Publish file history for cancelled remarks
SaveFileHistoryRecord fileHistoryRecordRemark = Mapper.ToFileHistoryWithNoticeOfDisputeId(
dispute.NoticeOfDisputeGuid,
FileHistoryAuditLogEntryType.FRMK,
GetUserName(user),
cancelledReason);
await _bus.PublishWithLog(_logger, fileHistoryRecordRemark, cancellationToken);

// Publish cancel event (consumer(s) will generate email, etc)
DisputeCancelled cancelledEvent = Mapper.ToDisputeCancelled(dispute);
await _bus. PublishWithLog(_logger, cancelledEvent, cancellationToken);
await _bus.PublishWithLog(_logger, cancelledEvent, cancellationToken);
}

public async Task RejectDisputeAsync(long disputeId, string rejectedReason, ClaimsPrincipal user, CancellationToken cancellationToken)
Expand All @@ -214,7 +218,15 @@ public async Task RejectDisputeAsync(long disputeId, string rejectedReason, Clai
GetUserName(user));
await _bus.PublishWithLog(_logger, fileHistoryRecord, cancellationToken);

// Publish submit event (consumer(s) will generate email, etc)
// Publish file history for rejected remarks
SaveFileHistoryRecord fileHistoryRecordRemark = Mapper.ToFileHistoryWithNoticeOfDisputeId(
dispute.NoticeOfDisputeGuid,
FileHistoryAuditLogEntryType.FRMK,
GetUserName(user),
rejectedReason);
await _bus.PublishWithLog(_logger, fileHistoryRecordRemark, cancellationToken);

// Publish reject event (consumer(s) will generate email, etc)
DisputeRejected rejectedEvent = Mapper.ToDisputeRejected(dispute);
await _bus.PublishWithLog(_logger, rejectedEvent, cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class PrintDigitalCaseFileService : IPrintDigitalCaseFileService
private readonly IJJDisputeService _jjDisputeService;
private readonly IOracleDataApiService _oracleDataApi;
private readonly IProvinceLookupService _provinceLookupService;
private readonly IAgencyLookupService _agencyLookupService;
private readonly ICountryLookupService _countryLookupService;
private readonly IDocumentGenerationService _documentGeneration;
private readonly IDisputeService _disputeService;
Expand All @@ -22,6 +23,7 @@ public PrintDigitalCaseFileService(
IJJDisputeService jjDisputeService,
IOracleDataApiService oracleDataApi,
IProvinceLookupService provinceLookupService,
IAgencyLookupService agencyLookupService,
ICountryLookupService countryLookupService,
IDocumentGenerationService documentGeneration,
IDisputeService disputeService,
Expand All @@ -30,6 +32,7 @@ public PrintDigitalCaseFileService(
_jjDisputeService = jjDisputeService ?? throw new ArgumentNullException(nameof(jjDisputeService));
_oracleDataApi = oracleDataApi ?? throw new ArgumentNullException(nameof(oracleDataApi));
_provinceLookupService = provinceLookupService ?? throw new ArgumentNullException(nameof(provinceLookupService));
_agencyLookupService = agencyLookupService ?? throw new ArgumentNullException(nameof(agencyLookupService));
_countryLookupService = countryLookupService ?? throw new ArgumentNullException(nameof(countryLookupService));
_documentGeneration = documentGeneration ?? throw new ArgumentNullException(nameof(documentGeneration));
_disputeService = disputeService ?? throw new ArgumentNullException(nameof(disputeService));
Expand Down Expand Up @@ -244,6 +247,22 @@ private Stream GetTemplate(string name)
return country;
}

/// <summary>
/// Returns Agency (Courthouse Location) based on the provided agencyId through agencyLookupService.
/// </summary>
/// <param name="agencyId"></param>
/// <returns></returns>
private async Task<Agency?> GetCourthouseLocationAsync(string agencyId)
{
Domain.Models.Agency? courthouseLocation = null;
if (agencyId is not null)
{
courthouseLocation = await _agencyLookupService.GetByIdAsync(agencyId);
}

return courthouseLocation;
}

/// <summary>
/// Fetches the <see cref="DigitalCaseFile"/> based on ticket number. This really should be using the tco_dispute.dispute_id.
/// </summary>
Expand All @@ -257,6 +276,9 @@ internal async Task<DigitalCaseFile> GetDigitalCaseFileAsync(string ticketNumber

Domain.Models.Province? driversLicenceProvince = await GetDriversLicenceProvinceAsync(dispute.DrvLicIssuedProvSeqNo, dispute.DrvLicIssuedCtryId);

// Get courthouse location data from the courthouse location lookup service based on CourtAgenId provided from the dispute
Agency? courthouseLocation = await GetCourthouseLocationAsync(dispute.CourtAgenId);

var digitalCaseFile = new DigitalCaseFile();

// fill in each section, the sections and fields are populated in order matching the template
Expand All @@ -273,7 +295,7 @@ internal async Task<DigitalCaseFile> GetDigitalCaseFileAsync(string ticketNumber
ticket.Submitted = new FormattedDateOnly(dispute.SubmittedTs);
ticket.IcbcReceived = new FormattedDateOnly(dispute.IcbcReceivedDate);
ticket.CourtAgenyId = dispute.CourtAgenId;
ticket.CourtHouse = dispute.CourthouseLocation;
ticket.CourtHouse = courthouseLocation?.Name ?? string.Empty;

// set the contact information
var contact = digitalCaseFile.Contact;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public class TcoDisputeTicketController : ControllerBase
{
private readonly IMapper _mapper;
private readonly IArcFileService _arcFileService;
private readonly ILogger _logger;
private readonly ILogger<TcoDisputeTicketController> _logger;

// Assign the object in the constructor for dependency injection
public TcoDisputeTicketController(
IMapper mapper,
IArcFileService arcFileService,
ILogger logger)
ILogger<TcoDisputeTicketController> logger)
{
_mapper = mapper ?? throw new ArgumentNullException(nameof(mapper));
_arcFileService = arcFileService ?? throw new ArgumentNullException(nameof(arcFileService));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public PrintDigitalCaseFileIntegrationTest()
jjDisputeService,
oracleDataApi,
Mock.Of<IProvinceLookupService>(),
Mock.Of<IAgencyLookupService>(),
Mock.Of<ICountryLookupService>(),
Mock.Of<IDocumentGenerationService>(),
disputeService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ model/agency.model.ts
model/boundingBox.model.ts
model/country.model.ts
model/credentialRepresentation.model.ts
model/dcfTemplateType.model.ts
model/dispute.model.ts
model/disputeAppearanceLessThan14DaysYn.model.ts
model/disputeContactTypeCd.model.ts
Expand Down
15 changes: 11 additions & 4 deletions src/frontend/staff-portal/src/app/api/api/dispute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';

// @ts-ignore
import { DcfTemplateType } from '../model/dcfTemplateType.model';
// @ts-ignore
import { Dispute } from '../model/dispute.model';
// @ts-ignore
Expand Down Expand Up @@ -341,13 +343,14 @@ export class DisputeService {
* Returns generated document.
* @param disputeId Dispute Id
* @param timeZone The IANA timze zone id
* @param type The type of template to generate
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpResponse<any>>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpEvent<any>>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any> {
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, type?: DcfTemplateType, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, type?: DcfTemplateType, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpResponse<any>>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, type?: DcfTemplateType, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpEvent<any>>;
public apiDisputeDisputeIdPrintGet(disputeId: number, timeZone: string, type?: DcfTemplateType, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any> {
if (disputeId === null || disputeId === undefined) {
throw new Error('Required parameter disputeId was null or undefined when calling apiDisputeDisputeIdPrintGet.');
}
Expand All @@ -360,6 +363,10 @@ export class DisputeService {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>timeZone, 'timeZone');
}
if (type !== undefined && type !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>type, 'type');
}

let localVarHeaders = this.defaultHeaders;

Expand Down
15 changes: 11 additions & 4 deletions src/frontend/staff-portal/src/app/api/api/jJ.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import { HttpClient, HttpHeaders, HttpParams,
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';

// @ts-ignore
import { DcfTemplateType } from '../model/dcfTemplateType.model';
// @ts-ignore
import { DocumentType } from '../model/documentType.model';
// @ts-ignore
Expand Down Expand Up @@ -643,13 +645,14 @@ export class JJService {
* Returns generated document. This really should be using the tco_dispute.dispute_id.
* @param ticketNumber The ticket number to print. This really should be using the tco_dispute.dispute_id
* @param timeZone The IANA timze zone id
* @param type The type of template to generate
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpResponse<any>>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpEvent<any>>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any> {
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, type?: DcfTemplateType, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, type?: DcfTemplateType, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpResponse<any>>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, type?: DcfTemplateType, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<HttpEvent<any>>;
public apiJjTicketNumberPrintGet(ticketNumber: string, timeZone: string, type?: DcfTemplateType, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'text/plain' | 'application/json' | 'text/json', context?: HttpContext}): Observable<any> {
if (ticketNumber === null || ticketNumber === undefined) {
throw new Error('Required parameter ticketNumber was null or undefined when calling apiJjTicketNumberPrintGet.');
}
Expand All @@ -662,6 +665,10 @@ export class JJService {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>timeZone, 'timeZone');
}
if (type !== undefined && type !== null) {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>type, 'type');
}

let localVarHeaders = this.defaultHeaders;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* VTC Staff API
* Violation Ticket Centre Staff API
*
* The version of the OpenAPI document: v1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/


export type DcfTemplateType = 'DcfTemplate' | 'HrDcfTemplate' | 'WrDcfTemplate';

export const DcfTemplateType = {
DcfTemplate: 'DcfTemplate' as DcfTemplateType,
HrDcfTemplate: 'HrDcfTemplate' as DcfTemplateType,
WrDcfTemplate: 'WrDcfTemplate' as DcfTemplateType
};

Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export interface JJDispute {
occamDisputantGiven2Nm?: string | null;
occamDisputantGiven3Nm?: string | null;
occamDisputantSurnameNm?: string | null;
occamDisputantPhoneNumber?: string | null;
occamDisputeId?: number;
occamViolationTicketUpldId?: string | null;
submittedTs?: string | null;
Expand Down
1 change: 1 addition & 0 deletions src/frontend/staff-portal/src/app/api/model/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './agency.model';
export * from './boundingBox.model';
export * from './country.model';
export * from './credentialRepresentation.model';
export * from './dcfTemplateType.model';
export * from './dispute.model';
export * from './disputeAppearanceLessThan14DaysYn.model';
export * from './disputeContactTypeCd.model';
Expand Down
Loading

0 comments on commit c764cff

Please sign in to comment.