Skip to content

Commit

Permalink
[SPDBT-3286] download receipt update (#1905)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- Hide 'download receipt' when not applicable
- Add missing FileTypeCode descriptions
- minor UI updates
  • Loading branch information
carolcarpenter authored Nov 27, 2024
1 parent f817948 commit 3324be0
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 43 deletions.
2 changes: 1 addition & 1 deletion src/Spd.Manager.Payment/Contract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public record PaymentResponse
public string CaseNumber { get; set; }
public bool PaidSuccess { get; set; }
public PaymentStatusCode PaymentStatus { get; set; }
public PaymentTypeCode? PaymentType { get; set; }
public PaymentTypeCode? PaymentTypeCode { get; set; }
public string Message { get; set; }
public string TransOrderId { get; set; }
public DateTimeOffset TransDateTime { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import { ApplicationPortalStatusCode } from '../models/application-portal-status-code';
import { PayerPreferenceTypeCode } from '../models/payer-preference-type-code';
import { PaymentTypeCode } from '../models/payment-type-code';
export interface ApplicationPaymentResponse {
applicationNumber?: string | null;
contractedCompanyName?: string | null;
Expand All @@ -20,6 +21,7 @@ export interface ApplicationPaymentResponse {
orgId?: string;
paidOn?: string | null;
payeeType?: PayerPreferenceTypeCode;
paymentTypeCode?: PaymentTypeCode;
status?: ApplicationPortalStatusCode;
surname?: string | null;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface PaymentResponse {
paidSuccess?: boolean;
paymentId?: string;
paymentStatus?: PaymentStatusCode;
paymentType?: PaymentTypeCode;
paymentTypeCode?: PaymentTypeCode;
serviceTypeCode?: ServiceTypeCode;
transAmount?: number;
transDateTime?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const FileTypes: SelectOptions[] = [
{ desc: 'Canadian Firearms License', code: FileTypeCode.CanadianFirearmsLicense },
{ desc: 'Canadian Native Status Card', code: FileTypeCode.CanadianNativeStatusCard },
{ desc: 'Certificate Of Advanced Security Training', code: FileTypeCode.CertificateOfAdvancedSecurityTraining },
{ desc: 'Clearance Letter', code: FileTypeCode.ClearanceLetter },
{ desc: 'Confirmation Letter From Superior Officer', code: FileTypeCode.ConfirmationLetterFromSuperiorOfficer },
{ desc: 'Confirmation Of Fingerprints', code: FileTypeCode.ConfirmationOfFingerprints },
{ desc: 'Convicted Offence', code: FileTypeCode.ConvictedOffence },
Expand All @@ -57,7 +58,9 @@ export const FileTypes: SelectOptions[] = [
{ desc: 'Letter Of No Conflict', code: FileTypeCode.LetterOfNoConflict },
{ desc: 'Locksmith', code: FileTypeCode.Locksmith },
{ desc: 'Mental Health Condition Form', code: FileTypeCode.MentalHealthConditionForm },
{ desc: 'Opportunity To Respond', code: FileTypeCode.OpportunityToRespond },
{ desc: 'Passport', code: FileTypeCode.Passport },
{ desc: 'Payment Receipt', code: FileTypeCode.PaymentReceipt },
{ desc: 'Permanent Residence Card', code: FileTypeCode.PermanentResidenceCard },
{ desc: 'Photograph', code: FileTypeCode.Photograph },
{ desc: 'Private Investigator', code: FileTypeCode.PrivateInvestigator },
Expand All @@ -67,7 +70,6 @@ export const FileTypes: SelectOptions[] = [
{ desc: 'Security Guard', code: FileTypeCode.SecurityGuard },
{ desc: 'Self Disclosure', code: FileTypeCode.SelfDisclosure },
{ desc: 'Validation Certificate', code: FileTypeCode.ValidationCertificate },
{ desc: 'Opportunity To Respond', code: FileTypeCode.OpportunityToRespond },
];

export const ScreeningTypes: SelectOptions[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
PaymentLinkCreateRequest,
PaymentLinkResponse,
PaymentMethodCode,
PaymentTypeCode,
} from 'src/app/api/models';
import { ApplicationService, PaymentService } from 'src/app/api/services';
import { StrictHttpResponse } from 'src/app/api/strict-http-response';
Expand All @@ -30,6 +31,7 @@ import { PaymentFilter } from './payment-filter.component';
export interface PaymentResponse extends ApplicationPaymentResponse {
isPayNow: boolean;
isPayManual: boolean;
isPaid: boolean;
isDownloadReceipt: boolean;
}

Expand Down Expand Up @@ -144,7 +146,7 @@ export interface PaymentResponse extends ApplicationPaymentResponse {
<mat-chip-row
aria-label="Status"
class="mat-chip-green"
*ngIf="application.status && application.isDownloadReceipt; else notpaid"
*ngIf="application.status && application.isPaid; else notpaid"
>
Paid
</mat-chip-row>
Expand Down Expand Up @@ -256,7 +258,7 @@ export class PaymentsComponent implements OnInit {
private paymentService: PaymentService,
private authUserService: AuthUserBceidService,
private configService: ConfigService,
private location: Location
private location: Location,
) {
this.refreshStats();
}
Expand Down Expand Up @@ -410,13 +412,19 @@ export class PaymentsComponent implements OnInit {
.subscribe((res: ApplicationPaymentListResponse) => {
const applications = res.applications as Array<PaymentResponse>;
applications.forEach((app: PaymentResponse) => {
app.isPaid = false;
app.isDownloadReceipt = false;
app.isPayManual = false;
app.isPayNow = false;

if (app.status != ApplicationPortalStatusCode.AwaitingPayment) {
if (app.paidOn) {
app.isDownloadReceipt = true;
app.isPaid = true;

// SPDBT-3286 if paymentTypeCode == Paybc_submission or PayBC_SecurePaymentLink, then show download receipt.
app.isDownloadReceipt =
app.paymentTypeCode == PaymentTypeCode.PayBcOnSubmission ||
app.paymentTypeCode == PaymentTypeCode.PayBcSecurePaymentLink;
}
} else {
const numberOfAttempts = app.numberOfAttempts ?? 0;
Expand All @@ -439,7 +447,7 @@ export class PaymentsComponent implements OnInit {
tap((res: ApplicationStatisticsResponse) => {
const applicationStatistics = res.statistics ?? {};
this.count = applicationStatistics.AwaitingPayment ?? 0;
})
}),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import { UtilService } from 'src/app/core/services/util.service';
<div class="row">
<div class="col-xxl-6 col-xl-8 col-lg-12 col-md-12 col-sm-12">
<mat-table [dataSource]="dataSource" class="report-table">
<mat-table [dataSource]="dataSource">
<ng-container matColumnDef="reportDate">
<mat-cell *matCellDef="let report">
<span class="mobile-label"></span>
Expand Down Expand Up @@ -89,10 +89,6 @@ import { UtilService } from 'src/app/core/services/util.service';
`,
styles: [
`
.report-table {
background-color: var(--color-primary-lightest);
}
.mat-column-action1 {
text-align: right;
justify-content: flex-end;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class CrrpaPaymentFailComponent implements OnInit {
private route: ActivatedRoute,
private authProcessService: AuthProcessService,
private paymentService: PaymentService,
private utilService: UtilService
private utilService: UtilService,
) {}

async ngOnInit(): Promise<void> {
Expand All @@ -61,10 +61,10 @@ export class CrrpaPaymentFailComponent implements OnInit {
return this.paymentService.apiCrrpaApplicationIdPaymentAttemptsGet({
applicationId: paymentResp.applicationId!,
});
})
}),
)
.subscribe((numberOfFails) => {
this.isPayBySecureLink = this.payment?.paymentType == PaymentTypeCode.PayBcSecurePaymentLink;
this.isPayBySecureLink = this.payment?.paymentTypeCode == PaymentTypeCode.PayBcSecurePaymentLink;
if (this.isPayBySecureLink) {
this.numberOfAttemptsRemaining = 0;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,30 @@ import {
<h3 class="fw-semibold d-flex mt-2" style="color: var(--color-primary);">
{{ application.orgName }}
<mat-chip-row aria-label="Status" class="ms-4" [ngClass]="applicationPortalStatusClass" style="width: 275px;">
{{ application.status | options : 'ApplicationPortalStatusTypes' : application.status }}
{{ application.status | options: 'ApplicationPortalStatusTypes' : application.status }}
</mat-chip-row>
</h3>
<div class="row mt-2 mb-4">
<div class="col-md-11 col-sm-12">
<section class="px-4 py-2 ">
<div class="row mt-2">
<div class="col-lg-3 col-md-3">
<div class="d-block text-label">Case ID</div>
<strong> {{ application.applicationNumber }} </strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Submitted On</div>
<strong> {{ application.createdOn! | formatDate }} </strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Service Type</div>
<strong> {{ application.serviceType | options : 'ServiceTypes' }}</strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Paid By</div>
<strong> {{ application.payeeType }}</strong>
</div>
</div>
</section>
<section class="detail-table px-4 py-3 my-4 ">
<div class="row">
<div class="col-lg-3 col-md-3">
<div class="d-block text-label">Case ID</div>
<strong> {{ application.applicationNumber }} </strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Submitted On</div>
<strong> {{ application.createdOn! | formatDate }} </strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Service Type</div>
<strong> {{ application.serviceType | options: 'ServiceTypes' }}</strong>
</div>
<div class="col-lg-3 col-md-3">
<div class="d-block text-label mt-2 mt-md-0">Paid By</div>
<strong> {{ application.payeeType }}</strong>
</div>
</div>
</div>
</section>
</ng-container>
<ng-container *ngIf="fingerprintsAlert || selfDisclosureAlert">
Expand Down Expand Up @@ -155,7 +151,7 @@ import {
</ng-container>
<ng-container *ngIf="opportunityToRespondAlert || requestForAdditionalInfoAlert">
<h4 class="subheading fw-normal mb-2">Upload Document</h4>
<h4 class="subheading fw-normal mb-3">Upload Document</h4>
<div class="row">
<div class="col-12">
<button
Expand All @@ -172,7 +168,7 @@ import {
</ng-container>
<ng-container *ngIf="documentHistoryExists">
<h4 class="subheading fw-normal mb-4">Document Upload History</h4>
<h4 class="subheading fw-normal mb-2">Document Upload History</h4>
<div class="row">
<div class="col-12">
<mat-table [dataSource]="dataSourceHistory">
Expand Down Expand Up @@ -216,6 +212,10 @@ import {
.subheading {
color: var(--color-grey);
}
.detail-table {
background-color: #f6f6f6 !important;
}
`,
],
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Router } from '@angular/router';
import { PaymentResponse, ServiceTypeCode } from 'src/app/api/models';
import { PaymentResponse, PaymentTypeCode, ServiceTypeCode } from 'src/app/api/models';
import { AppRoutes } from 'src/app/app-routes';
import { SPD_CONSTANTS } from 'src/app/core/constants/constants';

Expand Down Expand Up @@ -29,6 +29,7 @@ import { SPD_CONSTANTS } from 'src/app/core/constants/constants';
class="large w-auto m-2"
aria-label="Download Receipt"
(click)="onDownloadReceipt()"
*ngIf="showDownloadReceipt"
>
<mat-icon>file_download</mat-icon>Download Receipt
</button>
Expand Down Expand Up @@ -63,7 +64,7 @@ import { SPD_CONSTANTS } from 'src/app/core/constants/constants';
<div class=" col-xl-2 col-lg-3 mt-4">
<div class="d-block text-label">Date of Transaction</div>
<div class="payment__text">
{{ payment?.transDateTime | formatDate : appConstants.date.formalDateFormat }}
{{ payment?.transDateTime | formatDate: appConstants.date.formalDateFormat }}
</div>
</div>
<div class=" col-xl-2 col-lg-3 mt-4">
Expand Down Expand Up @@ -127,6 +128,8 @@ export class PaymentSuccessComponent implements OnInit {
isBackRoute = false;
appConstants = SPD_CONSTANTS;

showDownloadReceipt = false;

@Input() isApplicationReceived = false;
@Input() showCloseButton = true;

Expand All @@ -143,6 +146,11 @@ export class PaymentSuccessComponent implements OnInit {
if (data.paidSuccess != true) {
this.router.navigate([AppRoutes.ACCESS_DENIED]);
}

// SPDBT-3286 if paymentTypeCode == Paybc_submission or PayBC_SecurePaymentLink, then show download receipt.
this.showDownloadReceipt =
data.paymentTypeCode == PaymentTypeCode.PayBcOnSubmission ||
data.paymentTypeCode == PaymentTypeCode.PayBcSecurePaymentLink;
}
get payment(): PaymentResponse | null {
return this._payment;
Expand Down

0 comments on commit 3324be0

Please sign in to comment.