Skip to content

Commit

Permalink
[FE] Business licence bug fixes (#1670)
Browse files Browse the repository at this point in the history
# Description

This PR includes the following proposed change(s):

- SPDBT-3213 - update endpoint called during simultaneous renew
- remove 'isRenewalShortForm' code
- SPDBT-3212 - show payment success
- Main page - fix bug showing of Pay Now button
  • Loading branch information
carolcarpenter authored Oct 30, 2024
1 parent 1195358 commit eb2fd67
Show file tree
Hide file tree
Showing 12 changed files with 50 additions and 158 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,13 +775,19 @@ export class ApplicationService {
`You haven't submitted your ${itemLabel} application yet. It will expire on <strong>${itemExpiry}</strong>.`
);
} else if (checkControllingMemberWarning && item.isControllingMemberWarning) {
// Must have application in Payment Pending status to show this message.
const awaitingPaymentIndex = applicationsList.findIndex(
(item: MainApplicationResponse) =>
item.applicationPortalStatusCode === ApplicationPortalStatusCode.AwaitingPayment
);
if (awaitingPaymentIndex >= 0) {
isControllingMemberWarning = true;
// applications only wait for controlling member completion on New or Renewal
if (
item.applicationTypeCode === ApplicationTypeCode.New ||
item.applicationTypeCode === ApplicationTypeCode.Renewal
) {
// Must have application in Payment Pending status to show this message.
const awaitingPaymentIndex = applicationsList.findIndex(
(item: MainApplicationResponse) =>
item.applicationPortalStatusCode === ApplicationPortalStatusCode.AwaitingPayment
);
if (awaitingPaymentIndex >= 0) {
isControllingMemberWarning = true;
}
}
} else if (item.isExpiryError) {
errorMessages.push(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export class BusinessApplicationService extends BusinessApplicationHelper {

isBcBusinessAddress: new FormControl(), // placeholder for flag
isBusinessLicenceSoleProprietor: new FormControl(), // placeholder for flag
isRenewalShortForm: new FormControl(), // placeholder for flag
caseNumber: new FormControl(), // placeholder to save info for display purposes

originalLicenceData: this.originalLicenceFormGroup,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit {
redirectComponentRoute = `${BusinessLicenceApplicationRoutes.path(
BusinessLicenceApplicationRoutes.BUSINESS_RENEWAL_SOLE_PROPRIETOR
)}?${params.toString()}`;
} else if (
currentPath.includes(BusinessLicenceApplicationRoutes.PAYMENT_SUCCESS) ||
currentPath.includes(BusinessLicenceApplicationRoutes.PAYMENT_FAIL) ||
currentPath.includes(BusinessLicenceApplicationRoutes.PAYMENT_CANCEL) ||
currentPath.includes(BusinessLicenceApplicationRoutes.PAYMENT_ERROR)
) {
redirectComponentRoute = currentPath;
}

console.debug('BusinessLicenceApplicationBaseComponent redirectComponentRoute', redirectComponentRoute);
console.debug('**** base **** redirectComponentRoute', redirectComponentRoute);

this.authProcessService.logoutBcsc(redirectComponentRoute);

Expand All @@ -70,10 +77,10 @@ export class BusinessLicenceApplicationBaseComponent implements OnInit {
params.toString()
);

console.debug('**** BASE **** loginInfo', loginInfo);
console.debug('**** BASE **** swlLicAppId', swlLicAppId);
console.debug('**** BASE **** bizLicAppId', bizLicAppId);
console.debug('**** BASE **** linkedSoleProprietorBizLicId', linkedSoleProprietorBizLicId);
console.debug('**** base **** loginInfo', loginInfo);
console.debug('**** base **** swlLicAppId', swlLicAppId);
console.debug('**** base **** bizLicAppId', bizLicAppId);
console.debug('**** base **** linkedSoleProprietorBizLicId', linkedSoleProprietorBizLicId);

if (loginInfo.returnRoute?.includes(BusinessLicenceApplicationRoutes.BUSINESS_NEW_SOLE_PROPRIETOR)) {
if ((swlLicAppId || bizLicAppId) && loginInfo.state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ export class BusinessLicenceWizardNewSwlSoleProprietorComponent
onNextPayStep(): void {
this.businessApplicationService.submitBusinessLicenceWithSwlCombinedFlowNew().subscribe({
next: (resp: StrictHttpResponse<BizLicAppCommandResponse>) => {
this.hotToastService.success('Your business licence has been successfully submitted');
this.hotToastService.success(
'Your business licence and security worker licence have been successfully submitted'
);
this.payNow(resp.body.licenceAppId!);
},
error: (error: any) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,14 @@ import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatStepper } from '@angular/material/stepper';
import { Router } from '@angular/router';
import { ApplicationTypeCode, BizLicAppCommandResponse, BizTypeCode, ServiceTypeCode } from '@app/api/models';
import { StrictHttpResponse } from '@app/api/strict-http-response';
import { ApplicationTypeCode, BizTypeCode, ServiceTypeCode } from '@app/api/models';
import { AppRoutes } from '@app/app-routing.module';
import { BaseWizardComponent } from '@app/core/components/base-wizard.component';
import { ApplicationService } from '@app/core/services/application.service';
import { BusinessApplicationService } from '@app/core/services/business-application.service';
import { BusinessLicenceApplicationRoutes } from '@app/modules/business-licence-application/business-license-application-routes';
import { PersonalLicenceApplicationRoutes } from '@app/modules/personal-licence-application/personal-licence-application-routes';
import { DialogComponent, DialogOptions } from '@app/shared/components/dialog.component';
import { HotToastService } from '@ngxpert/hot-toast';
import { Subscription, distinctUntilChanged } from 'rxjs';
import { StepsBusinessLicenceReviewComponent } from './steps-business-licence-review.component';
import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence-selection.component';
Expand Down Expand Up @@ -49,13 +47,11 @@ import { StepsBusinessLicenceSwlSpInformationComponent } from './steps-business-
<app-steps-business-licence-swl-sp-information
[applicationTypeCode]="applicationTypeCode"
[isSoleProprietorSimultaneousFlow]="isSoleProprietorSimultaneousFlow"
[isRenewalShortForm]="isRenewalShortForm"
(childNextStep)="onChildNextStep()"
(saveAndExit)="onSaveAndExit()"
(cancelAndExit)="onReturnToSwl()"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
(renewalShortForm)="onRenewalShortForm($event)"
></app-steps-business-licence-swl-sp-information>
</mat-step>
Expand All @@ -67,7 +63,6 @@ import { StepsBusinessLicenceSwlSpInformationComponent } from './steps-business-
[bizTypeCode]="bizTypeCode"
[isBusinessLicenceSoleProprietor]="true"
[isSoleProprietorSimultaneousFlow]="isSoleProprietorSimultaneousFlow"
[isRenewalShortForm]="isRenewalShortForm"
[isFormValid]="false"
[showSaveAndExit]="true"
(childNextStep)="onChildNextStep()"
Expand Down Expand Up @@ -123,7 +118,6 @@ export class BusinessLicenceWizardRenewalSwlSoleProprietorComponent
serviceTypeCode!: ServiceTypeCode;
applicationTypeCode!: ApplicationTypeCode;
bizTypeCode!: BizTypeCode;
isRenewalShortForm = false;

private businessModelValueChangedSubscription!: Subscription;

Expand All @@ -138,7 +132,6 @@ export class BusinessLicenceWizardRenewalSwlSoleProprietorComponent
override breakpointObserver: BreakpointObserver,
private router: Router,
private dialog: MatDialog,
private hotToastService: HotToastService,
private commonApplicationService: ApplicationService,
private businessApplicationService: BusinessApplicationService
) {
Expand Down Expand Up @@ -212,15 +205,9 @@ export class BusinessLicenceWizardRenewalSwlSoleProprietorComponent
}

onNextPayStep(): void {
this.businessApplicationService.submitBusinessLicenceWithSwlCombinedFlowNew().subscribe({
next: (resp: StrictHttpResponse<BizLicAppCommandResponse>) => {
this.hotToastService.success('Your business licence has been successfully submitted');
this.payNow(resp.body.licenceAppId!);
},
error: (error: any) => {
console.log('An error occurred during save', error);
this.hotToastService.error('An error occurred during the save. Please try again.');
},
this.businessApplicationService.payBusinessLicenceRenewal({
paymentSuccess: 'Your business licence and security worker licence renewal have been successfully submitted',
paymentReason: 'Payment for renewal of Business Licence application',
});
}

Expand Down Expand Up @@ -254,15 +241,6 @@ export class BusinessLicenceWizardRenewalSwlSoleProprietorComponent
});
}

onRenewalShortForm(isShortForm: boolean) {
this.businessApplicationService.businessModelFormGroup.patchValue(
{ isRenewalShortForm: isShortForm },
{ emitEvent: false }
);
this.isRenewalShortForm = isShortForm;
this.goToChildNextStep();
}

onReturnToSwl(): void {
const message = this.isSoleProprietorSimultaneousSWLAnonymous
? '<strong>Are you sure you want to cancel your security business licence application?</strong><br><br>If you cancel this application, you will have to re-submit your Security Worker Licence application.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence
[showSaveAndExit]="false"
[applicationTypeCode]="applicationTypeCode"
[isBusinessLicenceSoleProprietor]="isBusinessLicenceSoleProprietor"
[isRenewalShortForm]="isRenewalShortForm"
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(nextStepperStep)="onNextStepperStep(stepper)"
(scrollIntoView)="onScrollIntoView()"
(renewalShortForm)="onRenewalShortForm($event)"
></app-steps-business-licence-information>
</mat-step>
Expand All @@ -47,7 +45,6 @@ import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence
[isBusinessLicenceSoleProprietor]="isBusinessLicenceSoleProprietor"
[isFormValid]="isFormValid"
[showSaveAndExit]="false"
[isRenewalShortForm]="isRenewalShortForm"
(childNextStep)="onChildNextStep()"
(nextReview)="onGoToReview()"
(previousStepperStep)="onPreviousStepperStep(stepper)"
Expand All @@ -56,7 +53,7 @@ import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence
></app-steps-business-licence-selection>
</mat-step>
<mat-step [completed]="step3Complete" *ngIf="!isBusinessLicenceSoleProprietor && !isRenewalShortForm">
<mat-step [completed]="step3Complete" *ngIf="!isBusinessLicenceSoleProprietor">
<ng-template matStepLabel>Contact Information</ng-template>
<app-steps-business-licence-contact-information
[applicationTypeCode]="applicationTypeCode"
Expand All @@ -70,7 +67,7 @@ import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence
></app-steps-business-licence-contact-information>
</mat-step>
<mat-step [completed]="step4Complete" *ngIf="!isBusinessLicenceSoleProprietor && !isRenewalShortForm">
<mat-step [completed]="step4Complete" *ngIf="!isBusinessLicenceSoleProprietor">
<ng-template matStepLabel>Controlling Members & Employees</ng-template>
<app-steps-business-licence-controlling-members
[applicationTypeCode]="applicationTypeCode"
Expand All @@ -90,7 +87,6 @@ import { StepsBusinessLicenceSelectionComponent } from './steps-business-licence
<app-steps-business-licence-review
[serviceTypeCode]="serviceTypeCode"
[applicationTypeCode]="applicationTypeCode"
[isRenewalShortForm]="isRenewalShortForm"
[isControllingMembersWithoutSwlExist]="isControllingMembersWithoutSwlExist"
[showSaveAndExit]="false"
(previousStepperStep)="onPreviousStepperStep(stepper)"
Expand Down Expand Up @@ -122,7 +118,6 @@ export class BusinessLicenceWizardRenewalComponent extends BaseWizardComponent i
step4Complete = false;

isFormValid = false;
isRenewalShortForm = false;

serviceTypeCode!: ServiceTypeCode;
applicationTypeCode!: ApplicationTypeCode;
Expand Down Expand Up @@ -251,15 +246,6 @@ export class BusinessLicenceWizardRenewalComponent extends BaseWizardComponent i
stepper.next();
}

onRenewalShortForm(isShortForm: boolean) {
this.businessApplicationService.businessModelFormGroup.patchValue(
{ isRenewalShortForm: isShortForm },
{ emitEvent: false }
);
this.isRenewalShortForm = isShortForm;
this.goToChildNextStep();
}

onGoToStep(step: number) {
this.stepsBusinessInformationComponent?.onGoToFirstStep();
this.stepsLicenceSelectionComponent?.onGoToFirstStep();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ import { StepsBusinessLicenceUpdatesComponent } from './steps-business-licence-u
[serviceTypeCode]="serviceTypeCode"
[applicationTypeCode]="applicationTypeCode"
[licenceCost]="newLicenceCost"
[isRenewalShortForm]="false"
[showSaveAndExit]="false"
(previousStepperStep)="onPreviousStepperStep(stepper)"
(nextPayStep)="onNextPayStep()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, EventEmitter, Input, Output, ViewChild, ViewEncapsulation } from '@angular/core';
import { Component, Input, ViewChild, ViewEncapsulation } from '@angular/core';
import { ApplicationTypeCode } from '@app/api/models';
import { BaseWizardStepComponent } from '@app/core/components/base-wizard-step.component';
import { ApplicationService } from '@app/core/services/application.service';
Expand Down Expand Up @@ -47,25 +47,6 @@ import { StepBusinessLicenceLiabilityComponent } from './step-business-licence-l
></app-wizard-footer>
</mat-step>
<!-- <mat-step *ngIf="isRenewal">
<app-step-business-licence-static-summary></app-step-business-licence-static-summary>
<div class="row wizard-button-row">
<div class="offset-xxl-4 col-xxl-5 offset-xl-3 col-xl-7 offset-lg-3 col-lg-7 col-md-12">
<button mat-flat-button color="primary" class="large mb-2" (click)="onRenewalLongFormNextStep()">
Yes, I need to update
</button>
</div>
</div>
<app-wizard-footer
nextButtonLabel="No updates needed"
[isWideNext]="true"
(previousStepperStep)="onGoToPreviousStep()"
(nextStepperStep)="onRenewalShortFormNextStep()"
></app-wizard-footer>
</mat-step> -->
<mat-step *ngIf="isNew">
<app-step-business-licence-expired></app-step-business-licence-expired>
Expand All @@ -77,7 +58,7 @@ import { StepBusinessLicenceLiabilityComponent } from './step-business-licence-l
></app-wizard-footer>
</mat-step>
<mat-step *ngIf="!isRenewalShortForm">
<mat-step>
<app-step-business-licence-company-branding
[applicationTypeCode]="applicationTypeCode"
></app-step-business-licence-company-branding>
Expand Down Expand Up @@ -121,11 +102,8 @@ export class StepsBusinessLicenceInformationComponent extends BaseWizardStepComp
@Input() isBusinessLicenceSoleProprietor!: boolean;
@Input() isFormValid!: boolean;
@Input() showSaveAndExit!: boolean;
@Input() isRenewalShortForm!: boolean;
@Input() applicationTypeCode!: ApplicationTypeCode;

@Output() renewalShortForm: EventEmitter<boolean> = new EventEmitter();

@ViewChild(StepBusinessLicenceExpiredComponent) stepExpiredComponent!: StepBusinessLicenceExpiredComponent;
@ViewChild(StepBusinessLicenceCompanyBrandingComponent)
stepCompanyBrandingComponent!: StepBusinessLicenceCompanyBrandingComponent;
Expand All @@ -139,14 +117,6 @@ export class StepsBusinessLicenceInformationComponent extends BaseWizardStepComp
this.commonApplicationService.onGotoBusinessProfile(this.applicationTypeCode);
}

onRenewalShortFormNextStep(): void {
this.renewalShortForm.emit(true);
}

onRenewalLongFormNextStep(): void {
this.renewalShortForm.emit(false);
}

override dirtyForm(step: number): boolean {
switch (step) {
case this.STEP_CHECKLIST:
Expand Down
Loading

0 comments on commit eb2fd67

Please sign in to comment.