Tahesab: show raw data from Tahesab, invoice-style document view with metal labels

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-08 13:49:54 +03:30
co-authored by Cursor
parent 2f3646d085
commit e6755d0c2e
4 changed files with 608 additions and 100 deletions
@@ -6,7 +6,7 @@ import {
import { Prisma } from '@prisma/client';
import { PrismaService } from '../../prisma/prisma.service';
import { TahesabConnectionsService } from './connections.service';
import { normalizeMandehResponse } from './tahesab-methods';
import { extractMandehRaw, normalizeMandehResponse } from './tahesab-methods';
@Injectable()
export class TahesabBalanceService {
@@ -78,11 +78,14 @@ export class TahesabBalanceService {
data: { lastBalanceSyncedAt: cache.fetchedAt },
});
const rawView = extractMandehRaw(raw);
return {
connectionId: resolvedId,
connectionLabel: link.connection.label,
dbName: link.connection.dbName,
moshtariCode: link.moshtariCode,
mandehFields: rawView.fields,
mandehDetailRaw: rawView.details,
goldBalance: normalized.goldBalance,
rialBalance: normalized.rialBalance,
currencyBalance: normalized.currencyBalance,
@@ -116,11 +119,14 @@ export class TahesabBalanceService {
return this.getAssets(organizationId, personId, connectionId);
}
const c = link.balanceCache;
const rawView = extractMandehRaw(c.rawResponse);
return {
connectionId: resolvedId,
connectionLabel: link.connection.label,
dbName: link.connection.dbName,
moshtariCode: link.moshtariCode,
mandehFields: rawView.fields,
mandehDetailRaw: rawView.details,
goldBalance: c.goldBalance,
rialBalance: c.rialBalance,
currencyBalance: c.currencyBalance,