Skip to content

Commit

Permalink
ORV2-3072 : Issuer is determined by who added the application to cart (
Browse files Browse the repository at this point in the history
  • Loading branch information
praju-aot authored Dec 27, 2024
1 parent f7fb115 commit 50589e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export class ApplicationService {
.innerJoinAndSelect('permit.permitTransactions', 'permitTransactions')
.innerJoinAndSelect('permitTransactions.transaction', 'transaction')
.innerJoinAndSelect('transaction.receipt', 'receipt')
.leftJoinAndSelect('permit.issuer', 'issuer')
.leftJoinAndSelect('permit.applicationOwner', 'applicationOwner')
.leftJoinAndSelect(
'applicationOwner.userContact',
Expand Down Expand Up @@ -697,6 +698,13 @@ export class ApplicationService {
fetchedApplication.permitNumber = permitNumber;
fetchedApplication.permitStatus = ApplicationStatus.ISSUED;
fetchedApplication.permitIssueDateTime = new Date();
const issuer =
fetchedApplication?.issuer?.userGUID || currentUser.userGUID;
const permitIssuedBy =
currentUser.orbcUserDirectory === Directory.IDIR ||
currentUser.orbcUserDirectory === Directory.SERVICE_ACCOUNT
? PermitIssuedBy.PPC
: PermitIssuedBy.SELF_ISSUED;
const queryRunner = this.dataSource.createQueryRunner();
await queryRunner.connect();
await queryRunner.startTransaction();
Expand All @@ -707,13 +715,9 @@ export class ApplicationService {
{
permitStatus: fetchedApplication.permitStatus,
permitNumber: fetchedApplication.permitNumber,
issuer: { userGUID: currentUser.userGUID },
issuer: { userGUID: issuer },
permitApprovalSource: PermitApprovalSourceEnum.AUTO, //TODO : Hardcoding for release 1
permitIssuedBy:
currentUser.orbcUserDirectory == Directory.IDIR ||
currentUser.orbcUserDirectory === Directory.SERVICE_ACCOUNT
? PermitIssuedBy.PPC
: PermitIssuedBy.SELF_ISSUED,
permitIssuedBy: permitIssuedBy,
permitIssueDateTime: fetchedApplication.permitIssueDateTime,
updatedDateTime: new Date(),
updatedUser: currentUser.userName,
Expand Down Expand Up @@ -1092,6 +1096,10 @@ export class ApplicationService {
Permit,
{ permitId: applicationId },
{
issuer:
caseActivityType === CaseActivityType.APPROVED
? { userGUID: currentUser.userGUID }
: null,
permitStatus:
caseActivityType === CaseActivityType.APPROVED
? ApplicationStatus.IN_CART
Expand Down
4 changes: 4 additions & 0 deletions vehicles/src/modules/shopping-cart/shopping-cart.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ export class ShoppingCartService {
.update()
.set({
permitStatus: statusToUpdateTo,
issuer:
statusToUpdateTo === ApplicationStatus.IN_CART
? { userGUID: currentUser.userGUID }
: null,
updatedUser: currentUser.userName,
updatedDateTime: new Date(),
updatedUserDirectory: currentUser.orbcUserDirectory,
Expand Down

0 comments on commit 50589e2

Please sign in to comment.