Conversation
| } | ||
| } | ||
|
|
||
| public async getMerchantIds(location_id: number): Promise<number[]> { |
There was a problem hiding this comment.
this should be getMerchantIdsByLocationId()
vyasworks
left a comment
There was a problem hiding this comment.
I understand this is a draft PR.
I have added my comments (you might have already considered them or they may be obvious)
I think this is in a good shape to work on top of too add more layers and heuristics
|
|
||
| public async getMerchantIds(location_id: number): Promise<number[]> { | ||
| const merchant_ids = await this.transactionRepo.manager.query(` | ||
| SELECT DISTINCT "Merchant ID" |
There was a problem hiding this comment.
This function should be in location service
| SELECT DISTINCT "Merchant ID" | ||
| FROM public.master_location_data ml | ||
| WHERE ml."GARMS Location" = ${location_id} | ||
| AND "Type" != 'Bank' |
There was a problem hiding this comment.
add Bank in constants.ts
| return merchant_ids.map((itm: any) => parseInt(itm['Merchant ID'])); | ||
| } | ||
|
|
||
| public async getPTIDs(location_id: number): Promise<string[]> { |
There was a problem hiding this comment.
The naming is unclear here, should it be getPTLocdByGarmsLocId
|
|
||
| public async getPTIDs(location_id: number): Promise<string[]> { | ||
| const pt_ids = await this.transactionRepo.manager.query(` | ||
| SELECT DISTINCT "Location" |
There was a problem hiding this comment.
Fn shd be in location service
| SELECT DISTINCT "Location" | ||
| FROM public.master_location_data ml | ||
| WHERE ml."GARMS Location" = ${location_id} | ||
| `); |
There was a problem hiding this comment.
Location Repository should be able to query this without a RAW query?
| } | ||
|
|
||
| public async getMethod(sbc_code: number) { | ||
| const payment_method = await this.paymentMethodRepo.findOne({ |
There was a problem hiding this comment.
Shd live in payment Service
| } | ||
|
|
||
| public async reconcilePOS(date: string, location_id: number) { | ||
| const locations = await this.getLocationList(); |
There was a problem hiding this comment.
Semantics are confusing here, making it hard to read a bit.
the parameter location_id -> denotes pos location or garms loc?
| } | ||
| } | ||
|
|
||
| public async reconcilePOS(date: string, location_id: number) { |
There was a problem hiding this comment.
Should we name this reconcilePOSBySalesLocation?
Also, this is a great example of what I call Layer
| } | ||
| } | ||
|
|
||
| async queryCashTransactions( |
There was a problem hiding this comment.
Unsure about the function of this query in this service, please clarify.
There was a problem hiding this comment.
This should return all of the payments for Cash/Cheque (to match against TDI17).
I am trying to query by the current and last deposit dates. This will probably need to be changed. I have not yet found a rule for date range that works for each location.
We should add a and match=false. Maybe then we can query for anything less than the current deposit date, as all of the previous payments should be accounted for? (and if they are not then an exception could be thrown?)
| (a: any, b: any) => a + parseFloat(b.transaction_amt), | ||
| 0 | ||
| ); | ||
|
|
There was a problem hiding this comment.
We can add line by line matching here?
ce4bc8c to
9599e1d
Compare
|
|
||
| //TODO this is temporary for testing the parsed garms json only | ||
| async readAndParseGarms(filename: string, filebuffer: Buffer) { | ||
| // TODO define return type |
There was a problem hiding this comment.
Define Return Types/Outputs
Add another match layer
* added types * set match true in db * updated return types
|
WIP Merge... Follwup PR to fix issues |
No description provided.