fix pargar bugs 2
This commit is contained in:
@@ -247,7 +247,7 @@ class CustomerController extends SuperController
|
||||
if ($active){
|
||||
$message ='اکانت شما توسط کارشناس سیستم تایید شد '."\n".
|
||||
'با رفتن به لینک زیر وارد حساب کاربری خود شوید'."\n".
|
||||
$this->Config('app_url')."\n".
|
||||
self::publicSiteUrl(request())."\n".
|
||||
'با تشکر'.$this->Config('name_fa');
|
||||
}
|
||||
else{
|
||||
@@ -315,10 +315,10 @@ class CustomerController extends SuperController
|
||||
|
||||
|
||||
$companyName = $this->Config('name_fa');
|
||||
$companyurl = $this->Config('app_url');
|
||||
$companyurl = self::publicSiteUrl(request());
|
||||
$message ='حساب کاربری شما توسط کارشناس سیستم تایید شد '."\n".
|
||||
'با رفتن به لینک زیر وارد حساب کاربری خود شوید'."\n".
|
||||
$this->Config('app_url')."\n".
|
||||
$companyurl."\n".
|
||||
'با تشکر'.$this->Config('name_fa');
|
||||
$this->Send($customer->mobile, $message);
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class MassageController extends Controller
|
||||
|
||||
$cfg = app(ConfigService::class);
|
||||
$appName = (string) ($cfg->get('name_fa', '') ?: '');
|
||||
$appUrl = (string) ($cfg->get('app_url', '') ?: '');
|
||||
$appUrl = $cfg->resolvePublicSiteUrl($request);
|
||||
|
||||
$message = str_replace(
|
||||
['%name%', '%نام%', '%app_name%', '%نام_اپ%', '%app_url%', '%لینک_اپ%', '%لینک%'],
|
||||
|
||||
@@ -275,12 +275,24 @@ class PargarController extends Controller
|
||||
$result = app(PargarInboundWalletService::class)->syncWalletFromPargar($customer);
|
||||
$appliedDocs = (int) ($result['documents']['applied'] ?? 0);
|
||||
$appliedMande = (bool) ($result['mande']['applied'] ?? false);
|
||||
$mandeMessage = (string) ($result['mande']['message'] ?? '');
|
||||
|
||||
$messages = [];
|
||||
if ($appliedDocs > 0) {
|
||||
$messages[] = "{$appliedDocs} سند از پرگار اعمال شد";
|
||||
}
|
||||
if ($appliedMande) {
|
||||
$messages[] = 'ماندهٔ پرگار روی کیف اعمال شد';
|
||||
}
|
||||
if ($mandeMessage !== '' && ! $appliedMande) {
|
||||
$messages[] = $mandeMessage;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'ok' => $appliedDocs > 0 || $appliedMande,
|
||||
'message' => $appliedDocs > 0 || $appliedMande
|
||||
? 'مانده از پرگار روی کیف اعمال شد'
|
||||
: ($result['mande']['message'] ?? 'سند قابلاعمالی یافت نشد'),
|
||||
'message' => $messages !== []
|
||||
? implode(' — ', $messages)
|
||||
: 'سند قابلاعمالی یافت نشد',
|
||||
'result' => $result,
|
||||
], $appliedDocs > 0 || $appliedMande ? 200 : 422);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user