feat(pargar): cap inbound mande/document logs after insert
Keep the newest 2000 success rows per inbound type so dumps stop growing from Pargar webhooks, and store compact document payloads instead of full JSON. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -906,6 +906,28 @@ class PargarSyncService
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* وبهوک سند پرگار را کامل در LONGTEXT نگذار — همان جدول دامپ را باد میکند.
|
||||
*
|
||||
* @param array<string, mixed> $data
|
||||
* @param array<string, mixed> $summary
|
||||
*/
|
||||
public function compactInboundDocumentData(array $data, array $summary): string
|
||||
{
|
||||
$transactions = is_array($data['transactions'] ?? null) ? $data['transactions'] : [];
|
||||
|
||||
return (string) json_encode([
|
||||
'accountName' => $data['accountName'] ?? null,
|
||||
'accountId' => $data['accountId'] ?? null,
|
||||
'transactions_count' => count($transactions),
|
||||
'transactions_fp' => hash('sha256', (string) json_encode($transactions, JSON_UNESCAPED_UNICODE)),
|
||||
'_summary' => $summary,
|
||||
'wallet_applied' => false,
|
||||
'code_build' => 'docs-then-mande-auto',
|
||||
'payload_compacted' => true,
|
||||
], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
private function parsePargarNumber(mixed $value): float
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
|
||||
Reference in New Issue
Block a user