Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LoA validation on pay now #1718

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

gchauhan-aot
Copy link
Collaborator

@gchauhan-aot gchauhan-aot commented Dec 23, 2024

Description

This PR is to add LoA validation on pay now. Verifies the consistency of loa data in database and permit snapshot. Validates permit type, dates and vehicles with loa and loa snapshot data.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A: Manually tested in local using front end with correct data.
  • Test B

Checklist

  • I have read the CONTRIBUTING doc
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have already been accepted and merged

Further comments


Thanks for the PR!

Deployments, as required, will be available below:

Please create PRs in draft mode. Mark as ready to enable:

After merge, new images are promoted to:

Copy link

Copy link

Copy link

Copy link

Quality Gate Failed Quality Gate failed for 'onroutebc vehicles'

Failed conditions
11.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

Copy link

@@ -887,4 +904,137 @@ export class PaymentService {
})),
) as PermitHistoryDto[];
}

async isValidLoa(permit: Permit): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be part of the validate endpoint?

permitVehicleType,
);
}
private validateLoaDetails(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to Loa helper or util or the loa module

}
}

private validatePermitDataAgainstLoas(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to Loa helper or util or the loa module

const permitData = JSON.parse(permit.permitData.permitData) as PermitData;
const { vehicleId: permitVehicleId, vehicleType: permitVehicleType } =
permitData.vehicleDetails;
const loaNumbers = permitData.loas.map((loa) => loa.loaNumber);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add optional chaining

@@ -887,4 +904,137 @@ export class PaymentService {
})),
) as PermitHistoryDto[];
}

async isValidLoa(permit: Permit): Promise<void> {
const { companyId } = permit.company;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add optional chaining

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants