wip
This commit is contained in:
8
app/Contracts/Paymentable.php
Normal file
8
app/Contracts/Paymentable.php
Normal file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Contracts;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
*/
|
||||
interface Paymentable {}
|
||||
@@ -297,12 +297,31 @@ function view_loan_order_permission_id(): int
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an anonymous class that acts as a dynamic object.
|
||||
*
|
||||
* @param mixed ...$arguments Key-value pairs passed as an associative array.
|
||||
* @return object Anonymous class instance with dynamic properties.
|
||||
*/
|
||||
function emptyClass(...$arguments): object
|
||||
{
|
||||
/**
|
||||
* @var array<string, mixed> $arguments
|
||||
*/
|
||||
return new class($arguments)
|
||||
{
|
||||
/**
|
||||
* Internal data storage.
|
||||
*
|
||||
* @var array<string, mixed>
|
||||
*/
|
||||
private array $data = [];
|
||||
|
||||
/**
|
||||
* Constructor that sets properties.
|
||||
*
|
||||
* @param array<string, mixed> $props
|
||||
*/
|
||||
public function __construct(array $props)
|
||||
{
|
||||
foreach ($props as $key => $value) {
|
||||
@@ -310,17 +329,36 @@ function emptyClass(...$arguments): object
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($key)
|
||||
/**
|
||||
* Magic getter.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function __get(string $key): mixed
|
||||
{
|
||||
return $this->data[$key] ?? null;
|
||||
}
|
||||
|
||||
public function __set($key, $value)
|
||||
/**
|
||||
* Magic setter.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function __set(string $key, mixed $value): void
|
||||
{
|
||||
$this->data[$key] = $value;
|
||||
}
|
||||
|
||||
public function __isset($key): bool
|
||||
/**
|
||||
* Magic isset.
|
||||
*
|
||||
* @param string $key
|
||||
* @return bool
|
||||
*/
|
||||
public function __isset(string $key): bool
|
||||
{
|
||||
return isset($this->data[$key]);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ class AlertController extends Controller
|
||||
{
|
||||
/**
|
||||
* Get alerts for user
|
||||
*
|
||||
* `Alert`-lar, dine api dereje gosulyar, `mobile app`-lar dine `GET` edip alyp gorkezip bilyarler `app`-a girende.
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Dedoc\Scramble\Attributes\ExcludeRouteFromDocs;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
@@ -11,6 +12,7 @@ class FetchLoanHistoryController extends Controller
|
||||
/**
|
||||
* Fetch loan history
|
||||
*/
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class ApiTesterController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): mixed
|
||||
{
|
||||
$curl = curl_init();
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Dedoc\Scramble\Attributes\ExcludeRouteFromDocs;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -14,6 +15,7 @@ class FetchCardHistoryController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
||||
|
||||
use App\Modules\LoanRemainingOrder\Actions\FetchRemainingLoanFromBilling;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Dedoc\Scramble\Attributes\ExcludeRouteFromDocs;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -15,6 +16,7 @@ class FetchLoanRemainingController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*/
|
||||
#[ExcludeRouteFromDocs]
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
|
||||
@@ -14,6 +14,8 @@ class BaseAppEnumController extends Controller
|
||||
/**
|
||||
* Base app enums
|
||||
*
|
||||
* `System` -daky esasy bolup biljek `Maglumatlar`, köplenç `Select` -larda ulanylýar.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function index(): array
|
||||
|
||||
@@ -11,6 +11,8 @@ class BranchController extends Controller
|
||||
{
|
||||
/**
|
||||
* LIST branches
|
||||
*
|
||||
* Bank şahamçalary. http://online.tbbank.gov.tm/work-place/resources/branches
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
|
||||
@@ -34,7 +34,9 @@ class RetryNovaCardOrderPayment extends Action
|
||||
*/
|
||||
public function authorizedToRun(Request $request, $model)
|
||||
{
|
||||
$this->authorizedToRunAction = ! $model->paid && $model->status === OrderRepo::PENDING;
|
||||
/** @var \App\Models\Order\Card\CardOrder */
|
||||
$cardOrder = $model;
|
||||
$this->authorizedToRunAction = ! $cardOrder->paid && $cardOrder->status === OrderRepo::PENDING;
|
||||
|
||||
return $this->authorizedToRunAction;
|
||||
}
|
||||
|
||||
@@ -20,6 +20,11 @@ class DateHelperRepository
|
||||
return $month;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static numbers for months
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public static function staticNumberMonths(): array
|
||||
{
|
||||
return [
|
||||
@@ -58,6 +63,11 @@ class DateHelperRepository
|
||||
return $years;
|
||||
}
|
||||
|
||||
/**
|
||||
* Static numbers for years
|
||||
*
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function staticNumberYears(): array
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -9,15 +9,20 @@ use App\Modules\LoanOrder\Controllers\Requests\LoanOrderStoreRequest;
|
||||
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderIndexResource;
|
||||
use App\Modules\LoanOrder\Controllers\Resources\LoanOrderShowResource;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
#[Group('Sargytlar - Karz - Karz sargytlary Mobile')]
|
||||
class LoanOrderController extends Controller
|
||||
{
|
||||
/**
|
||||
* LIST* Loan orders.
|
||||
*
|
||||
* `Karz sargytlary list`-leri list gornushde gelyar. https://online.tbbank.gov.tm/work-place/resources/loan-order-mobiles dan `Label` gorup bilyan. `BaseAppEnum` dan gerek yerlerini match edishene gora alyan.
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
@@ -31,38 +36,51 @@ class LoanOrderController extends Controller
|
||||
|
||||
/**
|
||||
* SAVE* Loan order.
|
||||
*
|
||||
* `Karz sargytlary save`. Example bar, online panelkadan gorup hem bilersin. Update store daky yaly, yone oz ugratyan zadyn update bolyar, eger ugratmasaň, üýtgemez.
|
||||
*/
|
||||
public function store(LoanOrderStoreRequest $request): JsonResponse
|
||||
public function store(LoanOrderStoreRequest $request, LoanOrder $loanOrder): JsonResponse
|
||||
{
|
||||
Log::channel('form_logs')->info('loan-order-store-request', $request->all());
|
||||
Log::channel('form_logs')->info('loan-order-update-request', $request->all());
|
||||
|
||||
$data = $request->validated();
|
||||
|
||||
$months = DateHelperRepository::monthsAsNumber();
|
||||
$years = DateHelperRepository::yearsUntil();
|
||||
|
||||
if ($request->filled('card_month')) {
|
||||
$data['card_month'] = indexByValue($request->card_month, $months);
|
||||
}
|
||||
|
||||
if ($request->filled('card_year')) {
|
||||
$data['card_year'] = indexByValue($request->card_year, $years);
|
||||
}
|
||||
|
||||
if ($request->filled('guarantor_card_month')) {
|
||||
$data['guarantor_card_month'] = indexByValue($request->guarantor_card_month, $months);
|
||||
}
|
||||
|
||||
if ($request->filled('guarantor_card_year')) {
|
||||
$data['guarantor_card_year'] = indexByValue($request->guarantor_card_year, $years);
|
||||
}
|
||||
|
||||
if ($request->filled('guarantor_2_card_month')) {
|
||||
$data['guarantor_2_card_month'] = indexByValue($request->guarantor_2_card_month, $months);
|
||||
$data['guarantor_2_card_year'] = indexByValue($request->guarantor_2_card_year, $years);
|
||||
}
|
||||
|
||||
LoanOrder::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
'status' => OrderRepo::PENDING,
|
||||
'source' => OrderRepo::MOBILE_DEVICE,
|
||||
],
|
||||
...$this->uploadedFiles($request),
|
||||
]);
|
||||
if ($request->filled('guarantor_2_card_year')) {
|
||||
$data['guarantor_2_card_year'] = indexByValue($request->guarantor_2_card_year, $years);
|
||||
}
|
||||
|
||||
$data += $this->uploadedFiles($request);
|
||||
|
||||
Model::unguarded(function () use ($loanOrder, $data) {
|
||||
$loanOrder->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
'message' => __('Successfully updates'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,16 +90,21 @@ class LoanOrderController extends Controller
|
||||
*/
|
||||
public function uploadedFiles(Request $request): array
|
||||
{
|
||||
return [
|
||||
'passport_one' => Str::after($request->file('passport_one')->store('public'), 'public/'),
|
||||
'passport_two' => Str::after($request->file('passport_two')->store('public'), 'public/'),
|
||||
'passport_three' => Str::after($request->file('passport_three')->store('public'), 'public/'),
|
||||
'passport_four' => Str::after($request->file('passport_four')->store('public'), 'public/'),
|
||||
];
|
||||
$files = [];
|
||||
|
||||
foreach (['passport_one', 'passport_two', 'passport_three', 'passport_four'] as $field) {
|
||||
if ($request->hasFile($field)) {
|
||||
$files[$field] = Str::after($request->file($field)->store('public'), 'public/');
|
||||
}
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* SHOW* Loan order
|
||||
*
|
||||
* `Karz sargytlary show by id`. ID ugradyp alyan route -da. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function show(LoanOrder $loanOrder): JsonResponse
|
||||
{
|
||||
@@ -94,6 +117,8 @@ class LoanOrderController extends Controller
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* `Karz sargytlary update`. ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(Request $request): void
|
||||
{
|
||||
|
||||
@@ -0,0 +1,405 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\LoanOrder\Controllers\Requests;
|
||||
|
||||
use App\Repos\System\Settings\Legal\EducationRepo;
|
||||
use App\Repos\System\Settings\Legal\MarriageRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class LoanOrderUpdateRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<int, string>|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
/**
|
||||
* Loan type id (https://online.tbbank.gov.tm/api/loan-types)
|
||||
*/
|
||||
'loan_type' => ['sometimes', 'integer', Rule::exists('loan_types', 'id')],
|
||||
|
||||
/**
|
||||
* Loan amount
|
||||
*
|
||||
* @example 20000
|
||||
*/
|
||||
'loan_amount' => ['sometimes', 'integer', 'max:40000'],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'region' => ['sometimes', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||
|
||||
/**
|
||||
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
||||
*/
|
||||
'branch_id' => ['sometimes', 'integer', Rule::exists('branches', 'id')],
|
||||
|
||||
/**
|
||||
* Customer name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'customer_name' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer surname
|
||||
*
|
||||
* @example Allaberdiyev
|
||||
*/
|
||||
'customer_surname' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer patronic name
|
||||
*
|
||||
* @example Öwezowiç
|
||||
*/
|
||||
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Date of birth
|
||||
*
|
||||
* @example 2000
|
||||
*/
|
||||
'born_at' => ['sometimes', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Education (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'education' => ['sometimes', 'string', Rule::in(array_keys(EducationRepo::values()))],
|
||||
|
||||
/**
|
||||
* Marriage status (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'marriage_status' => ['sometimes', 'string', Rule::in(array_keys(MarriageRepo::values()))],
|
||||
|
||||
/**
|
||||
* Passport address
|
||||
*
|
||||
* @example Kemine 100/190
|
||||
*/
|
||||
'passport_address' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Real address
|
||||
*
|
||||
* @example Kemine 100/200
|
||||
*/
|
||||
'real_address' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Passport serie
|
||||
*/
|
||||
'passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Passport date of issue
|
||||
*
|
||||
* @example 2024-01-10
|
||||
*/
|
||||
'passport_given_at' => ['sometimes', 'date', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Passport given by
|
||||
*
|
||||
* @example Ashgabat shaher polisiya tarapyndan
|
||||
*/
|
||||
'passport_given_by' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Born place
|
||||
*
|
||||
* @example Ashgabat shaher
|
||||
*/
|
||||
'born_place' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Email
|
||||
*
|
||||
* @example mahmyt1206@gmail.com
|
||||
*/
|
||||
'email' => ['nullable', 'email', 'max:255'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Phone number (additional)
|
||||
*
|
||||
* @example 61126667
|
||||
*/
|
||||
'phone_additional' => ['nullable', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Phone number (home)
|
||||
*
|
||||
* @example 92-92-92
|
||||
*/
|
||||
'phone_home' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Card number
|
||||
*
|
||||
* @example 4434345434423442
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* Name on card
|
||||
*
|
||||
* @example 'Mahmyt Allaberdiyev'
|
||||
*/
|
||||
'card_name' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Card expiration month
|
||||
*
|
||||
* @example 06
|
||||
*/
|
||||
'card_month' => ['required'],
|
||||
|
||||
/**
|
||||
* Card expiration year
|
||||
*
|
||||
* @example 2040
|
||||
*/
|
||||
'card_year' => ['required'],
|
||||
|
||||
/**
|
||||
* Card number
|
||||
*
|
||||
* @example 4434345434423442
|
||||
*/
|
||||
'loan_card_number' => ['nullable', 'digits:16'],
|
||||
|
||||
/**
|
||||
* Name on card
|
||||
*
|
||||
* @example 'Mahmyt Allaberdiyev'
|
||||
*/
|
||||
'loan_card_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Card expiration month
|
||||
*
|
||||
* @example 06
|
||||
*/
|
||||
'loan_card_month' => ['nullable'],
|
||||
|
||||
/**
|
||||
* Card expiration year
|
||||
*
|
||||
* @example 2040
|
||||
*/
|
||||
'loan_card_year' => ['nullable'],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'work_region' => ['sometimes', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||
|
||||
/**
|
||||
* Provinces (https://online.tbbank.gov.tm/api/provinces)
|
||||
*/
|
||||
'work_province_id' => ['sometimes', 'integer', Rule::exists('provinces', 'id')],
|
||||
|
||||
/**
|
||||
* Work company name
|
||||
*
|
||||
* @example WebUglam HJ
|
||||
*/
|
||||
'work_company' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* HR department number
|
||||
*
|
||||
* @example 707012
|
||||
*/
|
||||
'work_company_accountant_number' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Work position
|
||||
*
|
||||
* @example Bugalter
|
||||
*/
|
||||
'work_position' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Salary
|
||||
*
|
||||
* @example 40000
|
||||
*/
|
||||
'work_salary' => ['sometimes', 'numeric', 'max_digits:8'],
|
||||
|
||||
/**
|
||||
* Work start date
|
||||
*
|
||||
* @example 2024-01-16
|
||||
*/
|
||||
'work_started_at' => ['sometimes', 'date', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Passport (sahypa 1)
|
||||
*/
|
||||
'passport_one' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (2-3-nji sahypa)
|
||||
*/
|
||||
'passport_two' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (8-9 sahypa)
|
||||
*/
|
||||
'passport_three' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (32-nji sahypa)
|
||||
*/
|
||||
'passport_four' => ['sometimes', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Guarantor name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'guarantor_name' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Guarantor surname
|
||||
*
|
||||
* @example Allaberdiev
|
||||
*/
|
||||
'guarantor_surname' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Guarantor surname
|
||||
*
|
||||
* @example Owezowic
|
||||
*/
|
||||
'guarantor_patronic_name' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Guarantor card number
|
||||
*
|
||||
* @example 4323344234423443
|
||||
*/
|
||||
'guarantor_card_number' => ['sometimes', 'string', 'digits:16'],
|
||||
|
||||
/**
|
||||
* Guarantor name on card
|
||||
*
|
||||
* @example Mahmyt Allaberdiyev
|
||||
*/
|
||||
'guarantor_card_name' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Guarantor Card month
|
||||
*
|
||||
* @example 06
|
||||
*/
|
||||
'guarantor_card_month' => ['sometimes', 'string'],
|
||||
|
||||
/**
|
||||
* Guarantor Card year
|
||||
*
|
||||
* @example 2040
|
||||
*/
|
||||
'guarantor_card_year' => ['sometimes', 'string'],
|
||||
|
||||
/**
|
||||
* Guarantor Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'guarantor_passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Guarantor Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'guarantor_passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'guarantor_2_name' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor surname
|
||||
*
|
||||
* @example Allaberdiev
|
||||
*/
|
||||
'guarantor_2_surname' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor patronic name
|
||||
*
|
||||
* @example Owezowich
|
||||
*/
|
||||
'guarantor_2_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor card number
|
||||
*
|
||||
* @example 4323344234423443
|
||||
*/
|
||||
'guarantor_2_card_number' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', 'digits:16'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor name on card
|
||||
*
|
||||
* @example Mahmyt Allaberdiyev
|
||||
*/
|
||||
'guarantor_2_card_name' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor Card month
|
||||
*
|
||||
* @example 06
|
||||
*/
|
||||
'guarantor_2_card_month' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'],
|
||||
|
||||
/**
|
||||
* 2. Guarantor Card year
|
||||
*
|
||||
* @example 2040
|
||||
*/
|
||||
'guarantor_2_card_year' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string'],
|
||||
|
||||
/**
|
||||
* Guarantor Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'guarantor_2_passport_serie' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Guarantor Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'guarantor_2_passport_id' => [Rule::requiredIf($this->input('loan_amount') > 20000), 'numeric', 'digits:6'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -28,11 +28,12 @@ class CheckOnlinePaymentStatus extends Action
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @param \Illuminate\Support\Collection<array-key, \Illuminate\Database\Eloquent\Model> $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
/** @var \App\Models\Order\Card\CardOrder */
|
||||
$item = $models->first();
|
||||
|
||||
$onlinePaymentResource = OnlinePaymentHistory::query()
|
||||
@@ -58,7 +59,14 @@ class CheckOnlinePaymentStatus extends Action
|
||||
$username = $item->branch->billing_username;
|
||||
$password = $item->branch->billing_password;
|
||||
|
||||
if (($username == '' || $password == '') || (is_null($username) || is_null($password))) {
|
||||
if (is_null($username) || is_null($password)) {
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'HALKBANK API',
|
||||
'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi',
|
||||
]);
|
||||
}
|
||||
|
||||
if ($username == '' || $password == '') {
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'HALKBANK API',
|
||||
'body' => 'Ulanyjy ady bilen açar sözi gabat gelmedi',
|
||||
@@ -82,9 +90,9 @@ class CheckOnlinePaymentStatus extends Action
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -2,21 +2,15 @@
|
||||
|
||||
namespace App\Nova\Resources\Order\Card\CardBalance\Actions;
|
||||
|
||||
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Support\Str;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Actions\ActionResponse;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Fields\Date;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
use Markwalet\NovaModalResponse\ModalResponse;
|
||||
use Mpdf\Mpdf;
|
||||
|
||||
class DownloadCardBalance extends Action
|
||||
{
|
||||
@@ -34,7 +28,7 @@ class DownloadCardBalance extends Action
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @param \Illuminate\Support\Collection<array-key, \Illuminate\Database\Eloquent\Model> $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
@@ -49,20 +43,24 @@ class DownloadCardBalance extends Action
|
||||
return ActionResponse::danger($data->message);
|
||||
}
|
||||
|
||||
return Action::modal('modal-response', [
|
||||
'title' => __('Card balance'),
|
||||
'html' => Blade::render(
|
||||
file_get_contents(app_path('Nova/Resources/Order/Card/CardBalance/Views/card-balance.blade.php')),
|
||||
['data' => $data]
|
||||
)
|
||||
info([
|
||||
'data' => $data,
|
||||
]);
|
||||
|
||||
// return Action::modal('modal-response', [
|
||||
// 'title' => __('Card balance'),
|
||||
// 'html' => Blade::render(
|
||||
// file_get_contents(app_path('Nova/Resources/Order/Card/CardBalance/Views/card-balance.blade.php')),
|
||||
// ['data' => $data]
|
||||
// ),
|
||||
// ]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
@@ -72,20 +70,38 @@ class DownloadCardBalance extends Action
|
||||
/**
|
||||
* Fetch api
|
||||
*
|
||||
* @param \App\Models\Order\Card\Requisite\CardRequisite $model
|
||||
* @param \App\Models\Order\Card\CardBalance\CardBalance $model
|
||||
*/
|
||||
public function fetchApi($model)
|
||||
public function fetchApi($model): object
|
||||
{
|
||||
$date = today()->format('d.m.Y');
|
||||
|
||||
$response = DownloadCardTransaction::make()->fetchApi(
|
||||
passport_serie: $model->passport_serie,
|
||||
passport_id: $model->passport_id,
|
||||
card_number_masked: Str::mask($model->card_number, '*', 6, 6),
|
||||
card_expire_date: $model->card_month.'/'.substr($model->card_year, 2),
|
||||
start_date: $date,
|
||||
end_date: $date,
|
||||
);
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_URL => 'http://10.3.158.102:9999/api/clientinfo/all',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS => sprintf(
|
||||
'{ "idSeria": "%s", "idNo": "%s", "cardMaskNumber": "%s", "expDate": "%s" }',
|
||||
$model->passport_serie,
|
||||
$model->passport_id,
|
||||
Str::mask($model->card_number, '*', 6, 6),
|
||||
$model->card_month.'/'.substr($model->card_year, 2)
|
||||
),
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Authorization: Basic dGJ1c2VyOlFBWndzeDEyMw==',
|
||||
'Content-Type: application/json',
|
||||
],
|
||||
]);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
return Str::isJson($response)
|
||||
? json_decode($response)
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Card\CardBalance\Actions\DownloadCardBalance;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
@@ -33,7 +32,7 @@ class CardBalance extends Resource
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public static $search = [
|
||||
'unique_id',
|
||||
@@ -81,7 +80,7 @@ class CardBalance extends Resource
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Panel|\Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
@@ -124,44 +123,11 @@ class CardBalance extends Resource
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function cards(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function filters(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Actions\Action>
|
||||
*/
|
||||
public function actions(NovaRequest $request)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@ class DownloadCardTransaction extends Action
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @param \Illuminate\Support\Collection<array-key, \Illuminate\Database\Eloquent\Model> $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
@@ -77,17 +77,19 @@ class DownloadCardTransaction extends Action
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
Date::make(__('Start date'), 'start_date')
|
||||
->default(date('Y-m-d', strtotime('-6 months')))
|
||||
->fullWidth()
|
||||
->rules('required'),
|
||||
|
||||
Date::make(__('End date'), 'end_date')
|
||||
->default(date('Y-m-d'))
|
||||
->fullWidth()
|
||||
->rules('required'),
|
||||
];
|
||||
}
|
||||
@@ -101,6 +103,8 @@ class DownloadCardTransaction extends Action
|
||||
* @param string $card_expire_date
|
||||
* @param string $start_date
|
||||
* @param string $end_date
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function fetchApi(
|
||||
string $passport_serie,
|
||||
@@ -140,7 +144,7 @@ class DownloadCardTransaction extends Action
|
||||
* @param ResponseTypes\AzatApiClientInfoAllResponse $data
|
||||
* @param string $fileDest
|
||||
*/
|
||||
public function generateFile($data, $fileDest)
|
||||
public function generateFile($data, $fileDest): void
|
||||
{
|
||||
$mpdf = new Mpdf;
|
||||
|
||||
@@ -159,7 +163,7 @@ class DownloadCardTransaction extends Action
|
||||
/**
|
||||
* @param ResponseTypes\AzatApiClientInfoAllResponse $data
|
||||
*/
|
||||
public function getExtraVariables($data)
|
||||
public function getExtraVariables($data): object
|
||||
{
|
||||
if (count($data->transactions) < 1) {
|
||||
return emptyClass(basdakyGalyndy: 0, ahyrkyGalyndy: 0, girdeji: 0, cykdajy: 0);
|
||||
|
||||
@@ -38,14 +38,14 @@ class AzatApiClientInfoAllResponse
|
||||
|
||||
public string $phone;
|
||||
|
||||
public string $errCode;
|
||||
public int $errCode;
|
||||
|
||||
public int $message;
|
||||
public string $message;
|
||||
|
||||
public string $messageRu;
|
||||
|
||||
public string $messageEn;
|
||||
|
||||
/** array<int, Object{'trandate': string, 'currency': string, 'opersum': float, 'actionName': string, 'opername': string}> */
|
||||
/** @var array<int, object> */
|
||||
public array $transactions;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
use Laravel\Nova\Fields\Select;
|
||||
@@ -33,7 +32,7 @@ class CardTransaction extends Resource
|
||||
/**
|
||||
* The columns that should be searched.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
public static $search = [
|
||||
'unique_id',
|
||||
@@ -81,7 +80,7 @@ class CardTransaction extends Resource
|
||||
* Get the fields displayed by the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Panel|\Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request): array
|
||||
{
|
||||
@@ -124,46 +123,13 @@ class CardTransaction extends Resource
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cards available for the request.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function cards(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filters available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function filters(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the lenses available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function lenses(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the actions available for the resource.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Actions\Action>
|
||||
*/
|
||||
public function actions(NovaRequest $request)
|
||||
public function actions(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
DownloadCardTransaction::make()
|
||||
|
||||
@@ -22,7 +22,7 @@ class DownloadCardRequisite extends Action
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @param \Illuminate\Support\Collection<array-key, \Illuminate\Database\Eloquent\Model> $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
@@ -49,7 +49,7 @@ class DownloadCardRequisite extends Action
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
* @return array<int, \Laravel\Nova\Fields\Field>
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
@@ -60,6 +60,7 @@ class DownloadCardRequisite extends Action
|
||||
* Fetch api
|
||||
*
|
||||
* @param \App\Models\Order\Card\Requisite\CardRequisite $model
|
||||
* @return object
|
||||
*/
|
||||
public function fetchApi($model)
|
||||
{
|
||||
@@ -84,6 +85,8 @@ class DownloadCardRequisite extends Action
|
||||
*
|
||||
* @param \App\Models\Order\Card\Requisite\CardRequisite $model
|
||||
* @param \App\Nova\Resources\Order\Card\CardTransaction\Actions\ResponseTypes\AzatApiClientInfoAllResponse $data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateFile($model, $data)
|
||||
{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.1",
|
||||
"dedoc/scramble": "^0.11.11",
|
||||
"dedoc/scramble": "^0.12",
|
||||
"denniseilander/pulse-about-application": "^0.1.1",
|
||||
"digital-creative/column-toggler": "^0.2.3",
|
||||
"digital-creative/icon-action-toolbar": "^0.1.2",
|
||||
|
||||
667
composer.lock
generated
667
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -348,5 +348,7 @@
|
||||
"Card balance": "Kart galyndysy",
|
||||
"Card balances": "Kart galyndylary",
|
||||
"Card holder name": "Kartyň eýesiniň ady",
|
||||
"Money Balance": "Galyndy"
|
||||
"Money Balance": "Galyndy",
|
||||
"Start date": "Başlangyç sene",
|
||||
"End date": "Ahyrky sene"
|
||||
}
|
||||
|
||||
2
lang/vendor/nova/tk.json
vendored
2
lang/vendor/nova/tk.json
vendored
@@ -46,7 +46,7 @@
|
||||
"Are you sure you want to remove this item?": "Bu elementi aýyrmak isleýändigiňize ynanýarsyňyzmy?",
|
||||
"Are you sure you want to restore the selected resources?": "Saýlanan çeşmeleri dikeltmek isleýändigiňize ynanýarsyňyzmy?",
|
||||
"Are you sure you want to restore this resource?": "Bu resursy dikeltmek isleýändigiňize ynanýarsyňyzmy?",
|
||||
"Are you sure you want to run this action?": "Bu çäräni geçirmek isleýändigiňize ynanýarsyňyzmy?",
|
||||
"Are you sure you want to run this action?": "Ýerine ýetirmek üçin \"dowam et\" düwmä basyň.",
|
||||
"Are you sure you want to stop impersonating?": "Özüňi görkezmekden ýüz öwürmek isleýärsiňmi?",
|
||||
"Argentina": "Argentina",
|
||||
"Armenia": "Ermenistan",
|
||||
|
||||
Reference in New Issue
Block a user