fix(shayegan): send the account number as customer id plus moin

Hesabgar kept generating a number when UpdateKind was 3. Insert with account type 1 and send 53012101.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-02 11:35:33 +03:30
co-authored by Cursor
parent 8ccdea99c8
commit 77a448e4e1
3 changed files with 7 additions and 6 deletions
@@ -3,6 +3,7 @@
فرمت هر خط: فرمت هر خط:
- YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی - YYYY-MM-DD | موضوع | مسیر فایل(ها) | نکتهٔ ۱ خطی
- 2026-11-02 | شماره تفصیلی شایگان | `ShayeganSyncService::registerCustomer` | `AccountNumber` = کد کاربری + معین. مشتری 530 و معین 12101 → `53012101`
- 2026-11-02 | دیباگ تبادل شایگان | `ShayeganClient::request` + `registerCustomer` / health / retry | پاسخ ادمین `client_request` و `server_response` دارد؛ رمز DB و Auth برابر `***` - 2026-11-02 | دیباگ تبادل شایگان | `ShayeganClient::request` + `registerCustomer` / health / retry | پاسخ ادمین `client_request` و `server_response` دارد؛ رمز DB و Auth برابر `***`
- 2026-11-02 | سه سطح شایگان | `ShayeganSyncService::registerCustomer` + migration `2026_11_02_000001` | کل 121، معین `12101`، تفصیلی = معین+کد کاربری (`12101530`). `1210101` غلط است - 2026-11-02 | سه سطح شایگان | `ShayeganSyncService::registerCustomer` + migration `2026_11_02_000001` | کل 121، معین `12101`، تفصیلی = معین+کد کاربری (`12101530`). `1210101` غلط است
- 2026-11-01 | پیامک تبدیل | `CopperConvertRequestService::notifyCustomer` | بعد از تأیید یا رد، پیامک جدا به موبایل مشتری؛ خطا پیامک سفارش را برنمی‌گرداند - 2026-11-01 | پیامک تبدیل | `CopperConvertRequestService::notifyCustomer` | بعد از تأیید یا رد، پیامک جدا به موبایل مشتری؛ خطا پیامک سفارش را برنمی‌گرداند
+4 -4
View File
@@ -121,19 +121,19 @@ class ShayeganSyncService
$name = 'مشتری ' . $customer->id; $name = 'مشتری ' . $customer->id;
} }
// کل ۱۲۱ داخل معین است. تفصیلی = معین + کد کاربری. مثال: 12101 و مشتری 530 → 12101530 // تفصیلی = کد کاربری + معین. مثال: مشتری 530 و معین 12101 → 53012101
$requestedAccountNumber = $moinRaw . ((string) (int) $customer->id); $requestedAccountNumber = ((string) (int) $customer->id) . $moinRaw;
$guid = (string) Str::uuid(); $guid = (string) Str::uuid();
$put = [[ $put = [[
'MoinNumber' => $moinNumber, 'MoinNumber' => $moinNumber,
'AccountNumber' => $requestedAccountNumber, 'AccountNumber' => $requestedAccountNumber,
'AccountTypeId' => null, 'AccountTypeId' => 1,
'AccountName' => mb_substr($name, 0, 200), 'AccountName' => mb_substr($name, 0, 200),
'Mobile' => trim((string) ($customer->mobile ?? '')) ?: null, 'Mobile' => trim((string) ($customer->mobile ?? '')) ?: null,
'mellicode' => trim((string) ($customer->n_code ?? '')) ?: null, 'mellicode' => trim((string) ($customer->n_code ?? '')) ?: null,
'GuId' => $guid, 'GuId' => $guid,
'UpdateKind' => 3, 'UpdateKind' => 0,
]]; ]];
$result = $this->client->put('Account/Put', $put); $result = $this->client->put('Account/Put', $put);
@@ -5,7 +5,7 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
/** /**
* سه سطح: کل 121، معین 12101، تفصیلی = معین + کد کاربری (12101530). * سه سطح: کل 121، معین 12101، تفصیلی = کد کاربری + معین (53012101).
* مقدار 1210101 اشتباه بود و به 12101 برمی‌گردد. مقدار دیگر دست نمی‌خورد. * مقدار 1210101 اشتباه بود و به 12101 برمی‌گردد. مقدار دیگر دست نمی‌خورد.
*/ */
return new class extends Migration return new class extends Migration
@@ -23,7 +23,7 @@ return new class extends Migration
$current = trim((string) ($row->value ?? '')); $current = trim((string) ($row->value ?? ''));
$update = [ $update = [
'description' => 'معین Account/Put. کل ۱۲۱ داخل همین کد است. شماره تفصیلی = این مقدار + کد کاربری. مثال: 12101 و مشتری 530 → 12101530.', 'description' => 'معین Account/Put. شماره تفصیلی = کد کاربری + این مقدار. مثال: مشتری 530 و 12101 → 53012101.',
'updated_at' => now(), 'updated_at' => now(),
]; ];
if ($current === '' || $current === '1210101') { if ($current === '' || $current === '1210101') {