Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/core/models/public-policy-expense.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Destination } from './destination.model';
import { PlatformCategory } from './platform/platform-category.model';
import { File } from './platform/v1/file.model';

export interface PublicPolicyExpense {
Expand All @@ -8,7 +9,7 @@ export interface PublicPolicyExpense {
amount: number;
billable: boolean;
bus_travel_class: string;
category: string;
category: Pick<PlatformCategory, 'code' | 'id' | 'display_name' | 'name' | 'sub_category' | 'system_category'>;
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Make category optional to match real payloads and avoid downstream crashes

PublicPolicyExpense now requires category, but several call-sites build tx without it (and even set category: null in add-edit-mileage). This mismatches usage and amplifies NPE risk when services read category.system_category.

Apply:

-  category: Pick<PlatformCategory, 'code' | 'id' | 'display_name' | 'name' | 'sub_category' | 'system_category'>;
+  category?: Pick<PlatformCategory, 'code' | 'id' | 'display_name' | 'name' | 'sub_category' | 'system_category'>;

Superstar tip: optional here, swagger there—peace everywhere.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
category: Pick<PlatformCategory, 'code' | 'id' | 'display_name' | 'name' | 'sub_category' | 'system_category'>;
// ... other fields ...
// Make `category` optional to reflect real payloads and prevent NPEs downstream
category?: Pick<
PlatformCategory,
'code' | 'id' | 'display_name' | 'name' | 'sub_category' | 'system_category'
>;
// ... remaining fields ...
🤖 Prompt for AI Agents
In src/app/core/models/public-policy-expense.model.ts around line 12, the
PublicPolicyExpense type currently requires category which contradicts runtime
payloads and causes NPEs; change the property to be optional (and allow null) —
e.g. make it category?: Pick<PlatformCategory, 'code' | 'id' | 'display_name' |
'name' | 'sub_category' | 'system_category'> | null — so callers that omit or
set null won’t break downstream code that reads category fields.

cost_center_id: number;
created_at: Date;
creator_id: string;
Expand All @@ -33,7 +34,6 @@ export interface PublicPolicyExpense {
flight_journey_travel_class: string;
flight_return_travel_class: string;
from_dt: Date;
fyle_category: string;
hotel_is_breakfast_provided: boolean;
id: string;
is_matching_ccc_expense: boolean;
Expand Down
1 change: 0 additions & 1 deletion src/app/core/models/v1/transaction.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ export interface Transaction {
flight_journey_travel_class?: string;
flight_return_travel_class?: string;
from_dt?: Date;
fyle_category?: string;
hotel_is_breakfast_provided?: boolean;
id?: string;
invoice_number?: number;
Expand Down
10 changes: 0 additions & 10 deletions src/app/core/services/custom-inputs.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,6 @@ describe('CustomInputsService', () => {
expect(result).toEqual(expectedProperty);
});

it('should fill dependent field properties', (done) => {
authService.getEou.and.resolveTo(authRespone);
spenderPlatformV1ApiService.get.and.returnValue(of(platformApiResponse));
const result = customInputsService.fillDependantFieldProperties(expensesWithDependentFields[0]);
result.subscribe((res) => {
expect(res).toEqual(filledDependentFields);
done();
});
});

it('should fill custom properties', (done) => {
authService.getEou.and.resolveTo(authRespone);
spenderPlatformV1ApiService.get.and.returnValue(of(platformApiResponse));
Expand Down
22 changes: 0 additions & 22 deletions src/app/core/services/custom-inputs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { from, Observable, Subject } from 'rxjs';
import { AuthService } from './auth.service';
import { ExpenseField } from '../models/v1/expense-field.model';
import { CustomField } from '../models/custom_field.model';
import { Expense } from '../models/expense.model';
import { SpenderPlatformV1ApiService } from './spender-platform-v1-api.service';
import { PlatformApiResponse } from '../models/platform/platform-api-response.model';
import { PlatformExpenseField } from '../models/platform/platform-expense-field.model';
Expand Down Expand Up @@ -181,27 +180,6 @@ export class CustomInputsService {
return displayValue;
}

fillDependantFieldProperties(etxn: Expense): Observable<CustomField[]> {
return this.getAll(true).pipe(
map((allCustomInputs) => allCustomInputs.filter((customInput) => customInput.type === 'DEPENDENT_SELECT')),
map((allCustomInputs) =>
allCustomInputs.map((customInput) => {
const customProperty = etxn.tx_custom_properties.find(
(txCustomProperty) => txCustomProperty.name === customInput.field_name,
);
return {
id: customInput.id,
name: customInput.field_name,
value: customProperty?.value,
type: customInput.type,
displayValue: customProperty?.value || '-',
mandatory: customInput.is_mandatory,
};
}),
),
);
}

private formatBooleanCustomProperty(customProperty: CustomField): string {
return customProperty.value
? this.translocoService.translate('services.customInputs.yes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,18 +354,18 @@ export class ExpensesService {
};

if (
transaction.fyle_category?.toLowerCase() === 'flight' ||
transaction.fyle_category?.toLowerCase() === 'airlines'
transaction.category?.system_category.toLowerCase() === 'flight' ||
transaction.category?.system_category.toLowerCase() === 'airlines'
) {
if (transaction.flight_journey_travel_class) {
expense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
expense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (transaction.fyle_category?.toLowerCase() === 'bus' && transaction.bus_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
expense.travel_classes.push(transaction.bus_travel_class);
} else if (transaction.fyle_category?.toLowerCase() === 'train' && transaction.train_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
expense.travel_classes.push(transaction.train_travel_class);
}
Comment on lines 356 to 370
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Normalize system_category once; avoid toLowerCase() on undefined

Same grenade here—defuse it with a single safe read.

-    if (
-      transaction.category?.system_category.toLowerCase() === 'flight' ||
-      transaction.category?.system_category.toLowerCase() === 'airlines'
-    ) {
+    const sysCat = transaction.category?.system_category?.toLowerCase();
+    if (sysCat === 'flight' || sysCat === 'airlines') {
       ...
-    } else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
+    } else if (sysCat === 'bus' && transaction.bus_travel_class) {
       ...
-    } else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
+    } else if (sysCat === 'train' && transaction.train_travel_class) {
       ...
     }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (
transaction.fyle_category?.toLowerCase() === 'flight' ||
transaction.fyle_category?.toLowerCase() === 'airlines'
transaction.category?.system_category.toLowerCase() === 'flight' ||
transaction.category?.system_category.toLowerCase() === 'airlines'
) {
if (transaction.flight_journey_travel_class) {
expense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
expense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (transaction.fyle_category?.toLowerCase() === 'bus' && transaction.bus_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
expense.travel_classes.push(transaction.bus_travel_class);
} else if (transaction.fyle_category?.toLowerCase() === 'train' && transaction.train_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
expense.travel_classes.push(transaction.train_travel_class);
}
// Normalize system_category once and safely handle undefined
const sysCat = transaction.category?.system_category?.toLowerCase();
if (sysCat === 'flight' || sysCat === 'airlines') {
if (transaction.flight_journey_travel_class) {
expense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
expense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (sysCat === 'bus' && transaction.bus_travel_class) {
expense.travel_classes.push(transaction.bus_travel_class);
} else if (sysCat === 'train' && transaction.train_travel_class) {
expense.travel_classes.push(transaction.train_travel_class);
}
🤖 Prompt for AI Agents
In src/app/core/services/platform/v1/spender/expenses.service.ts around lines
356 to 370, the code repeatedly calls
transaction.category?.system_category.toLowerCase() which can throw when
system_category is undefined; normalize it once by creating a safe lowercased
variable like const sysCat =
transaction.category?.system_category?.toLowerCase() || '' and then use sysCat
=== 'flight' etc. Update the conditional branches to reference sysCat for
comparisons and keep existing travel class push logic unchanged.


Expand Down
8 changes: 4 additions & 4 deletions src/app/core/services/policy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,18 @@ export class PolicyService {
};

if (
transaction.fyle_category?.toLowerCase() === 'flight' ||
transaction.fyle_category?.toLowerCase() === 'airlines'
transaction.category?.system_category.toLowerCase() === 'flight' ||
transaction.category?.system_category.toLowerCase() === 'airlines'
) {
if (transaction.flight_journey_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (transaction.fyle_category?.toLowerCase() === 'bus' && transaction.bus_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.bus_travel_class);
} else if (transaction.fyle_category?.toLowerCase() === 'train' && transaction.train_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.train_travel_class);
Comment on lines 69 to 82
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Guard system_category before toLowerCase(); otherwise one undefined and kaboom

If category exists but system_category is missing, toLowerCase() will throw. Normalize once and branch on a safe value.

Apply:

-    if (
-      transaction.category?.system_category.toLowerCase() === 'flight' ||
-      transaction.category?.system_category.toLowerCase() === 'airlines'
-    ) {
+    const sysCat = transaction.category?.system_category?.toLowerCase();
+    if (sysCat === 'flight' || sysCat === 'airlines') {
       ...
-    } else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
+    } else if (sysCat === 'bus' && transaction.bus_travel_class) {
       ...
-    } else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
+    } else if (sysCat === 'train' && transaction.train_travel_class) {
       ...
     }

Now the logic punches without missing.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (
transaction.fyle_category?.toLowerCase() === 'flight' ||
transaction.fyle_category?.toLowerCase() === 'airlines'
transaction.category?.system_category.toLowerCase() === 'flight' ||
transaction.category?.system_category.toLowerCase() === 'airlines'
) {
if (transaction.flight_journey_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (transaction.fyle_category?.toLowerCase() === 'bus' && transaction.bus_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.bus_travel_class);
} else if (transaction.fyle_category?.toLowerCase() === 'train' && transaction.train_travel_class) {
} else if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.train_travel_class);
const sysCat = transaction.category?.system_category?.toLowerCase();
if (sysCat === 'flight' || sysCat === 'airlines') {
if (transaction.flight_journey_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_journey_travel_class);
}
if (transaction.flight_return_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.flight_return_travel_class);
}
} else if (sysCat === 'bus' && transaction.bus_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.bus_travel_class);
} else if (sysCat === 'train' && transaction.train_travel_class) {
platformPolicyExpense.travel_classes.push(transaction.train_travel_class);
}
🤖 Prompt for AI Agents
In src/app/core/services/policy.service.ts around lines 69 to 82, the code calls
transaction.category?.system_category.toLowerCase() which will throw if
system_category is undefined; normalize once by creating a safe local variable
(e.g. const sys = transaction.category?.system_category?.toLowerCase() ?? '')
and then branch on sys for 'flight', 'airlines', 'bus', 'train'; keep the
existing checks that travel class properties exist before pushing them.

}

Expand Down
6 changes: 3 additions & 3 deletions src/app/core/services/split-expense.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export class SplitExpenseService {
}

transformSplitFlightClasses(transaction: Transaction, platformSplitObject: SplitPayload): void {
if (transaction.fyle_category?.toLowerCase() === 'airlines') {
if (transaction.category?.system_category.toLowerCase() === 'airlines') {
if (transaction.flight_journey_travel_class) {
platformSplitObject.travel_classes.push(transaction.flight_journey_travel_class);
}
Expand All @@ -207,13 +207,13 @@ export class SplitExpenseService {
}

tranformSplitBusClasses(transaction: Transaction, platformSplitObject: SplitPayload): void {
if (transaction.fyle_category?.toLowerCase() === 'bus' && transaction.bus_travel_class) {
if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
platformSplitObject.travel_classes.push(transaction.bus_travel_class);
}
}
Comment on lines +210 to 213
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same safety net for Bus

Mirror the safe normalization.

-  if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
+  const sysCat = transaction.category?.system_category?.toLowerCase();
+  if (sysCat === 'bus' && transaction.bus_travel_class) {
     platformSplitObject.travel_classes.push(transaction.bus_travel_class);
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (transaction.category?.system_category.toLowerCase() === 'bus' && transaction.bus_travel_class) {
platformSplitObject.travel_classes.push(transaction.bus_travel_class);
}
}
const sysCat = transaction.category?.system_category?.toLowerCase();
if (sysCat === 'bus' && transaction.bus_travel_class) {
platformSplitObject.travel_classes.push(transaction.bus_travel_class);
}
}
🤖 Prompt for AI Agents
In src/app/core/services/split-expense.service.ts around lines 210 to 213, the
bus branch currently pushes transaction.bus_travel_class directly; mirror the
safe normalization used elsewhere by first checking that bus_travel_class is
defined/truthy, normalizing it (trim and lowercase) and only then pushing the
normalized value into platformSplitObject.travel_classes to avoid null/undefined
entries and inconsistent casing.


transformSplitTrainClasses(transaction: Transaction, platformSplitObject: SplitPayload): void {
if (transaction.fyle_category?.toLowerCase() === 'train' && transaction.train_travel_class) {
if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
platformSplitObject.travel_classes.push(transaction.train_travel_class);
}
}
Comment on lines +216 to 219
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Same safety net for Train

Mirror the safe normalization.

-  if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
+  const sysCat = transaction.category?.system_category?.toLowerCase();
+  if (sysCat === 'train' && transaction.train_travel_class) {
     platformSplitObject.travel_classes.push(transaction.train_travel_class);
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (transaction.category?.system_category.toLowerCase() === 'train' && transaction.train_travel_class) {
platformSplitObject.travel_classes.push(transaction.train_travel_class);
}
}
const sysCat = transaction.category?.system_category?.toLowerCase();
if (sysCat === 'train' && transaction.train_travel_class) {
platformSplitObject.travel_classes.push(transaction.train_travel_class);
}
}
🤖 Prompt for AI Agents
In src/app/core/services/split-expense.service.ts around lines 216 to 219, the
code calls toLowerCase() on transaction.category.system_category without the
same safety checks used elsewhere and pushes train_travel_class without
normalization; change the condition to use optional chaining when lowercasing:
transaction.category?.system_category?.toLowerCase() === 'train', and when
pushing, guard and normalize the value (e.g. if (transaction.train_travel_class)
platformSplitObject.travel_classes.push(transaction.train_travel_class?.toLowerCase().trim()));
this mirrors the safe normalization pattern used for other categories.

Expand Down
34 changes: 0 additions & 34 deletions src/app/core/services/transaction.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,18 +394,6 @@ describe('TransactionService', () => {
expect(transactionService.generateStateOrFilter(filters, params)).toEqual(stateOrFilter);
});

it('generateTypeOrFilter(): should generate type Or filters', () => {
const filters = { type: ['Mileage', 'PerDiem', 'RegularExpenses'] };
const typeOrFilter = [
'tx_fyle_category.eq.Mileage',
'tx_fyle_category.eq.Per Diem',
'and(tx_fyle_category.not.eq.Mileage, tx_fyle_category.not.eq.Per Diem)',
];

// @ts-ignore
expect(transactionService.generateTypeOrFilter(filters)).toEqual(typeOrFilter);
});

it('getPaymentModeforEtxn(): should return payment mode for etxn', () => {
spyOn(transactionService, 'isEtxnInPaymentMode').and.returnValue(true);
const paymentModeList = [
Expand Down Expand Up @@ -633,28 +621,6 @@ describe('TransactionService', () => {
expect(transactionService.getPaymentModeForEtxn).toHaveBeenCalledTimes(3);
});

it('generateTypeFilters(): should generate type filters', () => {
const filters = { type: ['Mileage', 'PerDiem', 'RegularExpenses'] };
const newQueryParams = { or: [] };
const typeOrFilterRes = [
'tx_fyle_category.eq.Mileage',
'tx_fyle_category.eq.Per Diem',
'and(tx_fyle_category.not.eq.Mileage, tx_fyle_category.not.eq.Per Diem)',
];
spyOn(lodash, 'cloneDeep').and.returnValue(newQueryParams);
// @ts-ignore
spyOn(transactionService, 'generateTypeOrFilter').and.returnValue(typeOrFilterRes);

expect(transactionService.generateTypeFilters(newQueryParams, filters)).toEqual({
or: [
'(tx_fyle_category.eq.Mileage, tx_fyle_category.eq.Per Diem, and(tx_fyle_category.not.eq.Mileage, tx_fyle_category.not.eq.Per Diem))',
],
});
expect(lodash.cloneDeep).toHaveBeenCalledOnceWith(newQueryParams);
// @ts-ignore
expect(transactionService.generateTypeOrFilter).toHaveBeenCalledOnceWith(filters);
});

it('unmatchCCCExpense(): should unmatch ccc expense', (done) => {
spenderPlatformV1ApiService.post.and.returnValue(of(unmatchCCCExpenseResponseData));

Expand Down
42 changes: 0 additions & 42 deletions src/app/core/services/transaction.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable, inject } from '@angular/core';
import { ApiService } from './api.service';
import { DateService } from './date.service';
import { map, switchMap, tap, catchError } from 'rxjs/operators';
import { StorageService } from './storage.service';
Expand All @@ -12,8 +11,6 @@ import { CacheBuster } from 'ts-cacheable';
import { UserEventService } from './user-event.service';

import { cloneDeep } from 'lodash';
import { DateFilters } from 'src/app/shared/components/fy-filters/date-filters.enum';
import { PAGINATION_SIZE } from 'src/app/constants';
import { PaymentModesService } from './payment-modes.service';
import { OrgSettingsService } from './org-settings.service';
import { AccountsService } from './accounts.service';
Expand All @@ -25,7 +22,6 @@ import { FileObject } from '../models/file-obj.model';
import { UnflattenedTransaction } from '../models/unflattened-transaction.model';
import { CurrencySummary } from '../models/currency-summary.model';
import { FilterQueryParams } from '../models/filter-query-params.model';
import { SortFiltersParams } from '../models/sort-filters-params.model';
import { PaymentModeSummary } from '../models/payment-mode-summary.model';
import { TxnCustomProperties } from '../models/txn-custom-properties.model';
import { PlatformMissingMandatoryFields } from '../models/platform/platform-missing-mandatory-fields.model';
Expand All @@ -46,12 +42,8 @@ import { TranslocoService } from '@jsverse/transloco';
providedIn: 'root',
})
export class TransactionService {
private paginationSize = inject(PAGINATION_SIZE);

private storageService = inject(StorageService);

private apiService = inject(ApiService);

private dateService = inject(DateService);

private platformEmployeeSettingsService = inject(PlatformEmployeeSettingsService);
Expand Down Expand Up @@ -476,19 +468,6 @@ export class TransactionService {
return newQueryParamsCopy;
}

generateTypeFilters(newQueryParams: FilterQueryParams, filters: Partial<ExpenseFilters>): FilterQueryParams {
const newQueryParamsCopy = cloneDeep(newQueryParams);
const typeOrFilter = this.generateTypeOrFilter(filters);

if (typeOrFilter.length > 0) {
let combinedTypeOrFilter = typeOrFilter.reduce((param1, param2) => `${param1}, ${param2}`);
combinedTypeOrFilter = `(${combinedTypeOrFilter})`;
(newQueryParamsCopy.or as string[]).push(combinedTypeOrFilter);
}

return newQueryParamsCopy;
}

getPaymentModeWiseSummary(etxns: Expense[]): PaymentModeSummary {
const paymentModes = [
{
Expand Down Expand Up @@ -607,7 +586,6 @@ export class TransactionService {
categoryDisplayName: expense.category?.display_name,
files: expense.files,
category: expense.category,
fyle_category: expense.category?.system_category,
state: expense.state,
admin_amount: expense.admin_amount,
policy_amount: expense.policy_amount,
Expand Down Expand Up @@ -769,26 +747,6 @@ export class TransactionService {
return stateOrFilter;
}

private generateTypeOrFilter(filters: Partial<ExpenseFilters>): string[] {
const typeOrFilter: string[] = [];
if (filters.type) {
if (filters.type.includes('Mileage')) {
typeOrFilter.push('tx_fyle_category.eq.Mileage');
}

if (filters.type.includes('PerDiem')) {
// The space encoding is done by angular into %20 so no worries here
typeOrFilter.push('tx_fyle_category.eq.Per Diem');
}

if (filters.type.includes('RegularExpenses')) {
typeOrFilter.push('and(tx_fyle_category.not.eq.Mileage, tx_fyle_category.not.eq.Per Diem)');
}
}

return typeOrFilter;
}

// to be used only when updating created expense with form values during capture recept flow
private cleanupExpensePayload(txn: Partial<Transaction>): Partial<Transaction> {
const newTxn: Partial<Transaction> = {};
Expand Down
1 change: 0 additions & 1 deletion src/app/core/services/transactions-outbox.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { CurrencyService } from './currency.service';
import { Transaction } from '../models/v1/transaction.model';
import { FileObject } from '../models/file-obj.model';
import { OutboxQueue } from '../models/outbox-queue.model';
import { ParsedResponse } from '../models/parsed_response.model';
import { SpenderFileService } from './platform/v1/spender/file.service';
import { ApproverFileService } from './platform/v1/approver/file.service';
import { PlatformFile } from '../models/platform/platform-file.model';
Expand Down
Loading
Loading