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);
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ class AuthController extends Controller
|
||||
|
||||
protected function _loginWithSms($mobile, $provider)
|
||||
{
|
||||
$cfg = app(ConfigService::class);
|
||||
|
||||
if ($provider == 'user') {
|
||||
$user = User::where('mobile', $mobile)->first();
|
||||
$subDomain = $this->Config('admin_url');
|
||||
} else {
|
||||
$user = Customer::where('mobile', $mobile)->first();
|
||||
$subDomain = $this->Config('app_url');
|
||||
}
|
||||
if (is_null($user)) {
|
||||
throw new UnprocessableEntityHttpException(trans('لطفا ابتدا ثبت نام بفرمایید'));
|
||||
@@ -105,7 +105,14 @@ class AuthController extends Controller
|
||||
$user->save();
|
||||
|
||||
if (self::isSmsNotifEnabled('sms_notif_login_otp')) {
|
||||
$this->SendMessage($mobile, 'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . PHP_EOL . "@$subDomain" . " #" . $rand,true ,"sms");
|
||||
$otpHost = $cfg->resolvePublicHost(request());
|
||||
$otpLine = $otpHost !== '' ? PHP_EOL . "@{$otpHost} #{$rand}" : '';
|
||||
$this->SendMessage(
|
||||
$mobile,
|
||||
'رمز عبور یکبار مصرف شما جهت ورود به اپلیکشن ' . $this->Config('name_fa') . ' ' . $rand . ' می باشد' . $otpLine,
|
||||
true,
|
||||
'sms'
|
||||
);
|
||||
}
|
||||
|
||||
return $user->id;
|
||||
@@ -229,7 +236,7 @@ class AuthController extends Controller
|
||||
$message .= "\nپس از اولین خرید مقدار، " . number_format((int) ($bonusValues[0]['customer'] ?? 0)) . ' ریال پاداش دریافت خواهید کرد.';
|
||||
}
|
||||
}
|
||||
$message .= "\nنام کاربری: {$data['mobile']}\nورود به نرم افزار: {$this->Config('app_url')}";
|
||||
$message .= "\nنام کاربری: {$data['mobile']}\nورود به نرم افزار: " . self::publicSiteUrl(request());
|
||||
if (self::isSmsNotifEnabled('sms_notif_register_customer')) {
|
||||
$this->Send($data['mobile'], $message);
|
||||
}
|
||||
|
||||
@@ -213,6 +213,18 @@ class Controller extends BaseController
|
||||
return false;
|
||||
}
|
||||
|
||||
/** دامنهٔ عمومی سایت — فقط از درخواست HTTP فعلی */
|
||||
protected static function publicHost(?\Illuminate\Http\Request $request = null): string
|
||||
{
|
||||
return app(ConfigService::class)->resolvePublicHost($request);
|
||||
}
|
||||
|
||||
/** آدرس کامل وباپ کاربر — مثلاً https://example.ir */
|
||||
protected static function publicSiteUrl(?\Illuminate\Http\Request $request = null): string
|
||||
{
|
||||
return app(ConfigService::class)->resolvePublicSiteUrl($request);
|
||||
}
|
||||
|
||||
protected static function metalTypeSettingValue(): ?string
|
||||
{
|
||||
$metalType = Setting::where('key', 'metal_type')->value('value');
|
||||
|
||||
@@ -820,7 +820,7 @@ class SingleOrderController extends Controller
|
||||
"مبلغ کل: " . number_format($totalPrice) . "\n\n" .
|
||||
"موجودی {$balanceLabel}: {$goldBalance}\n" .
|
||||
"مانده ریالی: " . number_format($cashBalance) . "\n" .
|
||||
$this->Config('app_url');
|
||||
self::publicSiteUrl(request());
|
||||
|
||||
|
||||
if (self::isSmsNotifEnabled('sms_notif_order_customer')) {
|
||||
@@ -964,7 +964,7 @@ class SingleOrderController extends Controller
|
||||
->where('owner_type', $customer->type)
|
||||
->main()
|
||||
->first();
|
||||
$companyurl = $this->Config('app_url');
|
||||
$companyurl = self::publicSiteUrl(request());
|
||||
$weight = $data['amount'];
|
||||
$totalAmount = $data['total_price'];
|
||||
$pricePerGram = $weight > 0 ? $totalAmount / $weight : 0;
|
||||
|
||||
@@ -204,11 +204,11 @@ class RequestsController extends Controller
|
||||
if($data['method'] == 'cash') {
|
||||
$customerMessage = "$companyName\nبرداشت ریالی \nمبلغ: {$data['amount']}\n" .
|
||||
"\nموجودی طلایی: {$goldBalance}\n" .
|
||||
"مانده ریالی: " . number_format($cashBalance) . "\n" . $this->Config('app_url');
|
||||
"مانده ریالی: " . number_format($cashBalance) . "\n" . self::publicSiteUrl(request());
|
||||
}elseif ($data['method'] == 'gold') {
|
||||
$customerMessage = "$companyName\nبرداشت طلایی \nگرم: {$data['amount']}\nقیمت گرم: " . number_format($pricePerGram) .
|
||||
"\nمبلغ کل: " . number_format($data['total_price']) . "\nموجودی طلایی: {$goldBalance}\n" .
|
||||
"مانده ریالی: " . number_format($cashBalance) . "\n" . $this->Config('app_url');
|
||||
"مانده ریالی: " . number_format($cashBalance) . "\n" . self::publicSiteUrl(request());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class SuperController extends Controller
|
||||
} while ($existingCustomer); // تکرار تا زمانی که کد یونیک ایجاد شود
|
||||
$data['referral_id'] = $uniqueId; // ذخیره کد یونیک در فیلد referral_id
|
||||
|
||||
$message = "{$data['name']} عزیز، اکانت شما در پلتفرم {$this->Config('name_fa')} ایجاد شد.\nنام کاربری: {$data['mobile']}\nورود به نرم افزار: {$this->Config('app_url')}";
|
||||
$message = "{$data['name']} عزیز، اکانت شما در پلتفرم {$this->Config('name_fa')} ایجاد شد.\nنام کاربری: {$data['mobile']}\nورود به نرم افزار: " . self::publicSiteUrl(request());
|
||||
|
||||
$this->Send($data['mobile'], $message);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class paypingController extends Controller
|
||||
'user_id' => $user->id,
|
||||
'user' => $user,
|
||||
'title' => $this->Config('name_fa'),
|
||||
'return_url' => 'https://' . $this->Config('app_url') . '/transactions',
|
||||
'return_url' => $this->cfg()->resolvePublicSiteUrl(request()) . '/transactions',
|
||||
'server_call_url' => url('/customer/charge_account_verify/' . $Withdraw->id),
|
||||
'item' => $this->resolveGatewayItem(),
|
||||
];
|
||||
@@ -158,7 +158,7 @@ class paypingController extends Controller
|
||||
}
|
||||
|
||||
$Withdraw = Withdraw::with('customer')->where('id', $id)->first();
|
||||
$app_url = $this->Config('app_url');
|
||||
$site_url = $this->cfg()->resolvePublicSiteUrl(request());
|
||||
$User = Customer::where('id', $Withdraw->customer_id)->first();
|
||||
|
||||
$GTransaction = Http::withHeaders($this->paypingHeaders())
|
||||
@@ -206,7 +206,7 @@ class paypingController extends Controller
|
||||
}
|
||||
});
|
||||
|
||||
return view('showTransactionReport', compact('Withdraw', 'app_url'));
|
||||
return view('showTransactionReport', compact('Withdraw', 'site_url'));
|
||||
}
|
||||
|
||||
return 'مبلغ پرداختی دستکاری شده !';
|
||||
@@ -221,13 +221,13 @@ class paypingController extends Controller
|
||||
$Withdraw->sts = 3;
|
||||
$Withdraw->save();
|
||||
|
||||
return view('showTransactionReport', compact('Withdraw', 'app_url'));
|
||||
return view('showTransactionReport', compact('Withdraw', 'site_url'));
|
||||
}
|
||||
|
||||
public function verifyTransation()
|
||||
{
|
||||
$Withdraw = Withdraw::with('customer')->where('id', $_GET['clientrefid'])->first();
|
||||
$app_url = $this->Config('app_url');
|
||||
$site_url = $this->cfg()->resolvePublicSiteUrl(request());
|
||||
$User = Customer::where('id', $Withdraw->customer_id)->first();
|
||||
|
||||
$verifyResponse = Http::withToken('cf09ee0187335f173c786e7660d778d2dd71ab582d282999f751427f5923d525')
|
||||
@@ -297,7 +297,7 @@ class paypingController extends Controller
|
||||
}
|
||||
});
|
||||
|
||||
return view('showTransactionReport', compact('Withdraw', 'app_url'));
|
||||
return view('showTransactionReport', compact('Withdraw', 'site_url'));
|
||||
}
|
||||
|
||||
return 'مبلغ پرداختی دستکاری شده !';
|
||||
@@ -306,6 +306,6 @@ class paypingController extends Controller
|
||||
$Withdraw->sts = 3;
|
||||
$Withdraw->save();
|
||||
|
||||
return view('showTransactionReport', compact('Withdraw', 'app_url'));
|
||||
return view('showTransactionReport', compact('Withdraw', 'site_url'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user