feat: shayegan inbound charges workflow and copper kilogram unit enforcement
This commit is contained in:
@@ -16,6 +16,7 @@ use App\Services\BalanceReportService;
|
||||
use App\Services\ConfigService;
|
||||
use App\Services\CustomerPresenceService;
|
||||
use App\Services\ReferralGiftService;
|
||||
use App\Services\ShayeganSyncService;
|
||||
use App\Services\WalletBalanceService;
|
||||
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
|
||||
|
||||
@@ -198,6 +199,23 @@ class CustomerController extends SuperController
|
||||
|
||||
$updated = $data === [] ? false : $customer->update($data);
|
||||
|
||||
// همگامسازی با شایگان در صورت تغییر دستی کد حسابداری
|
||||
if (array_key_exists('moshtari_code', $data) && app(ConfigService::class)->isShayeganAccounting()) {
|
||||
$newCode = $data['moshtari_code'];
|
||||
if ($newCode !== null && $newCode !== '') {
|
||||
try {
|
||||
$shayeganSync = app(ShayeganSyncService::class);
|
||||
$shayeganSync->registerCustomer($customer, $newCode);
|
||||
} catch (\Throwable $e) {
|
||||
\Illuminate\Support\Facades\Log::warning('shayegan.manual_code_sync_failed', [
|
||||
'customer_id' => $customer->id,
|
||||
'code' => $newCode,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'g' => $goldUpdated,
|
||||
'u' => $updated,
|
||||
|
||||
Reference in New Issue
Block a user