Skip to content

Commit

Permalink
fix: Remove old personal card model - 1 (#3397) (#3403)
Browse files Browse the repository at this point in the history
* fix: remove old getPersonalCardsCount method

* remove old getPersonalCards method

* replace use of PersonalCard model with PlatformPersonalCard

* fix: delete personal_card.model.ts and places where it was used (#3398)

* delete personal_card.model.ts and places where it was used

* fix: remove model PersonalCardTxnExpenseSuggestion (#3399)

* fix: remove model PersonalCardTxnExpenseSuggestion

* fix: transform personal card public queryParams to platform (#3400)

* fix: transform personal card public queryParams to platform

* fix: remove use of old PersonalCardTxn model (#3401)

* remove use of old PersonalCardTxn model

* delete public PersonalCardTxn model and corresponding ldFlag (#3402)
  • Loading branch information
sumrender authored Jan 6, 2025
1 parent 31d01b5 commit d4498f0
Show file tree
Hide file tree
Showing 35 changed files with 574 additions and 1,801 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import deepFreeze from 'deep-freeze-strict';

import { GetTasksQueryParamsWithFilters } from '../models/get-tasks-query-params-with-filters.model';
import { PlatformPersonalCardFilterParams } from '../models/platform/platform-personal-card-filter-params.model';

export const tasksQueryParamsWithFiltersData: Partial<GetTasksQueryParamsWithFilters> = deepFreeze({
pageNumber: 1,
Expand Down Expand Up @@ -32,11 +33,11 @@ export const tasksQueryParamsWithFiltersData3: Partial<GetTasksQueryParamsWithFi
},
});

export const personalCardQueryParamFiltersData: Partial<GetTasksQueryParamsWithFilters> = deepFreeze({
export const personalCardQueryParamFiltersData: Partial<PlatformPersonalCardFilterParams> = deepFreeze({
pageNumber: 1,
queryParams: {
or: [],
btxn_status: 'in.(DEBIT)',
ba_id: 'eq.baccY70V3Mz048',
state: 'in.(INITIALIZED)',
personal_card_id: 'eq.baccY70V3Mz048',
},
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import deepFreeze from 'deep-freeze-strict';
import { PersonalCardTxnExpenseSuggestion } from '../models/personal-card-txn-expense-suggestion.model';
import { PlatformApiResponse } from '../models/platform/platform-api-response.model';
import { Expense } from '../models/platform/v1/expense.model';
import { ApprovalState } from '../models/platform/report-approvals.model';
import { AccountType } from '../models/platform/v1/account.model';
import { ExpenseState } from '../models/expense-state.enum';

export const platformPersonalCardTxnExpenseSuggestionsRes = deepFreeze({
export const platformPersonalCardTxnExpenseSuggestionsRes: PlatformApiResponse<Expense[]> = deepFreeze({
data: [
{
accounting_export_summary: {},
Expand All @@ -18,7 +22,7 @@ export const platformPersonalCardTxnExpenseSuggestionsRes = deepFreeze({
id: 'usRjTPO4r69K',
},
approver_user_id: 'usRjTPO4r69K',
state: 'APPROVAL_PENDING',
state: ApprovalState.APPROVAL_PENDING,
},
],
approver_comments: [],
Expand All @@ -42,7 +46,7 @@ export const platformPersonalCardTxnExpenseSuggestionsRes = deepFreeze({
name: 'test-1',
},
cost_center_id: 6335,
created_at: '2024-10-24T10:34:31.922365+00:00',
created_at: new Date('2024-10-24T10:34:31.922365+00:00'),
creator_user_id: 'us2KhpQLpzX4',
currency: 'USD',
custom_fields: [],
Expand Down Expand Up @@ -160,14 +164,14 @@ export const platformPersonalCardTxnExpenseSuggestionsRes = deepFreeze({
source: 'WEBAPP',
source_account: {
id: 'acc8vyjNsN3zh',
type: 'PERSONAL_CASH_ACCOUNT',
type: AccountType.PERSONAL_CASH_ACCOUNT,
},
source_account_id: 'acc8vyjNsN3zh',
spent_at: new Date('2024-09-11T00:00:00+00:00'),
split_group_amount: null,
split_group_id: 'txhoujHIA4OD',
started_at: null,
state: 'DRAFT',
state: ExpenseState.DRAFT,
state_display_name: 'Incomplete',
tax_amount: 16.83,
tax_group: {
Expand All @@ -176,7 +180,7 @@ export const platformPersonalCardTxnExpenseSuggestionsRes = deepFreeze({
},
tax_group_id: 'tg6RDX1flCnt',
travel_classes: [],
updated_at: '2024-10-24T10:34:36.313431+00:00',
updated_at: new Date('2024-10-24T10:34:36.313431+00:00'),
user: {
email: 'kavya.hl@fyle.in',
full_name: 'Kavya 2',
Expand All @@ -199,20 +203,3 @@ export const platformPersonalCardTxnExpenseSuggestions = deepFreeze([
split_group_id: 'txhoujHIA4OD',
},
]);

export const publicPersonalCardTxnExpenseSuggestionsRes: PersonalCardTxnExpenseSuggestion[] = deepFreeze([
{
id: 'txsZt7eBrWHN',
txn_dt: new Date('2024-09-14T00:00:00.000Z'),
amount: 20,
currency: 'USD',
split_group_id: 'txsZt7eBrWHN',
split_group_user_amount: 20,
orig_amount: null,
orig_currency: null,
purpose: 'sumrender ONLINE SUBSCRIPTION',
vendor: 'ONLINE SUBSCRIPTION',
ranking: 1,
distance: 0.0,
},
]);
194 changes: 59 additions & 135 deletions src/app/core/mock-data/personal-card-txns.data.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,53 @@
import deepFreeze from 'deep-freeze-strict';

import { PersonalCardTxn } from '../models/personal_card_txn.model';
import { ApiV2Response } from '../models/v2/api-v2-response.model';
import { PlatformApiResponse } from '../models/platform/platform-api-response.model';
import { PlatformPersonalCardTxn } from '../models/platform/platform-personal-card-txn.model';
import { PlatformPersonalCardTxnState } from '../models/platform/platform-personal-card-txn-state.enum';
import { PlatformPersonalCardMatchedExpense } from '../models/platform/platform-personal-card-matched-expense.model';
import { TxnDetail } from '../models/v2/txn-detail.model';
import { PlatformPersonalCardQueryParams } from '../models/platform/platform-personal-card-query-params.model';

export const apiPersonalCardTxnsRes: ApiV2Response<PersonalCardTxn> = deepFreeze({
count: 1,
export const platformPersonalCardTxns: PlatformApiResponse<PlatformPersonalCardTxn[]> = deepFreeze({
count: 3,
data: [
{
_search_document:
"'200':1 '200.00':2 'card':5 'debit':4,18 'huskyteambkstore':11 'purchase':6 'usd':3 'wa':16 'xx':8 'xx/xx':7 'xxp':9 'xxx':13,14 'xxx-xxx-xxxx':12 'xxxx':15 'xxxxuw':10 'xxxxx':17",
ba_account_number: 'xxxx2345',
ba_bank_name: 'Dag Site yodlee',
ba_id: 'baccLesaRlyvLY',
ba_mask: '2345',
ba_nickname: 'Robin',
btxn_amount: 200,
btxn_created_at: new Date('2021-11-11T06:42:30.129062'),
btxn_currency: 'USD',
btxn_description: 'Debit Card Purchase XX/XX XX:XXp #XXXXUW HUSKYTEAMBKSTORE XXX-XXX-XXXX WA XXXXX',
btxn_external_id: '31703918',
btxn_id: 'btxn6Kur2OMWeq',
btxn_orig_amount: null,
btxn_orig_currency: null,
btxn_status: 'HIDDEN',
btxn_transaction_dt: new Date('2021-09-19T10:00:00'),
btxn_transaction_type: 'debit',
btxn_updated_at: new Date('2022-03-04T07:34:52.408835'),
btxn_vendor: null,
tx_matched_at: null,
tx_split_group_id: null,
txn_details: null,
},
],
limit: 1,
offset: 0,
url: '/v2/personal_bank_transactions',
});

export const matchedPersonalCardTxn: PersonalCardTxn = deepFreeze({
_search_document:
"'200':1 '200.00':2 'card':5 'debit':4,18 'huskyteambkstore':11 'purchase':6 'usd':3 'wa':16 'xx':8 'xx/xx':7 'xxp':9 'xxx':13,14 'xxx-xxx-xxxx':12 'xxxx':15 'xxxxuw':10 'xxxxx':17",
ba_account_number: 'xxxx2345',
ba_bank_name: 'Dag Site yodlee',
ba_id: 'baccLesaRlyvLY',
ba_mask: '2345',
ba_nickname: 'Robin',
btxn_amount: 200,
btxn_created_at: new Date('2021-11-11T06:42:30.129062'),
btxn_currency: 'USD',
btxn_description: 'Debit Card Purchase XX/XX XX:XXp #XXXXUW HUSKYTEAMBKSTORE XXX-XXX-XXXX WA XXXXX',
btxn_external_id: '31703918',
btxn_id: 'btxn6Kur2OMWeq',
btxn_orig_amount: null,
btxn_orig_currency: null,
btxn_status: 'MATCHED',
btxn_transaction_dt: new Date('2021-09-19T10:00:00'),
btxn_transaction_type: 'debit',
btxn_updated_at: new Date('2022-03-04T07:34:52.408835'),
btxn_vendor: null,
tx_matched_at: null,
tx_split_group_id: null,
txn_details: [
{
amount: 57.69,
category: 'Bus',
category_display_name: 'Bus / Travelling - Inland',
transactionType: 'debit',
amount: 200.0,
category: 'Restaurants/Dining',
created_at: new Date('2024-11-21T05:27:51.863181+00:00'),
currency: 'USD',
expense_number: 'E/2022/07/T/48',
id: 'txhLBlo6XN4k',
num_files: 0,
purpose: 'ADOBE *CREATIVE CLOUD',
state: 'APPROVED',
sub_category: 'Travelling - Inland',
txn_dt: new Date('2019-06-19T06:30:00'),
user_can_delete: true,
vendor_id: 29200,
vendor_name: 'Office & Shipping',
description: 'mocha',
external_transaction_id: '57690734',
foreign_amount: null,
foreign_currency: null,
id: 'btxndbZdAth0x4',
matched_expense_ids: ['txjhfqMX9YuB'],
matched_expenses: [
{
amount: 200,
category_display_name: 'Unspecified',
currency: 'USD',
foreign_amount: null,
foreign_currency: null,
id: 'txjhfqMX9YuB',
merchant: 'Mocha',
no_of_files: 0,
purpose: 'mocha',
seq_num: 'E/2024/11/T/7',
spent_at: new Date('2024-09-22T00:00:00+00:00'),
state: 'COMPLETE',
},
],
merchant: 'Mocha',
org_id: 'orrb8EW1zZsy',
personal_card_id: 'bacczUA0bUKVTD',
spent_at: new Date('2024-09-22T00:00:00+00:00'),
state: PlatformPersonalCardTxnState.INITIALIZED,
updated_at: new Date('2024-11-26T04:44:17.825002+00:00'),
user_id: 'us2KhpQLpzX4',
},
],
});

export const platformPersonalCardTxns: PlatformApiResponse<PlatformPersonalCardTxn[]> = deepFreeze({
count: 2,
data: [
{
transactionType: 'debit',
amount: 200.0,
category: 'Restaurants/Dining',
created_at: new Date('2024-11-21T05:27:51.863181+00:00'),
Expand All @@ -98,7 +56,7 @@ export const platformPersonalCardTxns: PlatformApiResponse<PlatformPersonalCardT
external_transaction_id: '57690734',
foreign_amount: null,
foreign_currency: null,
id: 'btxndbZdAth0x4',
id: 'btxndbZdAth0x5',
matched_expense_ids: ['txjhfqMX9YuB'],
matched_expenses: [
{
Expand All @@ -120,7 +78,28 @@ export const platformPersonalCardTxns: PlatformApiResponse<PlatformPersonalCardT
org_id: 'orrb8EW1zZsy',
personal_card_id: 'bacczUA0bUKVTD',
spent_at: new Date('2024-09-22T00:00:00+00:00'),
state: 'MATCHED' as PlatformPersonalCardTxnState,
state: PlatformPersonalCardTxnState.MATCHED,
updated_at: new Date('2024-11-26T04:44:17.825002+00:00'),
user_id: 'us2KhpQLpzX4',
},
{
transactionType: 'debit',
amount: 200.0,
category: 'Restaurants/Dining',
created_at: new Date('2024-11-21T05:27:51.863181+00:00'),
currency: 'USD',
description: 'mocha',
external_transaction_id: '57690734',
foreign_amount: null,
foreign_currency: null,
id: 'btxndbZdAth0x6',
matched_expense_ids: [],
matched_expenses: [],
merchant: 'Coffee',
org_id: 'orrb8EW1zZsy',
personal_card_id: 'bacczUA0bUKVTD',
spent_at: new Date('2024-09-22T00:00:00+00:00'),
state: PlatformPersonalCardTxnState.INITIALIZED,
updated_at: new Date('2024-11-26T04:44:17.825002+00:00'),
user_id: 'us2KhpQLpzX4',
},
Expand Down Expand Up @@ -166,44 +145,6 @@ export const platformMatchExpenseResponse: PlatformApiResponse<PlatformPersonalC
},
});

export const transformedPlatformPersonalCardTxns: Partial<ApiV2Response<PersonalCardTxn>> = deepFreeze({
count: 2,
offset: 0,
data: [
{
btxn_id: 'btxndbZdAth0x4',
btxn_created_at: new Date('2024-11-21T05:27:51.863Z'),
btxn_updated_at: new Date('2024-11-26T04:44:17.825Z'),
ba_id: 'bacczUA0bUKVTD',
btxn_amount: 200,
btxn_currency: 'USD',
btxn_description: 'mocha',
btxn_external_id: '57690734',
btxn_transaction_dt: new Date('2024-09-22T00:00:00.000Z'),
btxn_orig_amount: null,
btxn_orig_currency: null,
btxn_status: 'MATCHED',
btxn_vendor: 'Mocha',
tx_split_group_id: 'txjhfqMX9YuB',
btxn_transaction_type: 'debit',
ba_account_number: 'manually add',
txn_details: [
{
amount: 200,
currency: 'USD',
expense_number: 'E/2024/11/T/7',
category_display_name: 'Unspecified',
id: 'txjhfqMX9YuB',
num_files: 0,
purpose: 'mocha',
state: 'COMPLETE',
txn_dt: new Date('2024-09-22T00:00:00.000Z'),
},
],
},
],
});

export const matchedExpensesPlatform: PlatformPersonalCardMatchedExpense[] = deepFreeze([
{
amount: 200,
Expand Down Expand Up @@ -235,14 +176,6 @@ export const transformedMatchedExpenses: TxnDetail[] = deepFreeze([
},
]);

export const publicQueryParams = deepFreeze({
btxn_status: 'MATCHED',
ba_id: 'btxndbZdAth0x4',
_search_document: 'fts.query',
amount: '100',
or: ['amount', 'state'],
});

export const platformQueryParams: PlatformPersonalCardQueryParams = deepFreeze({
state: 'MATCHED',
personal_card_id: 'btxndbZdAth0x4',
Expand All @@ -251,15 +184,6 @@ export const platformQueryParams: PlatformPersonalCardQueryParams = deepFreeze({
q: 'query',
});

export const publicTxnsConfig = deepFreeze({
offset: 0,
limit: 10,
queryParams: {
btxn_status: 'in.(MATCHED)',
ba_id: 'eq.baccLesaRlyvLY',
},
});

export const platformTxnsConfig = deepFreeze({
offset: 0,
limit: 10,
Expand Down
Loading

0 comments on commit d4498f0

Please sign in to comment.