Skip to content

Commit 4d3e50e

Browse files
authored
Fix team testing bugs - QBO (#454)
* Fix team testing bugs - QBO * few more fixes
1 parent 9b10ad7 commit 4d3e50e

File tree

30 files changed

+74
-82
lines changed

30 files changed

+74
-82
lines changed

src/app/auth/redirect/redirect.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class RedirectComponent implements OnInit {
2727
const url = `http://localhost:4200/oauth/travelperk?code=${this.route.snapshot.queryParams.code}&state=${orgId}`;
2828
this.windowService.redirect(url);
2929
} else if (this.route.snapshot.queryParams?.state === 'qbo_local_redirect' || this.route.snapshot.queryParams?.state === 'business_central_local_redirect') {
30-
const url = `http://localhost:4200/integrations/oauth_callback?code=${this.route.snapshot.queryParams.code}&realmId=${this.route.snapshot.queryParams.realmId}`;
30+
const url = `http://localhost:4200/oauth/default?code=${this.route.snapshot.queryParams.code}&realmId=${this.route.snapshot.queryParams.realmId}`;
3131
this.windowService.redirect(url);
3232
}
3333
} else {

src/app/core/models/common/export-settings.model.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export class ExportSettingModel {
1515
static getExportGroup(exportGroups: string[] | null | undefined): string {
1616
if (exportGroups) {
1717
const exportGroup = exportGroups.find((exportGroup) => {
18-
return exportGroup === ExpenseGroupingFieldOption.EXPENSE_ID || exportGroup === ExpenseGroupingFieldOption.CLAIM_NUMBER || exportGroup === ExpenseGroupingFieldOption.SETTLEMENT_ID;
18+
return exportGroup === ExpenseGroupingFieldOption.EXPENSE_ID || exportGroup === ExpenseGroupingFieldOption.REPORT_ID || exportGroup === ExpenseGroupingFieldOption.CLAIM_NUMBER || exportGroup === ExpenseGroupingFieldOption.SETTLEMENT_ID;
1919
});
20-
return exportGroup ? exportGroup : ExpenseGroupingFieldOption.CLAIM_NUMBER;
20+
return exportGroup && exportGroup !== ExpenseGroupingFieldOption.REPORT_ID ? exportGroup : ExpenseGroupingFieldOption.CLAIM_NUMBER;
2121
}
2222
return '';
2323
}

src/app/core/models/db/accounting-export.model.ts

+2
Original file line numberDiff line numberDiff line change
@@ -226,11 +226,13 @@ export class AccountingExportModel {
226226

227227
export class SkippedAccountingExportModel {
228228
static getfilteredSkippedAccountingExports(query: string, group: SkipExportList): boolean {
229+
const employeeName = group.employee ? group.employee[0] : '';
229230
const employeeID = group.employee ? group.employee[1] : '';
230231
const expenseType = group.expenseType ? group.expenseType : '';
231232
const referenceNumber = group.claim_number ? group.claim_number : '';
232233

233234
return (
235+
employeeName.toLowerCase().includes(query) ||
234236
employeeID.toLowerCase().includes(query) ||
235237
expenseType.toLowerCase().includes(query) ||
236238
referenceNumber.toLowerCase().includes(query)

src/app/core/models/enum/enum.model.ts

+1
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ export enum FyleField {
249249

250250
export enum ExpenseGroupingFieldOption {
251251
CLAIM_NUMBER = 'claim_number',
252+
REPORT_ID = 'report_id',
252253
SETTLEMENT_ID = 'settlement_id',
253254
EXPENSE_ID = 'expense_id',
254255
EXPENSE = 'EXPENSE',

src/app/integrations/business-central/business-central-main/business-central-export-log/business-central-complete-export-log/business-central-complete-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ export class BusinessCentralCompleteExportLogComponent implements OnInit {
131131
this.trackDateFilter('existing', this.selectedDateFilter);
132132
this.getAccountingExports(paginator.limit, paginator.offset);
133133
} else {
134+
this.dateOptions = AccountingExportModel.getDateOptions();
135+
this.exportLogForm.controls.start.patchValue([]);
134136
this.selectedDateFilter = null;
135137
this.getAccountingExports(paginator.limit, paginator.offset);
136138
}

src/app/integrations/business-central/business-central-main/business-central-export-log/business-central-skipped-export-log/business-central-skipped-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ export class BusinessCentralSkippedExportLogComponent implements OnInit {
109109
this.trackDateFilter('existing', this.selectedDateFilter);
110110
this.getSkippedExpenses(paginator.limit, paginator.offset);
111111
} else {
112+
this.dateOptions = AccountingExportModel.getDateOptions();
113+
this.skipExportLogForm.controls.start.patchValue([]);
112114
this.selectedDateFilter = null;
113115
this.getSkippedExpenses(paginator.limit, paginator.offset);
114116
}

src/app/integrations/integrations-routing.module.ts

-4
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ const routes: Routes = [
4343
{
4444
path: 'business_central',
4545
loadChildren: () => import('./business-central/business-central.module').then(m => m.BusinessCentralModule)
46-
},
47-
{
48-
path: 'oauth_callback',
49-
loadChildren: () => import('./oauth-callback/oauth-callback.module').then(m => m.OauthCallbackModule)
5046
}
5147
]
5248
}

src/app/integrations/oauth-callback/oauth-callback-routing.module.ts

-16
This file was deleted.

src/app/integrations/oauth-callback/oauth-callback.component.ts

-15
This file was deleted.

src/app/integrations/oauth-callback/oauth-callback.module.ts

-19
This file was deleted.

src/app/integrations/qbo/qbo-main/qbo-export-log/qbo-complete-export-log/qbo-complete-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ export class QboCompleteExportLogComponent implements OnInit {
120120

121121
this.getAccountingExports(paginator.limit, paginator.offset);
122122
} else {
123+
this.dateOptions = AccountingExportModel.getDateOptions();
124+
this.exportLogForm.controls.start.patchValue([]);
123125
this.selectedDateFilter = null;
124126
this.getAccountingExports(paginator.limit, paginator.offset);
125127
}

src/app/integrations/qbo/qbo-main/qbo-export-log/qbo-skipped-export-log/qbo-skipped-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export class QboSkippedExportLogComponent implements OnInit {
110110

111111
this.getSkippedExpenses(paginator.limit, paginator.offset);
112112
} else {
113+
this.dateOptions = AccountingExportModel.getDateOptions();
114+
this.skipExportLogForm.controls.start.patchValue([]);
113115
this.selectedDateFilter = null;
114116
this.getSkippedExpenses(paginator.limit, paginator.offset);
115117
}

src/app/integrations/qbo/qbo-main/qbo-main.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export class QboMainComponent implements OnInit {
3030
) { }
3131

3232
refreshDimensions() {
33+
this.qboHelperService.refreshQBODimensions().subscribe();
3334
this.qboHelperService.refreshFyleDimensions().subscribe();
3435
this.accountingExportService.importExpensesFromFyle('v1').subscribe();
3536
}

src/app/integrations/qbo/qbo-onboarding/qbo-onboarding-connector/qbo-onboarding-connector.component.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,23 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
158158
});
159159
}
160160

161+
private handlePostQBOConnection(qboCredential: QBOCredential): void {
162+
this.workspaceService.setOnboardingState(QBOOnboardingState.MAP_EMPLOYEES);
163+
this.qboConnectionInProgress = false;
164+
this.qboCompanyName = qboCredential.company_name;
165+
this.isQboConnected = true;
166+
this.qboTokenExpired = false;
167+
this.showOrHideDisconnectQBO();
168+
}
169+
161170
private postQboCredentials(code: string, realmId: string): void {
162171
const payload: QBOConnectorPost = QBOConnectorModel.constructPayload(code, realmId);
163172

164173
this.qboConnectorService.connectQBO(payload).subscribe((qboCredential: QBOCredential) => {
165174
this.qboHelperService.refreshQBODimensions().subscribe(() => {
166-
this.workspaceService.setOnboardingState(QBOOnboardingState.MAP_EMPLOYEES);
167-
this.qboConnectionInProgress = false;
168-
this.qboCompanyName = qboCredential.company_name;
169-
this.isQboConnected = true;
170-
this.qboTokenExpired = false;
171-
this.showOrHideDisconnectQBO();
175+
this.handlePostQBOConnection(qboCredential);
176+
}, () => {
177+
this.handlePostQBOConnection(qboCredential);
172178
});
173179
}, (error) => {
174180
const errorMessage = 'message' in error.error ? error.error.message : 'Failed to connect to QuickBooks Online. Please try again';

src/app/integrations/qbo/qbo-shared/qbo-advanced-settings/qbo-advanced-settings.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ <h4 class="tw-mb-12-px">Preview of the Description Field</h4>
160160
<app-configuration-step-footer
161161
[ctaText] = "!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING"
162162
[isButtonDisabled]="!advancedSettingForm.valid"
163-
[showBackButton]="true"
163+
[showBackButton]="isOnboarding ? true : false"
164164
(save)="save()"
165165
(navigateToPreviousStep)="navigateToPreviousStep()"></app-configuration-step-footer>
166166
</div>

src/app/integrations/qbo/qbo-shared/qbo-employee-settings/qbo-employee-settings.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<app-configuration-step-footer
4444
[ctaText]="!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING"
4545
[isButtonDisabled]="!employeeSettingForm.valid"
46-
[showBackButton]="true"
46+
[showBackButton]="isOnboarding ? true : false"
4747
(save)="save()"
4848
(navigateToPreviousStep)="navigateToPreviousStep()">
4949
</app-configuration-step-footer>

src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@
2929
[isFieldMandatory]="true"
3030
[mandatoryErrorListName]="'export module'"
3131
[label]="'How should the expenses be exported?'"
32+
[subLabel]="'Choose the type of transaction in QuickBooks Online to export your ' + brandingConfig.brandName +' expenses'"
3233
[options]="reimbursableExportTypes"
3334
[iconPath]="'expense'"
34-
[placeholder]="'Choose the type of transaction in QuickBooks Online to export your ' + brandingConfig.brandName +' expenses'"
35+
[placeholder]="'Select expense export type'"
3536
[formControllerName]="'reimbursableExportType'"
3637
[appName]="appName"
3738
[exportTypeIconPathArray]="previewImagePaths">
@@ -144,6 +145,7 @@
144145
[isFieldMandatory]="true"
145146
[mandatoryErrorListName]="'export module'"
146147
[label]="'How should the expenses be exported?'"
148+
[subLabel]="'Choose the type of transaction in QuickBooks Online to export your ' + brandingConfig.brandName +' expenses'"
147149
[options]="creditCardExportTypes"
148150
[iconPath]="'expense'"
149151
[placeholder]="'Select expense export type'"
@@ -272,7 +274,7 @@
272274
<app-configuration-step-footer
273275
[ctaText]="!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING"
274276
[isButtonDisabled]="!exportSettingForm.valid"
275-
[showBackButton]="true"
277+
[showBackButton]="isOnboarding ? true : false"
276278
(save)="save()"
277279
(navigateToPreviousStep)="navigateToPreviousStep()">
278280
</app-configuration-step-footer>

src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export class QboExportSettingsComponent implements OnInit {
228228
}
229229

230230
private setupCustomWatchers(): void {
231-
if (this.exportSettingForm.value.creditCardExportType) {
231+
if (this.exportSettingForm.value.creditCardExportType && [QBOCorporateCreditCardExpensesObject.CREDIT_CARD_PURCHASE, QBOCorporateCreditCardExpensesObject.DEBIT_CARD_EXPENSE].includes(this.exportSettingForm.value.creditCardExportType)) {
232232
this.updateCCCExpenseGroupingDateOptions(this.exportSettingForm.value.creditCardExportType);
233233
}
234234

src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ <h5 class="lg:tw-w-3/5 md:tw-w-1/2 tw-text-slightly-normal-text-color tw-text-14
9595
<app-configuration-step-footer
9696
[ctaText] = "!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING"
9797
[isButtonDisabled]="!importSettingForm.valid"
98-
[showBackButton]="true"
98+
[showBackButton]="isOnboarding ? true : false"
9999
(save)="save()"
100100
(navigateToPreviousStep)="navigateToPreviousStep()"></app-configuration-step-footer>
101101
</div>

src/app/integrations/sage300/sage300-main/sage300-export-log/sage300-complete-export-log/sage300-complete-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ export class Sage300CompleteExportLogComponent implements OnInit {
127127
this.trackDateFilter('existing', this.selectedDateFilter);
128128
this.getAccountingExports(paginator.limit, paginator.offset);
129129
} else {
130+
this.dateOptions = AccountingExportModel.getDateOptions();
131+
this.exportLogForm.controls.start.patchValue([]);
130132
this.selectedDateFilter = null;
131133
this.getAccountingExports(paginator.limit, paginator.offset);
132134
}

src/app/integrations/sage300/sage300-main/sage300-export-log/sage300-skipped-export-log/sage300-skipped-export-log.component.ts

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export class Sage300SkippedExportLogComponent implements OnInit {
113113

114114
this.trackDateFilter('existing', this.selectedDateFilter);
115115
this.getSkippedExpenses(paginator.limit, paginator.offset);
116+
this.dateOptions = AccountingExportModel.getDateOptions();
117+
this.skipExportLogForm.controls.start.patchValue([]);
116118
} else {
117119
this.selectedDateFilter = null;
118120
this.getSkippedExpenses(paginator.limit, paginator.offset);

src/app/integrations/oauth-callback/oauth-callback.component.spec.ts src/app/oauth/oauth-default/oauth-default.component.spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22

3-
import { OauthCallbackComponent } from './oauth-callback.component';
3+
import { OauthDefaultComponent } from './oauth-default.component';
44

5-
describe('OauthCallbackComponent', () => {
6-
let component: OauthCallbackComponent;
7-
let fixture: ComponentFixture<OauthCallbackComponent>;
5+
describe('OauthDefaultComponent', () => {
6+
let component: OauthDefaultComponent;
7+
let fixture: ComponentFixture<OauthDefaultComponent>;
88

99
beforeEach(async () => {
1010
await TestBed.configureTestingModule({
11-
declarations: [ OauthCallbackComponent ]
11+
declarations: [ OauthDefaultComponent ]
1212
})
1313
.compileComponents();
1414

15-
fixture = TestBed.createComponent(OauthCallbackComponent);
15+
fixture = TestBed.createComponent(OauthDefaultComponent);
1616
component = fixture.componentInstance;
1717
fixture.detectChanges();
1818
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, OnInit } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-oauth-default',
5+
templateUrl: './oauth-default.component.html',
6+
styleUrls: ['./oauth-default.component.scss']
7+
})
8+
export class OauthDefaultComponent implements OnInit {
9+
10+
constructor() { }
11+
12+
ngOnInit(): void {
13+
}
14+
15+
}

src/app/oauth/oauth-routing.module.ts

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { NgModule } from '@angular/core';
22
import { RouterModule, Routes } from '@angular/router';
33
import { OauthComponent } from './oauth.component';
44
import { OauthTravelperkComponent } from './oauth-travelperk/oauth-travelperk.component';
5+
import { OauthDefaultComponent } from './oauth-default/oauth-default.component';
56

67
const routes: Routes = [
78
{
@@ -11,6 +12,10 @@ const routes: Routes = [
1112
{
1213
path: 'travelperk',
1314
component: OauthTravelperkComponent
15+
},
16+
{
17+
path: 'default',
18+
component: OauthDefaultComponent
1419
}
1520
]
1621
}

src/app/oauth/oauth.module.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import { OauthRoutingModule } from './oauth-routing.module';
55
import { OauthComponent } from './oauth.component';
66
import { OauthTravelperkComponent } from './oauth-travelperk/oauth-travelperk.component';
77
import { SharedModule } from '../shared/shared.module';
8+
import { OauthDefaultComponent } from './oauth-default/oauth-default.component';
89

910

1011
@NgModule({
1112
declarations: [
1213
OauthComponent,
13-
OauthTravelperkComponent
14+
OauthTravelperkComponent,
15+
OauthDefaultComponent
1416
],
1517
imports: [
1618
CommonModule,

src/app/shared/components/configuration/configuration-select-field/configuration-select-field.component.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
<div>
99
<h5 class="tw-text-slightly-normal-text-color tw-text-14-px !tw-font-500">{{ label | snakeCaseToSpaceCase}}<app-mandatory-field *ngIf="isFieldMandatory"></app-mandatory-field></h5>
10-
<h5 *ngIf="formControllerName !== 'reimbursableExportType' && formControllerName!=='cccExportType' && formControllerName !== 'creditCardExportType'" class="!tw-text-faded-text-color tw-text-14-px tw-pt-8-px !tw-font-400 !tw-leading-4" [innerHTML]="subLabel"></h5>
11-
<h5 *ngIf="formControllerName === 'reimbursableExportType' || formControllerName === 'cccExportType' || formControllerName === 'creditCardExportType' && appName !== AppName.SAGE300" class="!tw-text-faded-text-color tw-text-14-px tw-pt-8-px !tw-font-400 !tw-leading-4">
12-
Choose the type of transaction record that you would like to create in {{ appName }} while exporting expenses from {{brandingConfig.brandName}}. <span *ngIf="exportTypeIconPath">Click<a (click)="showExportTable()" class="tw-cursor-pointer tw-text-hyperlink-color"> here</a> for more details.</span>
10+
<h5 *ngIf="subLabel || (formControllerName !== 'reimbursableExportType' && formControllerName!=='cccExportType' && formControllerName !== 'creditCardExportType')" class="!tw-text-faded-text-color tw-text-14-px tw-pt-8-px !tw-font-400 !tw-leading-4" [innerHTML]="subLabel"></h5>
11+
<h5 *ngIf="(formControllerName === 'reimbursableExportType' || formControllerName === 'cccExportType' || formControllerName === 'creditCardExportType') && appName !== AppName.SAGE300 && appName !== AppName.QBO" class="!tw-text-faded-text-color tw-text-14-px tw-pt-8-px !tw-font-400 !tw-leading-4">
12+
Choose the type of transaction record that you would like to create in {{ appName }} while exporting expenses from {{brandingConfig.brandName}}. <span *ngIf="exportTypeIconPath">Click<a (click)="showExportTable()" class="tw-cursor-pointer tw-text-hyperlink-color"> here</a> for more detailsss.</span>
1313
</h5>
1414
</div>
1515
</div>

src/app/shared/components/export-log/export-log-filter/export-log-filter.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
22
import { AbstractControl, FormGroup } from '@angular/forms';
33
import { AccountingExportModel } from 'src/app/core/models/db/accounting-export.model';
4-
import { DateFilter } from 'src/app/core/models/qbd/misc/date-filter.model';
4+
import { DateFilter, SelectedDateFilter } from 'src/app/core/models/qbd/misc/date-filter.model';
55
import { ExportLogService } from 'src/app/core/services/common/export-log.service';
66

77
@Component({
@@ -53,7 +53,7 @@ export class ExportLogFilterComponent implements OnInit {
5353
this.dateOptions[3].dateRange = this.exportLogForm.value.start[0].toLocaleDateString() + '-' + this.exportLogForm.value.start[1].toLocaleDateString();
5454
this.dateOptions[3].startDate = this.exportLogForm.value.start[0];
5555
this.dateOptions[3].endDate = this.exportLogForm.value.start[1];
56-
this.presentDate = this.dateOptions[3].dateRange;
56+
this.presentDate = new Date().toLocaleDateString();
5757
this.exportLogForm.controls.dateRange.patchValue(this.dateOptions[3]);
5858
}
5959

src/assets/sprites/sprite.svg

+1-1
Loading

0 commit comments

Comments
 (0)