Fix asnad via root POST like Hamkar; show accounting code label.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-09-05 11:27:42 +03:30
co-authored by Cursor
parent 3ab102ddae
commit 8f9a00f319
3 changed files with 42 additions and 20 deletions
@@ -224,15 +224,37 @@ export class TahesabApi {
fromShamsi: string,
toShamsi: string,
) {
// مثل همکار: فقط ۴ پارامتر (Count_Last, Code, از, تا) — پارامتر اضافه باعث خطای ته‌حساب می‌شود
return this.call(
'DoListAsnad',
'DoListAsnad',
[countLast, moshtariCode, fromShamsi, toShamsi],
'POST',
55_000,
{ emptyResultOnError: /رکوردی یافت نشد/i },
);
// همکار: POST به baseUrl بدون path، با کلید body = DoListAsnad و ۴ آرگومان
const args = [countLast, moshtariCode, fromShamsi, toShamsi];
const empty = { emptyResultOnError: /رکوردی یافت نشد/i };
const timeoutMs = 55_000;
const rootCall = () =>
this.http.call({
...this.creds,
path: '',
bodyKey: 'DoListAsnad',
args,
method: 'POST' as const,
timeoutMs,
...empty,
});
const pathCall = () =>
this.http.call({
...this.creds,
path: 'DoListAsnad',
bodyKey: 'DoListAsnad',
args,
method: 'POST' as const,
timeoutMs,
...empty,
});
return rootCall().catch(async (err) => {
try {
return await pathCall();
} catch {
throw err;
}
});
}
doListNameSekeh() {