fixed some bugs
This commit is contained in:
@@ -25,11 +25,9 @@ class BankAccountController extends SuperController
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$account = BankAccount::findOrFail($id);
|
||||
if ($account->sts != 3 && $account->sts != 2) {
|
||||
throw new UnprocessableEntityHttpException('امکان حذف این کارت بانکی وجود ندارد');
|
||||
}
|
||||
return parent::destroy($id);
|
||||
$account = BankAccount::where('customer_id', auth('customer')->id())->findOrFail($id);
|
||||
$account->delete();
|
||||
return response()->json(true);
|
||||
}
|
||||
|
||||
public function listActiveBankAccount()
|
||||
@@ -97,21 +95,15 @@ class BankAccountController extends SuperController
|
||||
return response()->json($data);
|
||||
|
||||
} else {
|
||||
$message = "احرازهویت برای شماره کارت کاربر " . $user->name . " توسط جیبیت انجام نشد. لطفا از پنل ادمین اقدام کنید. ";
|
||||
$message = 'احراز هویت کارت بانکی برای کاربر ' . $user->name . ' توسط جیبیت ناموفق بود. کارت ثبت نشد.';
|
||||
if (self::isSmsNotifEnabled('sms_notif_bank_card_admin')) {
|
||||
User::where('send_sms', 1)->get()->each(function ($admin) use ($message) {
|
||||
$this->SendMessage($admin->mobile, $message);
|
||||
});
|
||||
}
|
||||
$BA = BankAccount::create([
|
||||
'customer_id' => $user->id,
|
||||
'cart_number' => $request->cart_number,
|
||||
'first_name' => $user->fname,
|
||||
'last_name' => $user->lname,
|
||||
'sts' => 1,
|
||||
]);
|
||||
throw new UnprocessableEntityHttpException('شماره کارت شما برای ادمین ارسال شد و پس از تایید قابل استفاده می باشد.');
|
||||
return $apiData;
|
||||
throw new UnprocessableEntityHttpException(
|
||||
'احراز هویت کارت بانکی ناموفق بود. کارت معتبر نیست و ثبت نشد.'
|
||||
);
|
||||
}
|
||||
}
|
||||
$customer = Customer::find(auth('customer')->id());
|
||||
|
||||
@@ -1490,12 +1490,15 @@ class SingleOrderController extends Controller
|
||||
$scPct = (float) ($data['service_charge_percentage'] ?? 0);
|
||||
|
||||
if ($scGold > 0 || $scRial > 0) {
|
||||
$feeAsset = (string) ($data['fee_asset'] ?? 'rial');
|
||||
$fromMetal = $feeAsset === 'gold';
|
||||
$assetLabel = $fromMetal ? 'از فلز/مقدار' : 'از ریال';
|
||||
$goldLabel = rtrim(rtrim(number_format($scGold, 4, '.', ''), '0'), '.') . ' گرم';
|
||||
$detailParts = [];
|
||||
if ($scPct > 0) {
|
||||
$detailParts[] = rtrim(rtrim(number_format($scPct, 4, '.', ''), '0'), '.') . '%';
|
||||
}
|
||||
if ($scGold > 0 && $priceOriginal > 0) {
|
||||
if ($fromMetal && $scGold > 0 && $priceOriginal > 0) {
|
||||
$detailParts[] = $goldLabel . ' × ' . number_format($priceOriginal) . ' = ' . number_format($scRial) . ' ریال';
|
||||
} elseif ($scRial > 0 && $priceOriginal > 0) {
|
||||
$goldEquiv = $scRial / $priceOriginal;
|
||||
@@ -1504,15 +1507,17 @@ class SingleOrderController extends Controller
|
||||
} else {
|
||||
$detailParts[] = number_format($scRial) . ' ریال';
|
||||
}
|
||||
$detailParts[] = $assetLabel;
|
||||
|
||||
$receiptLines[] = [
|
||||
'kind' => 'service_charge',
|
||||
'key' => 'service_charge',
|
||||
'label' => 'کارمزد معامله',
|
||||
'label' => 'کارمزد معامله · ' . $assetLabel,
|
||||
'is_percent' => $scPct > 0,
|
||||
'raw' => $scPct,
|
||||
'gold' => $scGold,
|
||||
'rial' => $scRial,
|
||||
'fee_asset' => $feeAsset,
|
||||
'per_unit' => $amount > 0 ? ($scRial / $amount) : 0,
|
||||
'amount_units' => $amount,
|
||||
'total' => $scRial,
|
||||
|
||||
@@ -176,6 +176,7 @@ Route::middleware('auth:user')->group(function (){
|
||||
Route::post('account/table', [BankAccountController::class, 'table']);
|
||||
Route::get('account/{id}', [BankAccountController::class, 'show']);
|
||||
Route::post('account/sts', [BankAccountController::class, 'changeSts']);
|
||||
Route::delete('account/{id}', [BankAccountController::class, 'destroy']);
|
||||
|
||||
Route::post('wallet/tahesab', [TahesabController::class, 'wallet']);
|
||||
Route::post('tahesab/table', [TahesabController::class, 'table']);
|
||||
|
||||
Reference in New Issue
Block a user