Skip to content

Commit

Permalink
fix: send only name and value in check_policies and expenses calls (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunaj5 authored Feb 6, 2025
1 parent ff2aacf commit 7081b9d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 23 deletions.
21 changes: 0 additions & 21 deletions src/app/core/mock-data/platform-policy-expense.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,32 +159,11 @@ export const platformPolicyExpenseData2: PlatformPolicyExpense = deepFreeze({
],
custom_fields: [
{
id: 174083,
mandatory: false,
name: 'userlist test',
options: [],
placeholder: 'userlist test',
prefix: '',
type: 'USER_LIST',
value: null,
},
{
id: 218778,
mandatory: false,
name: 'select type field',
options: [
{
label: 'select-1',
value: 'select-1',
},
{
label: 'select-2',
value: 'select-2',
},
],
placeholder: 'select custom field',
prefix: '',
type: 'SELECT',
value: 'select-1',
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,10 @@ export class ExpensesService {
started_at: transaction.from_dt,
ended_at: transaction.to_dt,
locations: transaction.locations as unknown as Location[],
custom_fields: transaction.custom_properties,
custom_fields: transaction.custom_properties.map((customProperty) => ({
name: customProperty.name,
value: customProperty.value,
})),
per_diem_rate_id: transaction.per_diem_rate_id,
per_diem_num_days: transaction.num_days || 0,
mileage_rate_id: transaction.mileage_rate_id, // @arjun check if this is present
Expand Down
6 changes: 5 additions & 1 deletion src/app/core/services/policy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { cloneDeep } from 'lodash';
import { CategoriesService } from './categories.service';
import { FileObject } from '../models/file-obj.model';
import { MatchedCCCTransaction } from '../models/matchedCCCTransaction.model';
import { TxnCustomProperties } from '../models/txn-custom-properties.model';

@Injectable({
providedIn: 'root',
Expand Down Expand Up @@ -46,7 +47,10 @@ export class PolicyService {
distance: transaction.distance,
distance_unit: transaction.distance_unit,
locations: txnLocations?.filter((location) => !!location),
custom_fields: transaction.custom_properties,
custom_fields: transaction.custom_properties.map((customProperty: TxnCustomProperties) => ({
name: customProperty.name,
value: customProperty.value,
})),
started_at: transaction.from_dt,
ended_at: transaction.to_dt,
per_diem_rate_id: transaction.per_diem_rate_id,
Expand Down

0 comments on commit 7081b9d

Please sign in to comment.