fix pargar bugs 4
This commit is contained in:
@@ -255,7 +255,7 @@ class PargarController extends Controller
|
||||
return response()->json($result, ($result['ok'] ?? false) ? 200 : 422);
|
||||
}
|
||||
|
||||
public function syncCustomerWallet($customerId)
|
||||
public function syncCustomerWallet(Request $request, $customerId)
|
||||
{
|
||||
if (! app(ConfigService::class)->isPargarAccounting()) {
|
||||
return response()->json([
|
||||
@@ -272,7 +272,8 @@ class PargarController extends Controller
|
||||
], 422);
|
||||
}
|
||||
|
||||
$result = app(PargarInboundWalletService::class)->syncWalletFromPargar($customer);
|
||||
$force = $request->boolean('force');
|
||||
$result = app(PargarInboundWalletService::class)->syncWalletFromPargar($customer, $force);
|
||||
$appliedDocs = (int) ($result['documents']['applied'] ?? 0);
|
||||
$appliedMande = (bool) ($result['mande']['applied'] ?? false);
|
||||
$mandeMessage = (string) ($result['mande']['message'] ?? '');
|
||||
@@ -285,7 +286,6 @@ class PargarController extends Controller
|
||||
} elseif ($appliedMande) {
|
||||
$message = 'ماندهٔ پرگار روی کیف اعمال شد';
|
||||
} else {
|
||||
// فقط وقتی هیچچیز اعمال نشده، پیام رد/بدوناختلاف مانده را نشان بده
|
||||
$message = $mandeMessage !== ''
|
||||
? $mandeMessage
|
||||
: 'سند قابلاعمالی یافت نشد';
|
||||
@@ -296,7 +296,6 @@ class PargarController extends Controller
|
||||
'message' => $message,
|
||||
'result' => $result,
|
||||
]);
|
||||
// همیشه ۲۰۰ — «قبلاً اعمال شده / بدون اختلاف» خطا نیست؛ فرانت خودش info میزند
|
||||
}
|
||||
|
||||
private function uniqueReferralId(): string
|
||||
|
||||
Reference in New Issue
Block a user