Compare commits
203 Commits
10361e9422
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| aaacac26d6 | |||
| 377acc18cf | |||
| c05a6972b8 | |||
| 1b27664780 | |||
| 03c692adbb | |||
| 2bd2c45ddb | |||
| e98674aa26 | |||
| d0d49d6517 | |||
| 45ca714b17 | |||
| 924ed64527 | |||
| ca2112d0e6 | |||
| 395e400b7f | |||
| 4d562baacd | |||
| 3e7d246273 | |||
| e6488343c1 | |||
| e5b600df5b | |||
| db3800921e | |||
| 2b2704f6d2 | |||
| 8ecf58de7c | |||
| f81acada2c | |||
| c336af2b6f | |||
| 9fc7d5c1e4 | |||
| 3c3d74ec34 | |||
| 33ec2e11e6 | |||
| 475c21af85 | |||
| fa41d7b9b0 | |||
| 328c2829f7 | |||
| 9b961ef647 | |||
| e736b8501d | |||
| 07a6679e9f | |||
| 50996ddacd | |||
| ef7c30a235 | |||
| 7ca24207fb | |||
| e64cf34c90 | |||
| 673042dd32 | |||
| 84348a1807 | |||
| 9f22e506b2 | |||
| 067ae91c2e | |||
| 82c17b41f6 | |||
| 4b0334fc48 | |||
| 5245f484a0 | |||
| 19f87050dd | |||
| 23ee71f4a4 | |||
| 5896fe4d56 | |||
| 76f6f1c3a3 | |||
| a622f7651a | |||
| a1521ace7a | |||
| d157c21883 | |||
| 6dab1a38c6 | |||
| a5e086237e | |||
| 44613f944e | |||
| 4ff92fe530 | |||
| 051ec52547 | |||
| 9cecd6c465 | |||
| 71e0f1c18d | |||
| 741de26eea | |||
| 574176e4b2 | |||
| 8d7633048b | |||
| 3a6a871c2f | |||
| bf21918a5a | |||
| f138a6c7cb | |||
| f2a94c3c49 | |||
| 4d4a499a56 | |||
| d89f86a534 | |||
| b8bdea33cb | |||
| 5a4759a137 | |||
| 161f993099 | |||
| d4a4c3d3f4 | |||
| 146266226b | |||
| 2e82b19563 | |||
| fc95d6c9f9 | |||
| 2368ea2a50 | |||
| 6aa44e3fa5 | |||
| f610474328 | |||
| 4f1dd64fba | |||
| 6abfc4ac48 | |||
| 7617e08632 | |||
| 84c0e99004 | |||
| 548d1040bb | |||
| df2f2979b5 | |||
| 5c6aff312a | |||
| 7513d6a9a9 | |||
| ffd43d32c2 | |||
| b5e57bccc8 | |||
| 1c00a28744 | |||
| c0dd8f269a | |||
| b3ed503742 | |||
| 014da27f66 | |||
| 2453fac7cf | |||
| fa04f374aa | |||
| 96c3122b2a | |||
| 78d7065b86 | |||
| daaa3bc360 | |||
| 3e04b17edf | |||
| ed65172b07 | |||
| 40565033b6 | |||
| 5cb2f9027c | |||
| 0b63d9098e | |||
| 4e1f286eb5 | |||
| 7efad097ef | |||
| 03d3e03f35 | |||
| 9186bc73e1 | |||
| 840358cc6a | |||
| 90c053689b | |||
| c7d6d947c9 | |||
| 9a330c18ad | |||
| cc31403a8a | |||
| 1b918348e5 | |||
| 640457b979 | |||
| c54535e197 | |||
| 5b4fa96956 | |||
| 2a840e3cc5 | |||
| df0a5eb329 | |||
| 53100e6be3 | |||
| cf8146fb4c | |||
| b509a23f7a | |||
| 44217fb8b9 | |||
| 975d03d2a1 | |||
| 3ad4a3b86b | |||
| ee555e899c | |||
| 054e2de5e6 | |||
| ea9b028c23 | |||
| 9c236aa8a8 | |||
| 5ebf573da2 | |||
| c348416c05 | |||
| 7c623e802f | |||
| 7d2ad13ae7 | |||
| 67457b5bc7 | |||
| f2564221ca | |||
| 703ae1bb0b | |||
| 028f11da9c | |||
| 0480ebad91 | |||
| eefe130ad3 | |||
| 772ac9ad0f | |||
| 5732d7eabe | |||
| 5abe97e20c | |||
| 405967fcea | |||
| 4d75c110e9 | |||
| afeefc7aed | |||
| 8a96772634 | |||
| eca675ae68 | |||
| 3d07137f71 | |||
| 652edb0896 | |||
| d9c463b427 | |||
| 1746ba4a60 | |||
| cfcfdefc36 | |||
| 647979fdef | |||
| aaf8d067f9 | |||
| 6eb3628fd8 | |||
| f257559f42 | |||
| 6540668f9f | |||
| 251c19319a | |||
| 8ce7bd981a | |||
| 094232cc79 | |||
| 571b422454 | |||
| df985789f1 | |||
| 5bfe3a955c | |||
| 67f5eadec8 | |||
| 61e0a45708 | |||
| b0a2b50ec7 | |||
| b883f0f66d | |||
| 0248aa7422 | |||
| fa4cf3eebc | |||
| 88370db5da | |||
| 95696a54c9 | |||
| 4b0a2566a4 | |||
| 85e776f18f | |||
| ef1a0b8cf7 | |||
| e60530fc00 | |||
| b795a84503 | |||
| fd7e11a21a | |||
| d1c690ba4c | |||
| 915d32a121 | |||
| b7b3f3ded4 | |||
| c2298d1550 | |||
| 66af4f913a | |||
| e72f494da7 | |||
| 26714e4192 | |||
| 2265958317 | |||
| de4d74f849 | |||
| d90e2966c7 | |||
| 3583f49a9b | |||
| b81e9c7d31 | |||
| 7c541ab9af | |||
| fb063215d2 | |||
| bf30d27526 | |||
| 8a8ac40a2a | |||
| 9f29e13322 | |||
| 689f50e2e6 | |||
| 96a949f421 | |||
| 135008e7df | |||
| 438bfa26f6 | |||
| 990ef13691 | |||
| a86d9be969 | |||
| 6b1624c4ec | |||
| 198b35a007 | |||
| 57a255a928 | |||
| 501966f94c | |||
| 8b68068587 | |||
| 193e7801c5 | |||
| 7505ea4c05 | |||
| fe97a26ebb | |||
| 5dfce35a84 |
@@ -1,4 +1,6 @@
|
||||
@servers(['web' => ['nurmuhammet@online.tbbank.gov.tm']])
|
||||
@servers([
|
||||
'web' => ['nurmuhammet@online.tbbank.gov.tm']
|
||||
])
|
||||
|
||||
@task('deploy', ['on' => 'web'])
|
||||
sudo su
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Jobs\SendSberToSystem;
|
||||
use App\Jobs\SendVisaToSystem;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -12,7 +14,11 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->command('backup:run')->saturdays();
|
||||
$schedule->job(new SendSberToSystem)
|
||||
->everyMinute();
|
||||
|
||||
$schedule->job(new SendVisaToSystem)
|
||||
->everyMinute();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
<?php
|
||||
|
||||
use App\Events\EventType;
|
||||
use App\Models\Payment\OnlinePaymentHistory;
|
||||
use App\Models\System\Roles\Permission;
|
||||
use App\Models\System\Verification;
|
||||
use App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem;
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem;
|
||||
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Request as GuzzleRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
use Stevebauman\Location\Facades\Location;
|
||||
use Symfony\Component\HttpFoundation\IpUtils;
|
||||
|
||||
@@ -65,7 +71,7 @@ function isTurkmenIp(string $ip = ''): bool
|
||||
}
|
||||
|
||||
/**
|
||||
* Un mask phone from "+(993)-xx-xx-xx-xx"
|
||||
* Un mask phone
|
||||
*/
|
||||
function unMaskPhone(string|int $phone): string
|
||||
{
|
||||
@@ -114,7 +120,7 @@ function sendSMS(string|int $phone, string|int $message)
|
||||
*/
|
||||
function sendSMSVerification(string|int $phone_number): ?Verification
|
||||
{
|
||||
$phone_code = rand(10000, 99999);
|
||||
$phone_code = rand(100000, 999999);
|
||||
$verification = Verification::where(['username' => $phone_number])->first();
|
||||
$verification ? $verification->update(['code' => $phone_code]) : Verification::create(['username' => $phone_number, 'code' => $phone_code]);
|
||||
|
||||
@@ -141,7 +147,7 @@ function storeAuthEvent(string $name, Request $request): void
|
||||
$request->getPort(),
|
||||
isLocalIp($request->ip())
|
||||
? 'TM'
|
||||
: Location::get($request->ip())?->countryCode ?? 'TM',
|
||||
: Location::get('95.85.34.23')?->countryCode ?? 'TM',
|
||||
$request->user()->id ?? '-',
|
||||
));
|
||||
}
|
||||
@@ -290,6 +296,9 @@ function cached(string $name, mixed $value, int $seconds = 60): mixed
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* view-loan-order-permission-id
|
||||
*/
|
||||
function view_loan_order_permission_id(): int
|
||||
{
|
||||
return Cache::rememberForever('view_loan_order_permission_id', function () {
|
||||
@@ -297,6 +306,34 @@ function view_loan_order_permission_id(): int
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* VP fetch client info all
|
||||
*
|
||||
* @param $model
|
||||
* @param $start_date
|
||||
* @param $end_date
|
||||
*/
|
||||
function vp_fetch_ClientInfoAll($model, $start_date, $end_date)
|
||||
{
|
||||
return fetchCardTransactionFromAzat(
|
||||
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: $start_date,
|
||||
end_date: $end_date,
|
||||
);
|
||||
}
|
||||
|
||||
function fetchCardTransactionFromAzat($passport_serie, $passport_id, $card_number_masked, $card_expire_date, $start_date, $end_date)
|
||||
{
|
||||
$response = DownloadCardTransaction::make()->fetchApi($passport_serie, $passport_id, $card_number_masked, $card_expire_date, $start_date, $end_date);
|
||||
|
||||
return Str::isJson($response)
|
||||
? json_decode($response)
|
||||
: emptyClass(errCode: 1, message: 'Connection issue to VP');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an anonymous class that acts as a dynamic object.
|
||||
*
|
||||
@@ -364,3 +401,358 @@ function emptyClass(...$arguments): object
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check online payment
|
||||
*
|
||||
* @param string $orderId
|
||||
* @param int|string $username
|
||||
* @param string $password
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function checkOnlinePayment(string $orderId, int|string $username, string $password): mixed
|
||||
{
|
||||
$response = Http::asForm()->post('https://mpi.gov.tm/payment/rest/getOrderStatusExtended.do', [
|
||||
'language' => 'ru',
|
||||
'orderId' => $orderId,
|
||||
'userName' => $username,
|
||||
'password' => $password,
|
||||
]);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync with bank system
|
||||
*
|
||||
* @param string $online_payment_order_uuid
|
||||
* @param string $bank_unique_code
|
||||
* @param string $online_payment_terminal_id
|
||||
* @param string $user_deposit_account
|
||||
* @param string $online_payment_auth_ref_num
|
||||
* @param string $online_payment_tmt_amount
|
||||
* @param string $pay_purpose
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
function syncWithBankSystem(
|
||||
$online_payment_order_uuid,
|
||||
$bank_unique_code,
|
||||
$online_payment_terminal_id,
|
||||
$user_deposit_account,
|
||||
$online_payment_auth_ref_num,
|
||||
$online_payment_tmt_amount,
|
||||
$pay_purpose
|
||||
): mixed {
|
||||
$ecomId = $online_payment_order_uuid;
|
||||
$agentId = $bank_unique_code;
|
||||
$eposId = $online_payment_terminal_id;
|
||||
$account = $user_deposit_account;
|
||||
$rrn = $online_payment_auth_ref_num;
|
||||
$amount = $online_payment_tmt_amount;
|
||||
$payPurpose = $pay_purpose;
|
||||
|
||||
$client = new Client([
|
||||
'timeout' => 5, // seconds before it fails
|
||||
'connect_timeout' => 1, // seconds to wait for connection
|
||||
]);
|
||||
$headers = [
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Basic YWRtaW46UUFad3N4MTIz',
|
||||
];
|
||||
$body = sprintf('{
|
||||
"ecomId": "%s",
|
||||
"agentId": "%s",
|
||||
"eposId": "%s",
|
||||
"account": "%s",
|
||||
"rrn": "%s",
|
||||
"amount": "%s",
|
||||
"payPurpose": "%s"
|
||||
}', $ecomId, $agentId, $eposId, $account, $rrn, $amount, $payPurpose);
|
||||
|
||||
$request = new GuzzleRequest('POST', 'http://10.3.158.102:8888/api/paytrn/new', $headers, $body);
|
||||
|
||||
try {
|
||||
$res = $client->sendAsync($request)->wait();
|
||||
|
||||
return (string) $res->getBody();
|
||||
} catch (Exception $e) {
|
||||
info([$e->getMessage(), $e->getTraceAsString()]);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sber credentials for a given payment item.
|
||||
*
|
||||
* @param SberPaymentOrderItem $item
|
||||
* @return array{username?: string, password?: string, onlinePaymentResource?: OnlinePaymentHistory, relatedResource?: mixed, error?: string, type?: 'danger'|'modal'}
|
||||
*/
|
||||
function getSberCredentials(SberPaymentOrderItem $item): array
|
||||
{
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory|null $onlinePaymentResource */
|
||||
$onlinePaymentResource = OnlinePaymentHistory::find($item->online_payment_history_id);
|
||||
|
||||
if (! $onlinePaymentResource) {
|
||||
return ['error' => 'Online payment resource tapylmady', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$relatedResource = (new $onlinePaymentResource->online_paymantable_type)
|
||||
->find(id: $onlinePaymentResource->online_paymantable_id);
|
||||
|
||||
if (! $relatedResource) {
|
||||
return ['error' => 'Bu resource tapylmady', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$relatedResource->loadMissing(['branch']);
|
||||
|
||||
if (! $relatedResource->branch) {
|
||||
return ['error' => 'Şahamça bilen birikdirilmedik', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$username = $relatedResource->branch->billing_sber_username;
|
||||
$password = $relatedResource->branch->billing_sber_password;
|
||||
|
||||
if (empty($username) || empty($password)) {
|
||||
return ['error' => 'Ulanyjy ady bilen açar sözi gabat gelmedi', 'type' => 'modal'];
|
||||
}
|
||||
|
||||
return [
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
'onlinePaymentResource' => $onlinePaymentResource,
|
||||
'relatedResource' => $relatedResource,
|
||||
];
|
||||
}
|
||||
|
||||
function syncSberWithAzatAPI(SberPaymentOrderItem $orderItem): array
|
||||
{
|
||||
$result = getSberCredentials($orderItem);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory $onlinePaymentResource */
|
||||
$onlinePaymentResource = $result['onlinePaymentResource'];
|
||||
|
||||
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder $sberPaymentOrder */
|
||||
$sberPaymentOrder = $result['relatedResource'];
|
||||
|
||||
$response = checkOnlinePayment($onlinePaymentResource->orderId, $result['username'], $result['password']);
|
||||
|
||||
if ($response['errorCode'] != 0) {
|
||||
return [
|
||||
'error' => $response['errorMessage'],
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
if (! isset($response['authRefNum'])) {
|
||||
warn('missing-authRefNum', $onlinePaymentResource->orderId);
|
||||
ignoreSberPayment('missing-authRefNum', $orderItem);
|
||||
|
||||
return [
|
||||
'error' => 'authRefNum missing',
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$systemRawResponse = syncWithBankSystem(
|
||||
online_payment_order_uuid: $onlinePaymentResource->orderId,
|
||||
bank_unique_code: $sberPaymentOrder->branch->unique_code,
|
||||
online_payment_terminal_id: $response['terminalId'],
|
||||
user_deposit_account: number_format($sberPaymentOrder->sender_deposit_account, 0, '', ''),
|
||||
online_payment_auth_ref_num: $response['authRefNum'],
|
||||
online_payment_tmt_amount: $orderItem->tmt_payment_amount,
|
||||
pay_purpose: $orderItem->created_at->translatedFormat('F').' '.$orderItem->created_at->format('Y')
|
||||
);
|
||||
|
||||
if ($systemRawResponse == null) {
|
||||
return [
|
||||
'error' => 'Connection issue to SYSTEM',
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$systemResponse = json_decode($systemRawResponse);
|
||||
|
||||
$success = false;
|
||||
if (is_object($systemResponse)) {
|
||||
$success = $systemResponse->errCode == 0;
|
||||
}
|
||||
|
||||
if (! $success) {
|
||||
$message = 'Error';
|
||||
|
||||
if (isset($systemResponse->msgSys)) {
|
||||
$message .= ' '.$systemResponse->msgSys;
|
||||
}
|
||||
|
||||
return [
|
||||
'error' => $message,
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$orderItem->update([
|
||||
'synced_with_system' => true,
|
||||
]);
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Sber credentials for a given payment item.
|
||||
*
|
||||
* @param SberPaymentOrderItem $item
|
||||
* @return array{username?: string, password?: string, onlinePaymentResource?: OnlinePaymentHistory, relatedResource?: mixed, error?: string, type?: 'danger'|'modal'}
|
||||
*/
|
||||
function getVisaCredentials(VisaMasterPaymentOrderItem $item): array
|
||||
{
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory|null $onlinePaymentResource */
|
||||
$onlinePaymentResource = OnlinePaymentHistory::find($item->online_payment_history_id);
|
||||
|
||||
if (! $onlinePaymentResource) {
|
||||
return ['error' => 'Online payment resource tapylmady', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$relatedResource = (new $onlinePaymentResource->online_paymantable_type)
|
||||
->find(id: $onlinePaymentResource->online_paymantable_id);
|
||||
|
||||
if (! $relatedResource) {
|
||||
return ['error' => 'Bu resource tapylmady', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$relatedResource->loadMissing(['branch']);
|
||||
|
||||
if (! $relatedResource->branch) {
|
||||
return ['error' => 'Şahamça bilen birikdirilmedik', 'type' => 'danger'];
|
||||
}
|
||||
|
||||
$username = $relatedResource->branch->billing_visa_master_username;
|
||||
$password = $relatedResource->branch->billing_visa_master_password;
|
||||
|
||||
if (empty($username) || empty($password)) {
|
||||
return ['error' => 'Ulanyjy ady bilen açar sözi gabat gelmedi', 'type' => 'modal'];
|
||||
}
|
||||
|
||||
return [
|
||||
'username' => $username,
|
||||
'password' => $password,
|
||||
'onlinePaymentResource' => $onlinePaymentResource,
|
||||
'relatedResource' => $relatedResource,
|
||||
];
|
||||
}
|
||||
|
||||
function syncVisaWithAzatAPI(VisaMasterPaymentOrderItem $orderItem): array
|
||||
{
|
||||
$result = getVisaCredentials($orderItem);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory $onlinePaymentResource */
|
||||
$onlinePaymentResource = $result['onlinePaymentResource'];
|
||||
|
||||
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrder $sberPaymentOrder */
|
||||
$visaPaymentOrder = $result['relatedResource'];
|
||||
|
||||
$response = checkOnlinePayment($onlinePaymentResource->orderId, $result['username'], $result['password']);
|
||||
|
||||
if ($response['errorCode'] != 0) {
|
||||
return [
|
||||
'error' => $response['errorMessage'],
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
if (! isset($response['authRefNum'])) {
|
||||
warn('missing-authRefNum', $onlinePaymentResource->orderId);
|
||||
ignoreVisaPayment('missing-authRefNum', $orderItem);
|
||||
|
||||
return [
|
||||
'error' => 'authRefNum missing',
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$systemRawResponse = syncWithBankSystem(
|
||||
online_payment_order_uuid: $onlinePaymentResource->orderId,
|
||||
bank_unique_code: $visaPaymentOrder->branch->unique_code,
|
||||
online_payment_terminal_id: $response['terminalId'],
|
||||
user_deposit_account: number_format($visaPaymentOrder->sender_deposit_account, 0, '', ''),
|
||||
online_payment_auth_ref_num: $response['authRefNum'],
|
||||
online_payment_tmt_amount: $orderItem->tmt_payment_amount,
|
||||
pay_purpose: $orderItem->created_at->translatedFormat('F').' '.$orderItem->created_at->format('Y')
|
||||
);
|
||||
|
||||
if ($systemRawResponse == null) {
|
||||
return [
|
||||
'error' => 'Connection issue to SYSTEM',
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$systemResponse = json_decode($systemRawResponse);
|
||||
|
||||
$success = false;
|
||||
if (is_object($systemResponse)) {
|
||||
$success = $systemResponse->errCode == 0;
|
||||
}
|
||||
|
||||
if (! $success) {
|
||||
$message = 'Error';
|
||||
|
||||
if (isset($systemResponse->msgSys)) {
|
||||
$message .= ' '.$systemResponse->msgSys;
|
||||
}
|
||||
|
||||
return [
|
||||
'error' => $message,
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
$orderItem->update([
|
||||
'synced_with_system' => true,
|
||||
]);
|
||||
|
||||
return [
|
||||
'success' => true,
|
||||
'type' => 'modal',
|
||||
];
|
||||
}
|
||||
|
||||
function warn($message, $content) {
|
||||
DB::table('warnings')->insert([
|
||||
'message' => $message,
|
||||
'content' => $content,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
function ignoreVisaPayment($message, $item) {
|
||||
DB::table('ignore_visa_payments')->insert([
|
||||
'message' => $message,
|
||||
'payment_id' => $item->id,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
function ignoreSberPayment($message, $item) {
|
||||
DB::table('ignore_sber_payments')->insert([
|
||||
'message' => $message,
|
||||
'payment_id' => $item->id,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,23 @@ class AlertController extends Controller
|
||||
return response()->json($this->format($alerts));
|
||||
}
|
||||
|
||||
/**
|
||||
* All alerts
|
||||
*/
|
||||
public function all(): JsonResponse
|
||||
{
|
||||
/** @var \App\Models\User */
|
||||
$user = auth()->user();
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Builder<Alert> */
|
||||
$alerstQuery = $user->alerts();
|
||||
|
||||
/** @var Collection<array-key, Alert> */
|
||||
$alerts = $alerstQuery->get();
|
||||
|
||||
return response()->json($this->format($alerts));
|
||||
}
|
||||
|
||||
/**
|
||||
* Format
|
||||
*
|
||||
|
||||
230
app/Http/Controllers/Api/CardBalance/CardBalanceController.php
Normal file
230
app/Http/Controllers/Api/CardBalance/CardBalanceController.php
Normal file
@@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardBalance;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\CardBalance\CardBalance;
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Resources\Order\Card\CardBalance\Actions\DownloadCardBalance;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
#[Group('Sargytlar - Kart - Kart galyndylary')]
|
||||
class CardBalanceController extends Controller
|
||||
{
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json(
|
||||
CardBalance::query()
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE*
|
||||
*/
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['required', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['required', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['required', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
CardBalance::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
],
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* SHOW*
|
||||
*
|
||||
* ID ugradyp alyan route -da. Soň page-da download button bolmaly, basaňdan soň, modal çykmaly, start date bilen end date ugradyp download basanda `/api/card-transactions-download/{order}` route gelyan pdf download etmeli.
|
||||
*/
|
||||
public function show(CardBalance $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
return response()->json($order);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download*
|
||||
*
|
||||
* Download card transaction file
|
||||
*/
|
||||
public function download(Request $request, CardBalance $order)
|
||||
{
|
||||
$response = DownloadCardBalance::make()->fetchApi(
|
||||
passport_serie: $order->passport_serie,
|
||||
passport_id: $order->passport_id,
|
||||
card_masked: Str::mask($order->card_number, '*', 6, 6),
|
||||
card_expire_date: $order->card_month.'/'.substr($order->card_year, 2),
|
||||
);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'url' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'data' => $response,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(Request $request, CardBalance $order): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardBalance $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
$order->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quick card balance check
|
||||
*/
|
||||
public function quickCheck(Request $request): JsonResponse
|
||||
{
|
||||
$request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
$response = DownloadCardBalance::make()->fetchApi(
|
||||
passport_serie: $request->passport_serie,
|
||||
passport_id: $request->passport_id,
|
||||
card_masked: Str::mask($request->card_number, '*', 6, 6),
|
||||
card_expire_date: $request->card_month.'/'.substr($request->card_year, 2),
|
||||
);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'url' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'data' => $response,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,132 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\CardOrder;
|
||||
|
||||
use App\Http\Controllers\Api\CardOrder\Requests\CardOrderStoreRequest;
|
||||
use App\Http\Controllers\Api\CardOrder\Requests\CardOrderUpdateRequest;
|
||||
use App\Http\Controllers\Api\CardOrder\Resources\CardOrderIndexResource;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\CardOrder;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\Payment\OnlinePaymentRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
#[Group('Sargytlar - Kart - Täze kart')]
|
||||
class CardOrderController extends Controller
|
||||
{
|
||||
//
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json(CardOrderIndexResource::collection(
|
||||
CardOrder::query()
|
||||
->with(['branch', 'cardState', 'cardType'])
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE*
|
||||
*
|
||||
* POST ugradanyňdan soň, halkbank toleg link berer, webwiew -da açmaly. Şul route-da ýetende, break etse bolyar, `https://online.tbbank.gov.tm/online-payment-store`
|
||||
*/
|
||||
public function store(CardOrderStoreRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->validated();
|
||||
|
||||
$model = CardOrder::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
'citizenship' => 'TM',
|
||||
'status' => OrderRepo::PENDING,
|
||||
],
|
||||
...$this->uploadedFiles($request),
|
||||
]);
|
||||
|
||||
CardOrderRepo::created()($model);
|
||||
|
||||
$payment = (new OnlinePaymentRepo)->payCardOrder($model);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
'payment' => [
|
||||
'status' => $payment['status'] === 'success',
|
||||
'url' => $payment['status'] === 'success' ? $payment['url'] : '',
|
||||
],
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload files
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function uploadedFiles(Request $request): array
|
||||
{
|
||||
$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*
|
||||
*
|
||||
* ID ugradyp alyan route -da.
|
||||
*/
|
||||
public function show(CardOrder $cardOrder)
|
||||
{
|
||||
if ($cardOrder->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
return response()->json(new CardOrderIndexResource($cardOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(CardOrderUpdateRequest $request, CardOrder $cardOrder): JsonResponse
|
||||
{
|
||||
$data = array_merge($request->validated(), $this->uploadedFiles($request));
|
||||
|
||||
Model::unguarded(function () use ($cardOrder, $data) {
|
||||
$cardOrder->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardOrder $cardOrder): JsonResponse
|
||||
{
|
||||
if ($cardOrder->user_id !== auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
$cardOrder->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardOrder\Requests;
|
||||
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardOrderStoreRequest 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 [
|
||||
/**
|
||||
* Card state id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_state_id' => ['required', 'integer', Rule::exists('card_states', 'id')],
|
||||
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['required', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'region' => ['required', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||
|
||||
/**
|
||||
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
||||
*/
|
||||
'branch_id' => ['required', 'integer', Rule::exists('branches', 'id')],
|
||||
|
||||
/**
|
||||
* Customer name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'customer_name' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer surname
|
||||
*
|
||||
* @example Allaberdiyev
|
||||
*/
|
||||
'customer_surname' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer patronic name
|
||||
*
|
||||
* @example Öwezowiç
|
||||
*/
|
||||
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Date of birth
|
||||
*
|
||||
* @example 10.10.2000
|
||||
*/
|
||||
'born_at' => ['required', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Old surname
|
||||
*/
|
||||
'old_surname' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['required', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['required', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Passport date of issue
|
||||
*
|
||||
* @example 10.10.2020
|
||||
*/
|
||||
'passport_given_at' => ['required', 'date', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Passport given by
|
||||
*
|
||||
* @example Ashgabat shaher polisiya tarapyndan
|
||||
*/
|
||||
'passport_given_by' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Born place
|
||||
*
|
||||
* @example Ashgabat shaher
|
||||
*/
|
||||
'born_place' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Işleýän ýeriňiz we wezipäňiz
|
||||
*
|
||||
* @example Aşgabat şäheriniň "TÜRKMENBAŞY" PAÝDARLAR TÄJIRÇILIK bankynyň Baş bugalteri
|
||||
*/
|
||||
'job_location' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Passport address
|
||||
*
|
||||
* @example Kemine 100/190
|
||||
*/
|
||||
'passport_address' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Real address
|
||||
*
|
||||
* @example Kemine 100/190
|
||||
*/
|
||||
'real_address' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['required', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Phone number (additional)
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone_additional' => ['nullable', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Passport (sahypa 1)
|
||||
*/
|
||||
'passport_one' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (2-3-nji sahypa)
|
||||
*/
|
||||
'passport_two' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (8-9 sahypa)
|
||||
*/
|
||||
'passport_three' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (32-nji sahypa)
|
||||
*/
|
||||
'passport_four' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardOrder\Requests;
|
||||
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardOrderUpdateRequest 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 [
|
||||
/**
|
||||
* Card state id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_state_id' => ['sometimes', 'integer', Rule::exists('card_states', 'id')],
|
||||
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['sometimes', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'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 10.10.2000
|
||||
*/
|
||||
'born_at' => ['sometimes', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Old surname
|
||||
*/
|
||||
'old_surname' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Passport date of issue
|
||||
*
|
||||
* @example 10.10.2020
|
||||
*/
|
||||
'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'],
|
||||
|
||||
/**
|
||||
* Işleýän ýeriňiz we wezipäňiz
|
||||
*
|
||||
* @example Aşgabat şäheriniň "TÜRKMENBAŞY" PAÝDARLAR TÄJIRÇILIK bankynyň Baş bugalteri
|
||||
*/
|
||||
'job_location' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Passport address
|
||||
*
|
||||
* @example Kemine 100/190
|
||||
*/
|
||||
'passport_address' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Real address
|
||||
*
|
||||
* @example Kemine 100/190
|
||||
*/
|
||||
'real_address' => ['sometimes', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Phone number (additional)
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone_additional' => ['nullable', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardOrder\Resources;
|
||||
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\Order\Card\CardOrder
|
||||
*/
|
||||
class CardOrderIndexResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'unique_id' => $this->unique_id,
|
||||
|
||||
'paid' => $this->paid,
|
||||
|
||||
'card_state_id' => $this->cardState?->name,
|
||||
|
||||
'card_type_id' => $this->cardType?->name,
|
||||
|
||||
'region' => RegionRepo::label($this->region),
|
||||
'branch_id' => $this->branch?->name,
|
||||
|
||||
'customer_name' => $this->customer_name,
|
||||
'customer_surname' => $this->customer_surname,
|
||||
'customer_patronic_name' => $this->customer_patronic_name,
|
||||
'old_surname' => $this->old_surname,
|
||||
'born_at' => $this->born_at,
|
||||
|
||||
'passport_serie' => $this->passport_serie,
|
||||
'passport_id' => $this->passport_id,
|
||||
'passport_given_at' => $this->passport_given_at,
|
||||
'passport_given_by' => $this->passport_given_by,
|
||||
'born_place' => $this->born_place,
|
||||
'passport_address' => $this->passport_address,
|
||||
'real_address' => $this->real_address,
|
||||
|
||||
'job_location' => $this->job_location,
|
||||
|
||||
'phone' => $this->phone,
|
||||
'phone_additional' => $this->phone_additional,
|
||||
|
||||
'status' => OrderRepo::statusFormatted($this->status),
|
||||
|
||||
'passport_one' => url('/storage/'.$this->passport_one),
|
||||
'passport_two' => url('/storage/'.$this->passport_two),
|
||||
'passport_three' => url('/storage/'.$this->passport_three),
|
||||
'passport_four' => url('/storage/'.$this->passport_four),
|
||||
|
||||
'notes' => $this->notes,
|
||||
|
||||
'user_id' => $this->user_id,
|
||||
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'deleted_at' => $this->deleted_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
120
app/Http/Controllers/Api/CardPin/CardPinController.php
Normal file
120
app/Http/Controllers/Api/CardPin/CardPinController.php
Normal file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardPin;
|
||||
|
||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinIndexResource;
|
||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinStoreRequest;
|
||||
use App\Http\Controllers\Api\CardPin\Requests\CardPinUpdateRequest;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\CardPin\CardPin;
|
||||
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\Str;
|
||||
|
||||
#[Group('Sargytlar - Kart - Kart pin bukjalar')]
|
||||
class CardPinController extends Controller
|
||||
{
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json(CardPinIndexResource::collection(
|
||||
CardPin::query()
|
||||
->with('branch', 'cardType')
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE*
|
||||
*/
|
||||
public function store(CardPinStoreRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->validated();
|
||||
|
||||
CardPin::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'status' => OrderRepo::PENDING,
|
||||
'user_id' => auth()->id(),
|
||||
],
|
||||
...$this->uploadedFiles($request),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload files
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function uploadedFiles(Request $request): array
|
||||
{
|
||||
$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*
|
||||
*
|
||||
* ID ugradyp alyan route -da.
|
||||
*/
|
||||
public function show(CardPin $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
return response()->json(new CardPinIndexResource($order));
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(CardPinUpdateRequest $request, CardPin $order): JsonResponse
|
||||
{
|
||||
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
||||
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardPin $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
$order->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardPin\Requests;
|
||||
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\Order\Card\CardPin\CardPin
|
||||
*/
|
||||
class CardPinIndexResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'unique_id' => $this->unique_id,
|
||||
|
||||
'card_type_id' => $this->cardType?->name,
|
||||
|
||||
'card_number' => $this->card_number,
|
||||
|
||||
'region' => RegionRepo::label($this->region),
|
||||
'branch_id' => $this->branch?->name,
|
||||
|
||||
'customer_name' => $this->customer_name,
|
||||
'customer_surname' => $this->customer_surname,
|
||||
'customer_patronic_name' => $this->customer_patronic_name,
|
||||
'born_at' => $this->born_at,
|
||||
|
||||
'phone' => $this->phone,
|
||||
|
||||
'status' => OrderRepo::statusFormatted($this->status),
|
||||
|
||||
'passport_serie' => $this->passport_serie,
|
||||
'passport_id' => $this->passport_id,
|
||||
'passport_one' => url('/storage/'.$this->passport_one),
|
||||
'passport_two' => url('/storage/'.$this->passport_two),
|
||||
'passport_three' => url('/storage/'.$this->passport_three),
|
||||
'passport_four' => url('/storage/'.$this->passport_four),
|
||||
|
||||
'notes' => $this->notes,
|
||||
|
||||
'user_id' => $this->user_id,
|
||||
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
'deleted_at' => $this->deleted_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardPin\Requests;
|
||||
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardPinStoreRequest 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 [
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['required', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'region' => ['required', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||
|
||||
/**
|
||||
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
||||
*/
|
||||
'branch_id' => ['required', 'integer', Rule::exists('branches', 'id')],
|
||||
|
||||
/**
|
||||
* Customer name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'customer_name' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer surname
|
||||
*
|
||||
* @example Allaberdiyev
|
||||
*/
|
||||
'customer_surname' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer patronic name
|
||||
*
|
||||
* @example Öwezowiç
|
||||
*/
|
||||
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Date of birth
|
||||
*
|
||||
* @example 10.10.2000
|
||||
*/
|
||||
'born_at' => ['required', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['required', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['required', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Card number
|
||||
*
|
||||
* @example 9934 2312 2342 0249
|
||||
*/
|
||||
'card_number' => ['required', 'string'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['required', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* Passport (sahypa 1)
|
||||
*/
|
||||
'passport_one' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (2-3-nji sahypa)
|
||||
*/
|
||||
'passport_two' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (8-9 sahypa)
|
||||
*/
|
||||
'passport_three' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (32-nji sahypa)
|
||||
*/
|
||||
'passport_four' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardPin\Requests;
|
||||
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardPinUpdateRequest 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 [
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['sometimes', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'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 10.10.2000
|
||||
*/
|
||||
'born_at' => ['sometimes', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', 'string', Rule::in(PassportRepo::values())],
|
||||
|
||||
/**
|
||||
* Passport number
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Card number
|
||||
*
|
||||
* @example 9934 2312 2342 0249
|
||||
*/
|
||||
'card_number' => ['sometimes', 'string'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
|
||||
|
||||
/**
|
||||
* 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardRequisite;
|
||||
|
||||
use App\Http\Controllers\Api\CardRequisite\Requests\CardRequisiteStoreRequest;
|
||||
use App\Http\Controllers\Api\CardRequisite\Requests\CardRequisiteUpdateRequest;
|
||||
use App\Http\Controllers\Api\CardRequisite\Resources\CardRequisiteIndexResource;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\Requisite\CardRequisite;
|
||||
use App\Nova\Resources\Order\Card\Requisite\Actions\DownloadCardRequisite;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
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\Str;
|
||||
|
||||
#[Group('Sargytlar - Kart - Kart rekwizitler')]
|
||||
class CardRequisiteController extends Controller
|
||||
{
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json(CardRequisiteIndexResource::collection(
|
||||
CardRequisite::query()
|
||||
->with(['cardType', 'branch'])
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE*
|
||||
*/
|
||||
public function store(CardRequisiteStoreRequest $request): JsonResponse
|
||||
{
|
||||
$data = $request->validated();
|
||||
|
||||
$model = CardRequisite::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
'status' => OrderRepo::PENDING,
|
||||
],
|
||||
...$this->uploadedFiles($request),
|
||||
]);
|
||||
|
||||
$model->update(['unique_id' => CardOrderRepo::fillUniqueId($model)]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload files
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
public function uploadedFiles(Request $request): array
|
||||
{
|
||||
$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*
|
||||
*
|
||||
* ID ugradyp alyan route -da. Soň page-da download button bolmaly, basaňdan soň, `/api/card-requisites-download/{order}` route gelyan file download etmeli.
|
||||
*/
|
||||
public function show(CardRequisite $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
return response()->json(new CardRequisiteIndexResource($order));
|
||||
}
|
||||
|
||||
/**
|
||||
* Download*
|
||||
*
|
||||
* Download card transaction file
|
||||
*/
|
||||
public function download(Request $request, CardRequisite $order)
|
||||
{
|
||||
$date = today()->format('d.m.Y');
|
||||
|
||||
$response = vp_fetch_ClientInfoAll($order, $date, $date);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'url' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
$path = DownloadCardRequisite::make()->generateFile($order, $response);
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => $response->message,
|
||||
'url' => url($path),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(CardRequisiteUpdateRequest $request, CardRequisite $order): JsonResponse
|
||||
{
|
||||
$data = array_merge($request->validated(), $this->uploadedFiles($request));
|
||||
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardRequisite $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
$order->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardRequisite\Requests;
|
||||
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardRequisiteStoreRequest 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 [
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['required', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['required', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'region' => ['required', 'string', Rule::in(array_keys(RegionRepo::values()))],
|
||||
|
||||
/**
|
||||
* Branch id (https://online.tbbank.gov.tm/api/branches)
|
||||
*/
|
||||
'branch_id' => ['required', 'integer', Rule::exists('branches', 'id')],
|
||||
|
||||
/**
|
||||
* Customer name
|
||||
*
|
||||
* @example Mahmyt
|
||||
*/
|
||||
'customer_name' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer surname
|
||||
*
|
||||
* @example Allaberdiyev
|
||||
*/
|
||||
'customer_surname' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Customer patronic name
|
||||
*
|
||||
* @example Öwezowiç
|
||||
*/
|
||||
'customer_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Date of birth
|
||||
*
|
||||
* @example 10.10.2000
|
||||
*/
|
||||
'born_at' => ['required', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['required', 'integer', 'between:61000000, 71999999'],
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['required', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['required', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* Passport (sahypa 1)
|
||||
*/
|
||||
'passport_one' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (2-3-nji sahypa)
|
||||
*/
|
||||
'passport_two' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (8-9 sahypa)
|
||||
*/
|
||||
'passport_three' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
|
||||
/**
|
||||
* Pasport (32-nji sahypa)
|
||||
*/
|
||||
'passport_four' => ['required', 'file', 'max:2048', 'mimes:jpg,png,jpeg'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardRequisite\Requests;
|
||||
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class CardRequisiteUpdateRequest 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 [
|
||||
/**
|
||||
* Card type id (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*/
|
||||
'card_type_id' => ['sometimes', 'integer', Rule::exists('card_types', 'id')],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
|
||||
/**
|
||||
* Region (https://online.tbbank.gov.tm/api/base-app-enums)
|
||||
*
|
||||
* @example ag
|
||||
*/
|
||||
'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 10.10.2000
|
||||
*/
|
||||
'born_at' => ['sometimes', 'before_or_equal:today'],
|
||||
|
||||
/**
|
||||
* Phone number
|
||||
*
|
||||
* @example 65999990
|
||||
*/
|
||||
'phone' => ['sometimes', 'integer', 'between:61000000, 71999999'],
|
||||
/**
|
||||
* Passport serie
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* 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'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardRequisite\Resources;
|
||||
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\Order\Card\Requisite\CardRequisite
|
||||
*/
|
||||
class CardRequisiteIndexResource extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'unique_id' => $this->unique_id,
|
||||
|
||||
'card_type_id' => $this->cardType?->name,
|
||||
'card_number' => $this->card_number,
|
||||
'card_month' => $this->card_month,
|
||||
'card_year' => $this->card_year,
|
||||
|
||||
'region' => RegionRepo::label($this->region),
|
||||
'branch_id' => $this->branch?->name,
|
||||
|
||||
'customer_name' => $this->customer_name,
|
||||
'customer_surname' => $this->customer_surname,
|
||||
'customer_patronic_name' => $this->customer_patronic_name,
|
||||
|
||||
'born_at' => $this->born_at,
|
||||
'phone' => $this->phone,
|
||||
|
||||
'passport_serie' => $this->passport_serie,
|
||||
'passport_id' => $this->passport_id,
|
||||
|
||||
'passport_one' => url('/storage/'.$this->passport_one),
|
||||
'passport_two' => url('/storage/'.$this->passport_two),
|
||||
'passport_three' => url('/storage/'.$this->passport_three),
|
||||
'passport_four' => url('/storage/'.$this->passport_four),
|
||||
|
||||
'notes' => $this->notes,
|
||||
'user_id' => $this->user_id,
|
||||
|
||||
'status' => OrderRepo::statusFormatted($this->status),
|
||||
|
||||
'created_at' => $this->created_at,
|
||||
'updated_at' => $this->updated_at,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\CardTransaction;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Card\CardTransaction\CardTransaction;
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Nova\Resources\Order\Card\CardTransaction\Actions\DownloadCardTransaction;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
#[Group('Sargytlar - Kart - Kart hereketleri')]
|
||||
class CardTransactionsController extends Controller
|
||||
{
|
||||
/**
|
||||
* This month transactions on card
|
||||
*/
|
||||
public function lastMonth(): JsonResponse
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
$start_date = today()->subDays(10)->format('d.m.Y');
|
||||
$end_date = today()->format('d.m.Y');
|
||||
$passport_serie = $user->getOption('passport_serie');
|
||||
$passport_id = $user->getOption('passport_id');
|
||||
$card_number = $user->getOption('card_number');
|
||||
$card_month = $user->getOption('card_month');
|
||||
$card_year = $user->getOption('card_year');
|
||||
|
||||
if (
|
||||
is_null($passport_serie) || $passport_serie === '' ||
|
||||
is_null($passport_id) || $passport_id === '' ||
|
||||
is_null($card_number) || $card_number === '' ||
|
||||
is_null($card_month) || $card_month === '' ||
|
||||
is_null($card_year) || $card_year === ''
|
||||
) {
|
||||
return response()->rest([
|
||||
'status' => false,
|
||||
'message' => 'Profile data needed',
|
||||
'data' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
$card_month = str_pad($card_month, 2, '0', STR_PAD_LEFT);
|
||||
|
||||
$response = fetchCardTransactionFromAzat(
|
||||
passport_serie: $passport_serie,
|
||||
passport_id: $passport_id,
|
||||
card_number_masked: Str::mask($card_number, '*', 6, 6),
|
||||
card_expire_date: $card_month.'/'.substr($card_year, 2),
|
||||
start_date: $start_date,
|
||||
end_date: $end_date,
|
||||
);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'data' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => 'a',
|
||||
'data' => $response,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* LIST*
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
return response()->json(
|
||||
CardTransaction::query()
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* SAVE*
|
||||
*/
|
||||
public function store(Request $request): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['required', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['required', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['required', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['required', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
CardTransaction::forceCreate([
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
],
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
|
||||
/**
|
||||
* SHOW*
|
||||
*
|
||||
* ID ugradyp alyan route -da. Soň page-da download button bolmaly, basaňdan soň, modal çykmaly, start date bilen end date ugradyp download basanda `/api/card-transactions-download/{order}` route gelyan pdf download etmeli.
|
||||
*/
|
||||
public function show(CardTransaction $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
return response()->json($order);
|
||||
}
|
||||
|
||||
/**
|
||||
* Download*
|
||||
*
|
||||
* Download card transaction file
|
||||
*/
|
||||
public function download(Request $request, CardTransaction $order)
|
||||
{
|
||||
$data = $request->validate([
|
||||
'start_date' => ['required', 'string', 'date'],
|
||||
'end_date' => ['required', 'string', 'date', 'after:start_date'],
|
||||
]);
|
||||
|
||||
$start_date = Carbon::create($data['start_date'])->format('d.m.Y');
|
||||
$end_date = Carbon::create($data['end_date'])->format('d.m.Y');
|
||||
|
||||
$response = vp_fetch_ClientInfoAll($order, $start_date, $end_date);
|
||||
|
||||
if ($response->errCode != 0) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => $response->message,
|
||||
'url' => '',
|
||||
]);
|
||||
}
|
||||
|
||||
$url = DownloadCardTransaction::make()->doFiles($order, $response);
|
||||
|
||||
return response()->json([
|
||||
'status' => true,
|
||||
'message' => $response->message,
|
||||
'url' => $url,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* UPDATE*
|
||||
*
|
||||
* ID ugradyp `route`-da update edip bilyan. Base App Enum-lardan peydalan. Panelkadan gor.
|
||||
*/
|
||||
public function update(Request $request, CardTransaction $order): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['sometimes', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* @example 379514
|
||||
*/
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000243
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
]);
|
||||
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE*
|
||||
*/
|
||||
public function destroy(CardTransaction $order): JsonResponse
|
||||
{
|
||||
if ($order->user_id != auth()->id()) {
|
||||
return response()->json(status: 403);
|
||||
}
|
||||
|
||||
$order->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
43
app/Http/Controllers/Api/ContactUsController.php
Normal file
43
app/Http/Controllers/Api/ContactUsController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMS\ContactUs;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ContactUsController extends Controller
|
||||
{
|
||||
/**
|
||||
* Store contact us message
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->validate([
|
||||
/**
|
||||
* Message Title
|
||||
*
|
||||
* @example Salam
|
||||
*/
|
||||
'title' => ['required', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Message content
|
||||
*
|
||||
* @example Bet app
|
||||
*/
|
||||
'message' => ['required', 'string', 'max:255'],
|
||||
]);
|
||||
|
||||
ContactUs::forceCreate(
|
||||
...$data,
|
||||
...[
|
||||
'user_id' => auth()->id(),
|
||||
],
|
||||
);
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully created'),
|
||||
], 201);
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ class LoanOrderRemainingOrderController extends Controller
|
||||
return response()->json(
|
||||
LoanRemainingOrder::query()
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
);
|
||||
}
|
||||
@@ -119,7 +120,7 @@ class LoanOrderRemainingOrderController extends Controller
|
||||
$order->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully deleted')
|
||||
'message' => __('Successfully deleted'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ use App\Http\Controllers\Api\LoanPaidOffLetterOrder\Requests\LoanPaidOffLetterOr
|
||||
use App\Http\Controllers\Api\LoanPaidOffLetterOrder\Resources\LoanPaidOffLetterOrderIndexResource;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Loan\LoanPaidOffLetterOrder;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use App\Repos\System\Settings\Location\RegionRepo;
|
||||
use Dedoc\Scramble\Attributes\Group;
|
||||
@@ -28,6 +27,7 @@ class LoanPaidOffLetterOrderController extends Controller
|
||||
LoanPaidOffLetterOrder::query()
|
||||
->with('branch')
|
||||
->where('user_id', auth()->id())
|
||||
->latest()
|
||||
->get()
|
||||
));
|
||||
}
|
||||
@@ -161,7 +161,6 @@ class LoanPaidOffLetterOrderController extends Controller
|
||||
]);
|
||||
|
||||
Model::unguarded(function () use ($order, $data) {
|
||||
info([$data]);
|
||||
$order->update($data);
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class ResetPasswordController extends Controller
|
||||
{
|
||||
$request->validate([
|
||||
'username' => ['required', 'string', 'max:250', 'exists:users,username'],
|
||||
'verification' => ['nullable', 'integer', 'digits:5', Rule::requiredIf(fn () => $request->filled('step-verification'))],
|
||||
'verification' => ['nullable', 'integer', Rule::requiredIf(fn () => $request->filled('step-verification'))],
|
||||
'step-sms' => ['nullable'],
|
||||
'step-verification' => ['nullable'],
|
||||
'step-password' => ['nullable'],
|
||||
|
||||
11
app/Http/Controllers/GitPullController.php
Normal file
11
app/Http/Controllers/GitPullController.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class GitPullController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return 'a';
|
||||
}
|
||||
}
|
||||
@@ -25,27 +25,6 @@ class OnlinePaymentController extends Controller
|
||||
{
|
||||
$data = OnlinePaymentRepo::checkPaymentVisaMaster($request);
|
||||
|
||||
/** @var \App\Models\Payment\OnlinePaymentHistory */
|
||||
$paymentHistory = $data['paymentHistory'];
|
||||
|
||||
/** @var \App\Models\Branch\Branch */
|
||||
$bank = $data['bank_branch'];
|
||||
|
||||
/** @var \App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem */
|
||||
$resource = $data['resource'];
|
||||
|
||||
// if ($data['success'] && $paymentHistory && is_array($paymentHistory->api_response)) {
|
||||
// info(OnlinePaymentRepo::syncWithBilling(
|
||||
// uuid: $paymentHistory->orderId,
|
||||
// bank_code: $bank->unique_code,
|
||||
// terminal_id: $paymentHistory->api_response['terminalId'],
|
||||
// account_number: $resource->parent->sender_datas[0]['deposit_account'],
|
||||
// rrn: $paymentHistory->api_response['authRefNum'],
|
||||
// amount: $resource->tmt_payment_amount,
|
||||
// pay_purpose: $resource->created_at->translatedFormat('F').' '.$resource->created_at->format('Y'),
|
||||
// ));
|
||||
// }
|
||||
|
||||
return view(OnlinePaymentRepo::statusView(), $data);
|
||||
}
|
||||
|
||||
@@ -56,8 +35,6 @@ class OnlinePaymentController extends Controller
|
||||
{
|
||||
$data = OnlinePaymentRepo::checkPaymentSber($request);
|
||||
|
||||
// OnlinePaymentRepo::syncWithBilling();
|
||||
|
||||
return view(OnlinePaymentRepo::statusView(), $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Requests\UpdateUserProfileRequest;
|
||||
use App\Http\Resources\ProfileResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class ProfileController extends Controller
|
||||
@@ -15,12 +16,7 @@ class ProfileController extends Controller
|
||||
/** @var \App\Models\User */
|
||||
$user = auth()->user();
|
||||
|
||||
return response()->json([
|
||||
'name' => $user->name,
|
||||
'phone' => $user->phone,
|
||||
'passport_serie' => $user->getOption('passport_serie'),
|
||||
'passport_id' => $user->getOption('passport_id'),
|
||||
]);
|
||||
return response()->json(new ProfileResponse($user));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,6 +32,10 @@ class ProfileController extends Controller
|
||||
'phone' => $request->phone,
|
||||
'options->passport_serie' => $request->passport_serie,
|
||||
'options->passport_id' => $request->passport_id,
|
||||
'options->card_number' => $request->card_number,
|
||||
'options->card_month' => $request->card_month,
|
||||
'options->card_year' => $request->card_year,
|
||||
'options->card_name' => $request->card_name,
|
||||
];
|
||||
|
||||
if ($request->password) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
@@ -47,14 +48,34 @@ class UpdateUserProfileRequest extends FormRequest
|
||||
*
|
||||
* @example I-AS
|
||||
*/
|
||||
'passport_serie' => ['nullable', 'string', Rule::in(array_keys(PassportRepo::values()))],
|
||||
'passport_serie' => ['sometimes', 'string', Rule::in(array_keys(PassportRepo::values()))],
|
||||
|
||||
/**
|
||||
* Passport id
|
||||
*
|
||||
* @example 100999
|
||||
*/
|
||||
'passport_id' => ['nullable', 'numeric', 'digits:6'],
|
||||
'passport_id' => ['sometimes', 'numeric', 'digits:6'],
|
||||
|
||||
/**
|
||||
* @example 9934612100000543
|
||||
*/
|
||||
'card_number' => ['sometimes', 'digits:16'],
|
||||
|
||||
/**
|
||||
* @example 12
|
||||
*/
|
||||
'card_month' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberMonths()))],
|
||||
|
||||
/**
|
||||
* @example 2049
|
||||
*/
|
||||
'card_year' => ['sometimes', Rule::in(array_keys(DateHelperRepository::staticNumberYears()))],
|
||||
|
||||
/**
|
||||
* @example Nurmuhammet Allanov
|
||||
*/
|
||||
'card_name' => ['sometimes', 'string', 'max:255'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
31
app/Http/Resources/ProfileResponse.php
Normal file
31
app/Http/Resources/ProfileResponse.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\User
|
||||
*/
|
||||
class ProfileResponse extends JsonResource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toArray(Request $request): array
|
||||
{
|
||||
return [
|
||||
'name' => $this->name,
|
||||
'phone' => $this->phone,
|
||||
'passport_serie' => $this->getOption('passport_serie'),
|
||||
'passport_id' => $this->getOption('passport_id'),
|
||||
'card_number' => $this->getOption('card_number'),
|
||||
'card_month' => $this->getOption('card_month'),
|
||||
'card_year' => $this->getOption('card_year'),
|
||||
'card_name' => $this->getOption('card_name'),
|
||||
];
|
||||
}
|
||||
}
|
||||
64
app/Jobs/SendSberToSystem.php
Normal file
64
app/Jobs/SendSberToSystem.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SendSberToSystem implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* The number of seconds the job can run before timing out.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
public $timeout = 5;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$ignore = DB::table('ignore_sber_payments')->pluck('payment_id');
|
||||
|
||||
$orderItems = SberPaymentOrderItem::query()
|
||||
->where('paid', true)
|
||||
->where('synced_with_system', false)
|
||||
->whereDate('created_at', '>', '2025-09-05')
|
||||
->whereIntegerNotInRaw('id', $ignore)
|
||||
->limit(2)
|
||||
->get()
|
||||
->each(function ($orderItem) {
|
||||
if (! $orderItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = syncSberWithAzatAPI($orderItem);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
ignoreSberPayment($result['error'], $orderItem);
|
||||
|
||||
Log::channel('sber_job')->error(json_encode([
|
||||
'error' => $result['error'],
|
||||
'orderItem' => $orderItem,
|
||||
]));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
50
app/Jobs/SendVisaToSystem.php
Normal file
50
app/Jobs/SendVisaToSystem.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SendVisaToSystem implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$ignore = DB::table('ignore_visa_payments')->pluck('payment_id');
|
||||
|
||||
$orderItems = VisaMasterPaymentOrderItem::query()
|
||||
->where('paid', true)
|
||||
->where('synced_with_system', false)
|
||||
->whereDate('created_at', '>', '2025-09-05')
|
||||
->whereIntegerNotInRaw('id', $ignore)
|
||||
->limit(2)
|
||||
->get()
|
||||
->each(function ($orderItem) {
|
||||
if (! $orderItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = syncVisaWithAzatAPI($orderItem);
|
||||
|
||||
if (isset($result['error'])) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
19
app/Models/CMS/ContactUs.php
Normal file
19
app/Models/CMS/ContactUs.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\CMS;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $title
|
||||
* @property string $message
|
||||
* @property \Illuminate\Support\Facades\Date $created_at
|
||||
* @property \Illuminate\Support\Facades\Date $updated_at
|
||||
*/
|
||||
class ContactUs extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/IgnoreSberPayment.php
Normal file
11
app/Models/IgnoreSberPayment.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class IgnoreSberPayment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/IgnoreVisaPayment.php
Normal file
11
app/Models/IgnoreVisaPayment.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class IgnoreVisaPayment extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use Laravel\Nova\Actions\Actionable;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $passport_serie
|
||||
* @property string $passport_id
|
||||
* @property string $card_number
|
||||
|
||||
@@ -158,7 +158,7 @@ class CardOrder extends Model
|
||||
/**
|
||||
* Price for order
|
||||
*/
|
||||
public function priceAmount(): float
|
||||
public function priceAmount(): string|int|float
|
||||
{
|
||||
return $this->cardState->price ?? 32;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,37 @@ namespace App\Models\Order\Card\CardPin;
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\Order\Card\CardType;
|
||||
use App\Models\User;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property null|string $unique_id
|
||||
* @property int $card_type_id
|
||||
* @property string $card_number
|
||||
* @property string $region
|
||||
* @property int $branch_id
|
||||
* @property string $customer_name
|
||||
* @property string $customer_surname
|
||||
* @property null|string $customer_patronic_name
|
||||
* @property null|string $born_at
|
||||
* @property null|string $phone
|
||||
* @property string $passport_serie
|
||||
* @property string $passport_id
|
||||
* @property null|string $status
|
||||
* @property null|string $passport_one
|
||||
* @property null|string $passport_two
|
||||
* @property null|string $passport_three
|
||||
* @property null|string $passport_four
|
||||
* @property null|string $notes
|
||||
* @property int $user_id
|
||||
* @property null|string $created_at
|
||||
* @property null|string $updated_at
|
||||
* @property null|string $deleted_at
|
||||
*/
|
||||
class CardPin extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
@@ -96,4 +122,14 @@ class CardPin extends Model
|
||||
{
|
||||
return 3.02;
|
||||
}
|
||||
|
||||
/**
|
||||
* "boot" method for model
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::created(LoanOrderRepo::created());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use Laravel\Nova\Actions\Actionable;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $passport_serie
|
||||
* @property string $passport_id
|
||||
* @property string $card_number
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models\Order\Loan;
|
||||
|
||||
use App\Models\Branch\Branch;
|
||||
use App\Models\User;
|
||||
use App\Repos\Order\Loan\LoanOrderRepo;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
@@ -94,4 +95,15 @@ class LoanPaidOffLetterOrder extends Model
|
||||
{
|
||||
return $this->belongsTo(Branch::class, 'branch_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* "boot" method for model
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(LoanOrderRepo::creating());
|
||||
static::created(LoanOrderRepo::created());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,12 +175,20 @@ class User extends Authenticatable
|
||||
return $this->hasRole('operator');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is a currency maintainer.
|
||||
*/
|
||||
public function isCurrencyMaintainer(): bool
|
||||
{
|
||||
return $this->hasRole('currency_maintainer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Is System User
|
||||
*/
|
||||
public function isSystemUser(): bool
|
||||
{
|
||||
return $this->isAdmin() || $this->isOperator();
|
||||
return $this->isAdmin() || $this->isOperator() || $this->isCurrencyMaintainer();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
11
app/Models/Warning.php
Normal file
11
app/Models/Warning.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Warning extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Modules\ApiAuth\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\ProfileResponse;
|
||||
use App\Models\User;
|
||||
use App\Modules\ApiAuth\Requests\AuthLoginRequest;
|
||||
use App\Modules\ApiAuth\Requests\AuthRegisterRequest;
|
||||
@@ -59,7 +60,10 @@ class ApiAuthController extends Controller
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'message' => $user->createToken(bin2hex(random_bytes(20)))->plainTextToken,
|
||||
'success' => true,
|
||||
'token' => $user->createToken(bin2hex(random_bytes(20)))->plainTextToken,
|
||||
'message' => __('successfully verified'),
|
||||
'user' => new ProfileResponse($user),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,16 @@
|
||||
namespace App\Modules\BaseAppEnum\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Repos\Order\Card\CardStateRepo;
|
||||
use App\Repos\Order\Card\CardTypeRepo;
|
||||
use App\Repos\Order\Loan\LoanTypeRepo;
|
||||
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 Dedoc\Scramble\Attributes\Group;
|
||||
|
||||
#[Group('1. App enums')]
|
||||
class BaseAppEnumController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -26,6 +30,8 @@ class BaseAppEnumController extends Controller
|
||||
'educations' => $this->educationValues(),
|
||||
'marriage_statuses' => MarriageRepo::values(),
|
||||
'passport_series' => PassportRepo::values(),
|
||||
'card_types' => CardTypeRepo::values(),
|
||||
'card_states' => CardStateRepo::values(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,14 @@ namespace App\Modules\LoanOrder\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Order\Loan\LoanOrder;
|
||||
use App\Modules\DateHelper\Repositories\DateHelperRepository;
|
||||
use App\Modules\LoanOrder\Controllers\Requests\LoanOrderStoreRequest;
|
||||
use App\Modules\LoanOrder\Controllers\Requests\LoanOrderUpdateRequest;
|
||||
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')]
|
||||
@@ -27,12 +24,19 @@ class LoanOrderController extends Controller
|
||||
*/
|
||||
public function index(Request $request): JsonResponse
|
||||
{
|
||||
return response()->json(LoanOrderIndexResource::collection(
|
||||
return response()->json(
|
||||
LoanOrder::query()
|
||||
->where('user_id', auth()->id())
|
||||
->where('source', OrderRepo::MOBILE_DEVICE)
|
||||
->paginate()
|
||||
));
|
||||
->latest()
|
||||
->get()
|
||||
->map(fn (LoanOrder $loanOrder) => [
|
||||
'id' => $loanOrder->id,
|
||||
'loan_type' => $loanOrder->loanType?->name,
|
||||
'loan_amount' => $loanOrder->loan_amount,
|
||||
'created_at' => $loanOrder->created_at,
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,22 +46,8 @@ class LoanOrderController extends Controller
|
||||
*/
|
||||
public function store(LoanOrderStoreRequest $request): JsonResponse
|
||||
{
|
||||
Log::channel('form_logs')->info('loan-order-store-request', $request->all());
|
||||
|
||||
$data = $request->validated();
|
||||
|
||||
$months = DateHelperRepository::monthsAsNumber();
|
||||
$years = DateHelperRepository::yearsUntil();
|
||||
|
||||
$data['card_month'] = indexByValue($request->card_month, $months);
|
||||
$data['card_year'] = indexByValue($request->card_year, $years);
|
||||
|
||||
$data['guarantor_card_month'] = indexByValue($request->guarantor_card_month, $months);
|
||||
$data['guarantor_card_year'] = indexByValue($request->guarantor_card_year, $years);
|
||||
|
||||
$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,
|
||||
...[
|
||||
@@ -112,45 +102,14 @@ class LoanOrderController extends Controller
|
||||
*/
|
||||
public function update(LoanOrderUpdateRequest $request, LoanOrder $loanOrder): JsonResponse
|
||||
{
|
||||
Log::channel('form_logs')->info('loan-order-update-request', $request->all());
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
if ($request->filled('guarantor_2_card_year')) {
|
||||
$data['guarantor_2_card_year'] = indexByValue($request->guarantor_2_card_year, $years);
|
||||
}
|
||||
|
||||
$data += $this->uploadedFiles($request);
|
||||
$data = array_merge($request->all(), $this->uploadedFiles($request));
|
||||
|
||||
Model::unguarded(function () use ($loanOrder, $data) {
|
||||
$loanOrder->update($data);
|
||||
});
|
||||
|
||||
return response()->json([
|
||||
'message' => __('Successfully updates'),
|
||||
'message' => __('Successfully updated'),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ class LoanOrderStoreRequest extends FormRequest
|
||||
*
|
||||
* @example Owezowic
|
||||
*/
|
||||
'guarantor_patronic_name' => ['required', 'string', 'max:255'],
|
||||
'guarantor_patronic_name' => ['nullable', 'string', 'max:255'],
|
||||
|
||||
/**
|
||||
* Guarantor card number
|
||||
|
||||
@@ -48,10 +48,10 @@ class LoanOrderIndexResource extends JsonResource
|
||||
'work_position' => $this->work_position,
|
||||
'education' => $this->education,
|
||||
'marriage_status' => $this->marriage_status,
|
||||
'passport_one' => url('/storage/' . $this->passport_one),
|
||||
'passport_two' => url('/storage/' . $this->passport_two),
|
||||
'passport_three' => url('/storage/' . $this->passport_three),
|
||||
'passport_four' => url('/storage/' . $this->passport_four),
|
||||
'passport_one' => url('/storage/'.$this->passport_one),
|
||||
'passport_two' => url('/storage/'.$this->passport_two),
|
||||
'passport_three' => url('/storage/'.$this->passport_three),
|
||||
'passport_four' => url('/storage/'.$this->passport_four),
|
||||
'user_id' => $this->user_id,
|
||||
'status' => $this->status,
|
||||
'notes' => $this->notes,
|
||||
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Laravel\Nova\Actions\Actionable;
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
|
||||
@@ -25,6 +26,10 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
* @property int $user_id
|
||||
* @property string $address
|
||||
* @property array $sender_datas
|
||||
* @property ?string $sender_full_name
|
||||
* @property ?string $sender_passport_serie
|
||||
* @property ?string $sender_passport_number
|
||||
* @property ?string $sender_deposit_account
|
||||
* @property array $payment_reciever
|
||||
* @property string $documents
|
||||
* @property string $status
|
||||
@@ -36,6 +41,7 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
*/
|
||||
class SberPaymentOrder extends Model implements HasMedia
|
||||
{
|
||||
use Actionable;
|
||||
use InteractsWithMedia;
|
||||
use SoftDeletes;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
* @property string $tmt_payment_amount
|
||||
* @property string $usd_payment_amount
|
||||
* @property bool $paid
|
||||
* @property bool $synced_with_system
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
*/
|
||||
@@ -36,6 +37,16 @@ class SberPaymentOrderItem extends Model implements HasMedia
|
||||
*/
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'paid' => 'boolean',
|
||||
'synced_with_system' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Parent order
|
||||
*
|
||||
|
||||
@@ -8,6 +8,44 @@ use Illuminate\Http\Request;
|
||||
|
||||
trait NovaSberPaymentOrderAuth
|
||||
{
|
||||
/**
|
||||
* Determine if the resource should be available for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return void
|
||||
*
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
public function authorizeToViewAny(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isSystemUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var SberPaymentOrder $resource */
|
||||
$resource = $this->resource;
|
||||
if ($resource->user_id == auth()->id()) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AuthorizationException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the resource should be available for the given request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
public static function authorizedToViewAny(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** View */
|
||||
public function authorizeToView(Request $request)
|
||||
{
|
||||
@@ -57,7 +95,7 @@ trait NovaSberPaymentOrderAuth
|
||||
}
|
||||
|
||||
/** Delete button */
|
||||
public function authorizedToDelete(Request $request)
|
||||
public function authorizedToDelete(Request $request): bool
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
|
||||
@@ -72,26 +72,21 @@ class SberPaymentOrderFieldsForDetail
|
||||
Text::make(__('Current Residence'), 'address'),
|
||||
]),
|
||||
new Panel(__('Payment'), [
|
||||
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->options(PassportRepo::values()),
|
||||
Text::make(__('Payment sender data'), function () use ($resource) {
|
||||
return sprintf(
|
||||
'<strong>%s-%s %s</strong>',
|
||||
$resource->sender_passport_serie,
|
||||
$resource->sender_passport_number,
|
||||
$resource->sender_full_name
|
||||
);
|
||||
})->asHtml(),
|
||||
|
||||
NovaInputmask::make(__('Passport number'), 'passport_number')
|
||||
->mask('999999'),
|
||||
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||
attribute: 'full_name'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'deposit_account'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
])->minRows(1)->rules('required'),
|
||||
Text::make(__('Töleg ugradyjynyň goýum hasaby'), function () use ($resource) {
|
||||
return sprintf(
|
||||
'<strong>%s</strong>',
|
||||
number_format($resource->sender_deposit_account, 0, '', '')
|
||||
);
|
||||
})->asHtml(),
|
||||
|
||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
|
||||
@@ -28,42 +28,18 @@ trait NovaSberPaymentOrderItemAuth
|
||||
/** Edit button */
|
||||
public function authorizedToUpdate(Request $request): bool
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Update */
|
||||
public function authorizeToUpdate(Request $request): void
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AuthorizationException;
|
||||
}
|
||||
|
||||
/** Delete button */
|
||||
public function authorizedToDelete(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->isMe()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Force delete */
|
||||
public function authorizedToForceDelete(Request $request)
|
||||
{
|
||||
return auth()->user()->isMe() ? true : false;
|
||||
return auth()->user()->isMe();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,7 @@ class NovaSberPaymentOrder extends Resource
|
||||
*/
|
||||
public static function indexQuery(NovaRequest $request, mixed $query): Builder
|
||||
{
|
||||
/** @var \App\Models\User $user */
|
||||
$user = $request->user();
|
||||
|
||||
if ($user->isAdmin()) {
|
||||
@@ -252,32 +253,38 @@ class NovaSberPaymentOrder extends Resource
|
||||
->hideFromIndex(),
|
||||
]),
|
||||
|
||||
new Panel(__('Payment'), [
|
||||
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
new Panel(__('Payment sender data'), [
|
||||
Select::make(__('Passport serie'), 'sender_passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->fullWidth()
|
||||
->sortable(),
|
||||
|
||||
NovaInputmask::make(__('Passport number'), 'passport_number')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
NovaInputmask::make(__('Passport number'), 'sender_passport_number')
|
||||
->mask('999999')
|
||||
->fullWidth()
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||
attribute: 'full_name'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||
attribute: 'sender_full_name'
|
||||
)
|
||||
->fullWidth()
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'deposit_account'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
])->minRows(1)->rules('required'),
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'sender_deposit_account'
|
||||
)->fullWidth()
|
||||
->rules('required', 'digits:15')
|
||||
->fillUsing(function ($request, $model, $attribute) {
|
||||
$model->sender_deposit_account = strval($request->sender_deposit_account);
|
||||
}),
|
||||
]),
|
||||
|
||||
new Panel(__('Payee information'), [
|
||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
@@ -343,22 +350,22 @@ class NovaSberPaymentOrder extends Resource
|
||||
public function actions(NovaRequest $request): array
|
||||
{
|
||||
return [
|
||||
MakeSberPaymentAction::make()
|
||||
->icon('credit-card')
|
||||
->sole()
|
||||
->canSee(function ($request) {
|
||||
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder $resource */
|
||||
$resource = $this->resource;
|
||||
// MakeSberPaymentAction::make()
|
||||
// ->icon('credit-card')
|
||||
// ->sole()
|
||||
// ->canSee(function ($request) {
|
||||
// /** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrder $resource */
|
||||
// $resource = $this->resource;
|
||||
|
||||
if (in_array($resource->status, [
|
||||
OrderRepo::PENDING,
|
||||
OrderRepo::CANCELLED,
|
||||
])) {
|
||||
return false;
|
||||
}
|
||||
// if (in_array($resource->status, [
|
||||
// OrderRepo::PENDING,
|
||||
// OrderRepo::CANCELLED,
|
||||
// ])) {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}),
|
||||
// return true;
|
||||
// }),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Models\Branch\Branch;
|
||||
use App\Models\Payment\OnlinePaymentHistory;
|
||||
use App\Modules\SberPaymentOrder\Nova\Resources\Item\NovaSberPaymentOrderItemAuth;
|
||||
use App\Nova\Actions\CheckOnlinePayment;
|
||||
use App\Nova\Actions\Sber\SyncWithSystem;
|
||||
use App\Nova\Resource;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
@@ -119,6 +120,8 @@ class NovaSberPaymentOrderItem extends Resource
|
||||
Text::make('Amalyň referensi', fn ($model) => $model->payment_order_number),
|
||||
|
||||
Boolean::make(__('Paid'), 'paid'),
|
||||
|
||||
Boolean::make(__('Synced with system'), 'synced_with_system'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -171,7 +174,18 @@ class NovaSberPaymentOrderItem extends Resource
|
||||
]);
|
||||
})->icon('server')
|
||||
->sole()
|
||||
->withoutConfirmation(),
|
||||
->withoutConfirmation()
|
||||
->canSee(function ($request) {
|
||||
return auth()->user()->isSystemUser();
|
||||
}),
|
||||
|
||||
SyncWithSystem::make()
|
||||
->icon('cloud')
|
||||
->sole()
|
||||
->withoutConfirmation()
|
||||
->canSee(function ($request) {
|
||||
return auth()->user()->isAdmin();
|
||||
}),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\VisaMasterPaymentOrder\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class VisaMasterPaymentOrderController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return response()->json();
|
||||
}
|
||||
}
|
||||
@@ -116,30 +116,21 @@ class VisaMasterPaymentOrderFieldsForDetail
|
||||
->hideFromIndex(),
|
||||
]),
|
||||
new Panel(__('Payment'), [
|
||||
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
Text::make(__('Payment sender data'), function () use ($resource) {
|
||||
return sprintf(
|
||||
'<strong>%s-%s %s</strong>',
|
||||
$resource->sender_passport_serie,
|
||||
$resource->sender_passport_number,
|
||||
$resource->sender_full_name
|
||||
);
|
||||
})->asHtml(),
|
||||
|
||||
NovaInputmask::make(__('Passport number'), 'passport_number')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||
attribute: 'full_name'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'deposit_account'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
])->minRows(1)->rules('required'),
|
||||
Text::make(__('Töleg ugradyjynyň goýum hasaby'), function () use ($resource) {
|
||||
return sprintf(
|
||||
'<strong>%s</strong>',
|
||||
number_format($resource->sender_deposit_account, 0, '', '')
|
||||
);
|
||||
})->asHtml(),
|
||||
|
||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
|
||||
@@ -263,32 +263,38 @@ class NovaVisaMasterPaymentOrder extends Resource
|
||||
->hideFromIndex(),
|
||||
]),
|
||||
|
||||
new Panel(__('Payment'), [
|
||||
SimpleRepeatable::make(__('Payment sender data'), 'sender_datas', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->sortable(),
|
||||
new Panel(__('Payment sender data'), [
|
||||
Select::make(__('Passport serie'), 'sender_passport_serie')
|
||||
->displayUsingLabels()
|
||||
->searchable()
|
||||
->options(PassportRepo::values())
|
||||
->rules('required')
|
||||
->fullWidth()
|
||||
->sortable(),
|
||||
|
||||
NovaInputmask::make(__('Passport number'), 'passport_number')
|
||||
->mask('999999')
|
||||
->rules('required', 'max:255'),
|
||||
NovaInputmask::make(__('Passport number'), 'sender_passport_number')
|
||||
->mask('999999')
|
||||
->fullWidth()
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Surname'), __('Name'), __('Patronic name')),
|
||||
attribute: 'full_name'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
Text::make(
|
||||
name: sprintf('%s %s %s', __('Name'), __('Surname'), __('Patronic name')),
|
||||
attribute: 'sender_full_name'
|
||||
)
|
||||
->fullWidth()
|
||||
->rules('required', 'max:255'),
|
||||
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'deposit_account'
|
||||
)
|
||||
->rules('required', 'max:255'),
|
||||
])->minRows(1)->rules('required'),
|
||||
Text::make(
|
||||
name: __('Goýum hasaby'),
|
||||
attribute: 'sender_deposit_account'
|
||||
)->fullWidth()
|
||||
->rules('required', 'string', 'max:255')
|
||||
->fillUsing(function ($request, $model, $attribute) {
|
||||
$model->sender_deposit_account = strval($request->sender_deposit_account);
|
||||
}),
|
||||
]),
|
||||
|
||||
new Panel(__('Payee information'), [
|
||||
SimpleRepeatable::make(__('Payee information'), 'payment_reciever', [
|
||||
Select::make(__('Passport serie'), 'passport_serie')
|
||||
->displayUsingLabels()
|
||||
|
||||
@@ -120,6 +120,8 @@ class NovaVisaMasterPaymentOrderItem extends Resource
|
||||
Text::make('Amalyň referensi', fn ($model) => $model->payment_order_number),
|
||||
|
||||
Boolean::make(__('Paid'), 'paid'),
|
||||
|
||||
Boolean::make(__('Synced with system'), 'synced_with_system'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
]);
|
||||
}
|
||||
|
||||
$total_amount = floatval(number_format($payment_amount, 2, '.', '')) + 23;
|
||||
$total_amount = floatval(number_format($payment_amount, 2, '.', '')) + 115;
|
||||
|
||||
$payment = $this->order($resource, $total_amount);
|
||||
|
||||
@@ -126,8 +126,8 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
return [
|
||||
Heading::make(Blade::render(<<<HTML
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">1 USD = $usd_to_tmt TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">Bankyň tutumy: 20 TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">GBÜS tutumy: 3 TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">Bankyň tutumy: 100 TMT</h3>
|
||||
<h3 class="uppercase tracking-wide font-bold text-xs" dusk="heading">GBÜS tutumy: 15 TMT</h3>
|
||||
HTML))->asHtml(),
|
||||
|
||||
Text::make(__('Töleg aý'), 'month')
|
||||
@@ -173,7 +173,7 @@ class MakePaymentNovaVisaMaster extends Action
|
||||
|
||||
if ($payment_amount) {
|
||||
$field->setValue(
|
||||
floatval(number_format($payment_amount, 2, '.', '')) + 23
|
||||
floatval(number_format($payment_amount, 2, '.', '')) + 115
|
||||
);
|
||||
} else {
|
||||
$field->setValue('');
|
||||
|
||||
@@ -206,9 +206,11 @@ class MakeSberPaymentAction extends Action
|
||||
|
||||
$orderNumber = $onlinePaymentRepo->generateOrderNumber($resource);
|
||||
|
||||
$final_amount = number_format($amount, 2, '', '');
|
||||
|
||||
$paymentResponse = Http::get('https://mpi.gov.tm/payment/rest/register.do', [
|
||||
'orderNumber' => $orderNumber,
|
||||
'amount' => number_format($amount, 2, '', ''),
|
||||
'amount' => $final_amount,
|
||||
'currency' => 934,
|
||||
'language' => 'ru',
|
||||
'userName' => $resource->branch->billing_sber_username,
|
||||
|
||||
73
app/Nova/Actions/Sber/SyncWithSystem.php
Normal file
73
app/Nova/Actions/Sber/SyncWithSystem.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Nova\Actions\Sber;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Nova\Actions\Action;
|
||||
use Laravel\Nova\Actions\ActionResponse;
|
||||
use Laravel\Nova\Fields\ActionFields;
|
||||
use Laravel\Nova\Http\Requests\NovaRequest;
|
||||
|
||||
class SyncWithSystem extends Action
|
||||
{
|
||||
use InteractsWithQueue, Queueable;
|
||||
|
||||
/**
|
||||
* Name.
|
||||
*/
|
||||
public function name(): string
|
||||
{
|
||||
return __('Sync with system');
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform the action on the given models.
|
||||
*
|
||||
* @param \Laravel\Nova\Fields\ActionFields $fields
|
||||
* @param \Illuminate\Support\Collection $models
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle(ActionFields $fields, Collection $models)
|
||||
{
|
||||
/** @var \App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem $orderItem */
|
||||
$orderItem = $models->first();
|
||||
|
||||
$result = syncSberWithAzatAPI($orderItem);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
return $this->handleError($result);
|
||||
}
|
||||
|
||||
return ActionResponse::message('Sync with system success');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields available on the action.
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @return array
|
||||
*/
|
||||
public function fields(NovaRequest $request)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle error
|
||||
*
|
||||
* @param array $result
|
||||
*/
|
||||
private function handleError(array $result): mixed
|
||||
{
|
||||
if ($result['type'] === 'modal') {
|
||||
return Action::modal('modal-response', [
|
||||
'title' => 'HALKBANK API',
|
||||
'body' => $result['error'],
|
||||
]);
|
||||
}
|
||||
|
||||
return ActionResponse::danger($result['error']);
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ class CardOrder extends Resource
|
||||
return $query;
|
||||
}
|
||||
|
||||
if ($user->isOperator() && count($user->branches()->pluck('branches.id')) < 1) {
|
||||
if ($user->isOperator()) {
|
||||
return $query->whereIn('branch_id', $user->branches()->pluck('branches.id'));
|
||||
}
|
||||
|
||||
|
||||
@@ -61,16 +61,9 @@ class DownloadCardTransaction extends Action
|
||||
return ActionResponse::danger($data->message);
|
||||
}
|
||||
|
||||
$unique_folder_name = Str::snake(str_replace(':', '-', $model->created_at->toDateTimeString()));
|
||||
$dir = public_path("files/{$unique_folder_name}");
|
||||
$url = $this->doFiles($model, $data);
|
||||
|
||||
File::makeDirectory($dir, 0777, true, true);
|
||||
|
||||
$fileDest = $dir."/{$model->id}.pdf";
|
||||
|
||||
$this->generateFile($data, $fileDest);
|
||||
|
||||
return ActionResponse::openInNewTab(url("files/{$unique_folder_name}/{$model->id}.pdf"));
|
||||
return ActionResponse::openInNewTab($url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -94,6 +87,26 @@ class DownloadCardTransaction extends Action
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles all file stuff
|
||||
*
|
||||
* @param $model
|
||||
* @param $data
|
||||
*/
|
||||
public function doFiles($model, $data): string
|
||||
{
|
||||
$unique_folder_name = Str::snake(str_replace(':', '-', $model->created_at->toDateTimeString()));
|
||||
$dir = public_path("files/{$unique_folder_name}");
|
||||
|
||||
File::makeDirectory($dir, 0777, true, true);
|
||||
|
||||
$fileDest = $dir."/{$model->id}.pdf";
|
||||
|
||||
$this->generateFile($data, $fileDest);
|
||||
|
||||
return url("files/{$unique_folder_name}/{$model->id}.pdf");
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch from internal API
|
||||
*
|
||||
|
||||
@@ -32,6 +32,8 @@ class AzatApiClientInfoAllResponse
|
||||
|
||||
public string $mfo;
|
||||
|
||||
public string $inn;
|
||||
|
||||
public string $passOrg;
|
||||
|
||||
public string $passDate;
|
||||
|
||||
@@ -99,11 +99,11 @@ class DownloadCardRequisite extends Action
|
||||
'contract' => $data->cardAccountNumber,
|
||||
'bank' => $data->depName,
|
||||
'hasap' => $data->accountNumber,
|
||||
'sb' => '---YOK--',
|
||||
'sb' => $data->inn,
|
||||
'bab' => $data->mfo,
|
||||
'card_type' => $data->cardName,
|
||||
'card_number' => $data->cardPan,
|
||||
'phone' => $data->phone ?? '-',
|
||||
'phone' => $data->mobilPhone ?? '-',
|
||||
'contract_date' => '---YOK---',
|
||||
'card_order_date' => '---YOK---',
|
||||
'card_given_date' => '---YOK---',
|
||||
|
||||
@@ -9,6 +9,7 @@ use App\Nova\Filters\RegionFilter;
|
||||
use App\Nova\Filters\StatusFilter;
|
||||
use App\Nova\Nova;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Card\CardType;
|
||||
use App\Nova\Resources\Order\Card\Requisite\Actions\DownloadCardRequisite;
|
||||
use App\Nova\Resources\Order\Card\Requisite\Concerns\CardRequisiteFieldsForDetail;
|
||||
use App\Nova\Resources\Order\Card\Requisite\Concerns\CardRequisiteFieldsForIndex;
|
||||
@@ -21,6 +22,7 @@ use App\Rules\OnlyLetters;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Laravel\Nova\Fields\BelongsTo;
|
||||
use Laravel\Nova\Fields\Date;
|
||||
use Laravel\Nova\Fields\Hidden;
|
||||
use Laravel\Nova\Fields\ID;
|
||||
@@ -205,10 +207,15 @@ class CardRequisite extends Resource
|
||||
->canSeeWhen('systemUser', $this),
|
||||
|
||||
new Panel(__('Card'), [
|
||||
BelongsTo::make(__('Type'), 'cardType', CardType::class)
|
||||
->sortable()
|
||||
->size('md:w-1/4')
|
||||
->required(),
|
||||
|
||||
NovaInputmask::make(__('Card number'), 'card_number')
|
||||
->mask('9999 9999 9999 9999')
|
||||
->storeRawValue()
|
||||
->size('w-1/2')
|
||||
->size('md:w-1/4')
|
||||
->rules('required', 'int', 'digits:16'),
|
||||
|
||||
Select::make(__('Card').' '.__('Expiration month'), 'card_month')
|
||||
|
||||
@@ -9,7 +9,6 @@ use App\Nova\Filters\StatusFilter;
|
||||
use App\Nova\Resource;
|
||||
use App\Nova\Resources\Order\Loan\LoanPaidOffLetter\LoanPaidOffLetterOrderFieldsForDetail;
|
||||
use App\Nova\Resources\Order\Loan\LoanPaidOffLetter\LoanPaidOffLetterOrderFieldsForIndex;
|
||||
use App\Repos\Order\Card\CardOrderRepo;
|
||||
use App\Repos\Order\OrderRepo;
|
||||
use App\Repos\System\Nova\NovaRepo;
|
||||
use App\Repos\System\Settings\Legal\PassportRepo;
|
||||
@@ -118,17 +117,6 @@ class LoanPaidOffLetterOrder extends Resource
|
||||
return $query->where('user_id', $request->user()->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* After resource created
|
||||
*
|
||||
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
*/
|
||||
public static function afterCreate(NovaRequest $request, Model $model): void
|
||||
{
|
||||
$model->update(['unique_id' => CardOrderRepo::fillUniqueId($model)]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the fields for index.
|
||||
*
|
||||
|
||||
@@ -77,6 +77,7 @@ class AuthServiceProvider extends ServiceProvider
|
||||
Gate::define('isMe', fn (User $user) => $user->isMe());
|
||||
Gate::define('isSuperAdmin', fn (User $user) => $user->isSuperAdmin());
|
||||
Gate::define('isAdmin', fn (User $user) => $user->isAdmin());
|
||||
Gate::define('isCurrencyMaintainer', fn (User $user) => $user->isCurrencyMaintainer());
|
||||
Gate::define('systemUser', fn (User $user) => $user->isSystemUser());
|
||||
Gate::define('fuck', fn () => true);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
RateLimiter::for('api', function (Request $request) {
|
||||
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
|
||||
return Limit::perMinute(300)->by($request->user()?->id ?: $request->ip());
|
||||
});
|
||||
|
||||
$this->routes(function () {
|
||||
|
||||
@@ -39,7 +39,7 @@ trait HandlesBillingSyncing
|
||||
|
||||
$request = new Request(
|
||||
method: 'POST',
|
||||
uri: 'http://10.3.158.102:8888/api/paytrn/new',
|
||||
uri: 'http://10.3.158.102:9999/api/paytrn/new',
|
||||
headers: [
|
||||
'Content-Type' => 'application/json',
|
||||
'Authorization' => 'Basic YWRtaW46UUFad3N4MTIz',
|
||||
@@ -50,16 +50,16 @@ trait HandlesBillingSyncing
|
||||
$client = new Client;
|
||||
$response = $client->sendAsync($request)->wait();
|
||||
|
||||
// curl --location --request POST 'http://10.3.158.102:8888/api/paytrn/new' \
|
||||
// --header 'Authorization: Basic YWRtaW46UUFad3N4MTIz' \
|
||||
// curl --location 'http://10.3.158.102:9999/api/paytrn/new' \
|
||||
// --header 'Content-Type: application/json' \
|
||||
// --data-raw '{
|
||||
// "ecomId" : "0c406ee2-097d-42f7-86c8-18127bd87e10",
|
||||
// "agentId" : "1307",
|
||||
// "eposId" : "30400225",
|
||||
// "account" : "4324234234",
|
||||
// "rnn" : "002959773584",
|
||||
// "amount" : 0.1,
|
||||
// --header 'Authorization: Basic YWRtaW46UUFad3N4MTIz' \
|
||||
// --data '{
|
||||
// "ecomId" : "12345-12345-12345-12345",
|
||||
// "agentId" : "1304",
|
||||
// "eposId" : "30401238",
|
||||
// "account" : "130420912769753",
|
||||
// "rnn" : "110784016238",
|
||||
// "amount" : 895.46,
|
||||
// "payPurpose" : "Mart 2025"
|
||||
// }'
|
||||
|
||||
|
||||
@@ -53,13 +53,13 @@ trait HandlesCardOrderPayments
|
||||
'paymentStatus' => OnlinePaymentRepo::PAID,
|
||||
]);
|
||||
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
|
||||
$paymentHistory->update([
|
||||
'paymentStatus' => OnlinePaymentRepo::FAILED,
|
||||
]);
|
||||
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,8 @@ class OnlinePaymentRepo
|
||||
OnlinePaymentHistory $paymentHistory,
|
||||
Branch $bank_branch,
|
||||
Model $resource,
|
||||
string $returnURL
|
||||
string $returnURL,
|
||||
$response,
|
||||
): array {
|
||||
return [
|
||||
'success' => true,
|
||||
@@ -206,6 +207,7 @@ class OnlinePaymentRepo
|
||||
'bank_branch' => $bank_branch,
|
||||
'resource' => $resource,
|
||||
'paymentHistory' => $paymentHistory,
|
||||
'response' => $response,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -218,7 +220,8 @@ class OnlinePaymentRepo
|
||||
OnlinePaymentHistory $paymentHistory,
|
||||
Branch $bank_branch,
|
||||
Model $resource,
|
||||
string $returnURL
|
||||
string $returnURL,
|
||||
$response,
|
||||
): array {
|
||||
return [
|
||||
'success' => false,
|
||||
@@ -229,7 +232,7 @@ class OnlinePaymentRepo
|
||||
'return_url' => $returnURL,
|
||||
'paymentHistory' => $paymentHistory,
|
||||
'bank_branch' => $bank_branch,
|
||||
'resource' => $resource,
|
||||
'response' => $response,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -42,13 +42,13 @@ trait HandlesSberPeyments
|
||||
]);
|
||||
|
||||
if ($response->failed()) {
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
|
||||
$payment_status = $response['paymentAmountInfo']['depositedAmount'] > 0;
|
||||
|
||||
$cardholderName = $response['cardAuthInfo']['cardholderName'] ?? '-';
|
||||
$cardPan = $response['cardAuthInfo']['Pan'] ?? '-';
|
||||
$cardPan = $response['cardAuthInfo']['pan'] ?? '-';
|
||||
|
||||
if ($payment_status) {
|
||||
$resource->update([
|
||||
@@ -64,12 +64,12 @@ trait HandlesSberPeyments
|
||||
'api_response' => $response->body(),
|
||||
]);
|
||||
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
|
||||
$resource->update([
|
||||
'payer_name' => $response['cardholderName'] ?? '-',
|
||||
'payer_card' => $response['Pan'] ?? '-',
|
||||
'payer_card' => $response['pan'] ?? '-',
|
||||
'paid' => false,
|
||||
]);
|
||||
|
||||
@@ -80,6 +80,6 @@ trait HandlesSberPeyments
|
||||
'api_response' => $response->body(),
|
||||
]);
|
||||
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,13 +43,13 @@ trait HandlesVisaMasterPayments
|
||||
]);
|
||||
|
||||
if ($response->failed()) {
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
|
||||
$payment_status = $response['paymentAmountInfo']['depositedAmount'] > 0;
|
||||
|
||||
$cardholderName = $response['cardAuthInfo']['cardholderName'] ?? '-';
|
||||
$cardPan = $response['cardAuthInfo']['Pan'] ?? '-';
|
||||
$cardPan = $response['cardAuthInfo']['pan'] ?? '-';
|
||||
|
||||
if ($payment_status) {
|
||||
$resource->update([
|
||||
@@ -65,7 +65,7 @@ trait HandlesVisaMasterPayments
|
||||
'api_response' => $response->json(),
|
||||
]);
|
||||
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::successfulPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
|
||||
$resource->update([
|
||||
@@ -81,6 +81,6 @@ trait HandlesVisaMasterPayments
|
||||
'api_response' => $response->json(),
|
||||
]);
|
||||
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL);
|
||||
return static::failedPaymentResponse($paymentHistory, $bank_branch, $resource, $returnURL, $response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,17 +98,18 @@ class NovaMenuRepo
|
||||
MenuItem::resource(Branch::class),
|
||||
])->collapsedByDefault(),
|
||||
|
||||
MenuGroup::make(__('Currencies'), [
|
||||
MenuItem::resource(CurrencyRate::class),
|
||||
MenuItem::resource(NovaVisaMasterSetting::class),
|
||||
])->collapsedByDefault(),
|
||||
|
||||
MenuGroup::make(__('Locale'), [
|
||||
MenuItem::resource(LocaleManagerResource::class),
|
||||
])->collapsedByDefault(),
|
||||
|
||||
])->icon('cog')->collapsedByDefault()->canSee(NovaPermissionRepo::isAdmin()),
|
||||
|
||||
MenuSection::make(__('Currencies'), [
|
||||
MenuItem::resource(CurrencyRate::class),
|
||||
MenuItem::resource(NovaVisaMasterSetting::class),
|
||||
])->icon('currency-dollar')
|
||||
->collapsedByDefault()
|
||||
->canSee(fn () => NovaPermissionRepo::isAdmin() || NovaPermissionRepo::isCurrencyMaintainer()),
|
||||
|
||||
MenuSection::resource(OnlinePaymentHistoryResource::class)
|
||||
->icon('credit-card')
|
||||
->canSee(NovaPermissionRepo::isAdmin()),
|
||||
|
||||
@@ -30,4 +30,12 @@ class NovaPermissionRepo
|
||||
{
|
||||
return fn () => Gate::allows('isAdmin', auth()->user());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user is a currency maintainer
|
||||
*/
|
||||
public static function isCurrencyMaintainer(): Closure
|
||||
{
|
||||
return fn () => Gate::allows('isCurrencyMaintainer', auth()->user());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +161,20 @@ return [
|
||||
'level' => env('LOG_LEVEL', 'error'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'sber_job' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/sber_job.log'),
|
||||
'level' => env('LOG_LEVEL', 'error'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
|
||||
'visa_job' => [
|
||||
'driver' => 'single',
|
||||
'path' => storage_path('logs/visa_job.log'),
|
||||
'level' => env('LOG_LEVEL', 'error'),
|
||||
'replace_placeholders' => true,
|
||||
],
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -15,6 +15,10 @@ return new class extends PulseMigration
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::dropIfExists('pulse_values');
|
||||
Schema::dropIfExists('pulse_entries');
|
||||
Schema::dropIfExists('pulse_aggregates');
|
||||
|
||||
Schema::create('pulse_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('timestamp');
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('contact_us', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title');
|
||||
$table->text('message');
|
||||
|
||||
$table->foreignId('user_id')->nullable()->constrained()->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('contact_us');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('sber_payment_orders', function (Blueprint $table) {
|
||||
$table->string('sender_full_name')->nullable();
|
||||
$table->string('sender_passport_serie')->nullable();
|
||||
$table->string('sender_passport_number')->nullable();
|
||||
$table->string('sender_deposit_account')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sber_payment_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('sender_full_name');
|
||||
$table->dropColumn('sender_passport_serie');
|
||||
$table->dropColumn('sender_passport_number');
|
||||
$table->dropColumn('sender_deposit_account');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('visa_master_payment_orders', function (Blueprint $table) {
|
||||
$table->string('sender_full_name')->nullable();
|
||||
$table->string('sender_passport_serie')->nullable();
|
||||
$table->string('sender_passport_number')->nullable();
|
||||
$table->string('sender_deposit_account')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('visa_master_payment_orders', function (Blueprint $table) {
|
||||
$table->dropColumn('sender_full_name');
|
||||
$table->dropColumn('sender_passport_serie');
|
||||
$table->dropColumn('sender_passport_number');
|
||||
$table->dropColumn('sender_deposit_account');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('sber_payment_order_items', function (Blueprint $table) {
|
||||
$table->boolean('synced_with_system')->nullable()->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sber_payment_order_items', function (Blueprint $table) {
|
||||
$table->dropColumn('synced_with_system');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('visa_master_payment_order_items', function (Blueprint $table) {
|
||||
$table->boolean('synced_with_system')->nullable()->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('visa_master_payment_order_items', function (Blueprint $table) {
|
||||
$table->dropColumn('synced_with_system');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('warnings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('message');
|
||||
$table->text('content');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('warnings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ignore_visa_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('message')->index();
|
||||
$table->unsignedBigInteger('payment_id')->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ignore_visa_payments');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('ignore_sber_payments', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('message')->index();
|
||||
$table->unsignedBigInteger('payment_id')->index();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ignore_sber_payments');
|
||||
}
|
||||
};
|
||||
@@ -351,5 +351,9 @@
|
||||
"Money Balance": "Galyndy",
|
||||
"Start date": "Başlangyç sene",
|
||||
"End date": "Ahyrky sene",
|
||||
"Expiry date": "Möhleti"
|
||||
"Expiry date": "Möhleti",
|
||||
"Successfully created": "Üstünlikli döredildi",
|
||||
"Successfully updated": "Üstünlikli üýtgedildi",
|
||||
"Sync with system": "Ulgam bn birikdirmek",
|
||||
"Synced with system": "Ulgam bn birikdirilen"
|
||||
}
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
**completed**
|
||||
**cancelled**
|
||||
|
||||
Schema::getColumnListing('loan_paid_off_letter_orders')
|
||||
Schema::getColumnListing('card_pins')
|
||||
|
||||
$a = collect(Schema::getColumns('loan_paid_off_letter_orders'))->map(fn ($column) => [
|
||||
$a = collect(Schema::getColumns('card_pins'))->map(fn ($column) => [
|
||||
'name' => $column['name'],
|
||||
'type' => ($column['nullable'] ? 'null|' : '') . dbTypeToPhp($column['type']),
|
||||
])->pluck('type', 'name')
|
||||
|
||||
2
public/docs/stop-ligt-styles.min.css
vendored
2
public/docs/stop-ligt-styles.min.css
vendored
File diff suppressed because one or more lines are too long
2
public/docs/stoplight-web-components.min.js
vendored
2
public/docs/stoplight-web-components.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -49,7 +49,7 @@ async function login(event) {
|
||||
id="username"
|
||||
type="text"
|
||||
name="username"
|
||||
placeholder="+99365999990 {{ __('or') }} ulanyjy_ady"
|
||||
placeholder="65999990 {{ __('or') }} ulanyjy_ady"
|
||||
autofocus=""
|
||||
value="{{ old('username') }}"
|
||||
>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
<div class="mt-8 leading-normal text-xs text-gray-500 space-y-1">
|
||||
<p class="text-center">Powered by <a class="link-default" target="_blank" href="https://webulgam.com">Web Ulgam,</a></p>
|
||||
<p class="text-center">© {{ date('Y') }} TBBANK.GOV.TM.</p>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\AlertController;
|
||||
use App\Http\Controllers\Api\CardBalance\CardBalanceController;
|
||||
use App\Http\Controllers\Api\CardOrder\CardOrderController;
|
||||
use App\Http\Controllers\Api\CardPin\CardPinController;
|
||||
use App\Http\Controllers\Api\CardRequisite\CardRequisiteController;
|
||||
use App\Http\Controllers\Api\CardTransaction\CardTransactionsController;
|
||||
use App\Http\Controllers\Api\ContactUsController;
|
||||
use App\Http\Controllers\Api\FetchLoanHistoryController;
|
||||
use App\Http\Controllers\Api\LoanOrder\Remaining\LoanOrderRemainingOrderController;
|
||||
use App\Http\Controllers\Api\LoanPaidOffLetterOrderController;
|
||||
@@ -16,6 +21,7 @@ use App\Modules\Branch\Controllers\BranchController;
|
||||
use App\Modules\LoanOrder\Controllers\LoanOrderController;
|
||||
use App\Modules\LoanRemainingOrder\Controllers\LoanRemainingOrderController;
|
||||
use App\Modules\Province\Controllers\ProvinceController;
|
||||
use App\Modules\VisaMasterPaymentOrder\Controllers\VisaMasterPaymentOrderController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Laravel\Nova\Http\Middleware\Authenticate;
|
||||
use Laravel\Nova\Http\Middleware\Authorize;
|
||||
@@ -42,28 +48,30 @@ Route::middleware(['nova', Authenticate::class, Authorize::class, OnlySystemUser
|
||||
Route::post('fetch-loan-remaining', [FetchLoanRemainingController::class, 'index']);
|
||||
});
|
||||
|
||||
// Auth...
|
||||
// Auth... [tested fully]
|
||||
Route::post('auth/register', [ApiAuthController::class, 'register']);
|
||||
Route::post('auth/login', [ApiAuthController::class, 'login']);
|
||||
Route::post('auth/verify', [ApiAuthController::class, 'verify']);
|
||||
Route::middleware('auth:sanctum')
|
||||
->post('auth/delete-user', [ApiAuthController::class, 'delete']);
|
||||
|
||||
// Branches...
|
||||
// Branches... [tested]
|
||||
Route::get('branches', [BranchController::class, 'index']);
|
||||
|
||||
// Provinces...
|
||||
// Provinces... [tested]
|
||||
Route::get('provinces', [ProvinceController::class, 'index']);
|
||||
|
||||
// Base enums...
|
||||
// Base enums... [tested]
|
||||
Route::get('base-app-enums', [BaseAppEnumController::class, 'index']);
|
||||
|
||||
Route::middleware(['auth:sanctum', 'not_banned'])->group(function () {
|
||||
// Profile...
|
||||
Route::post('contact-us', [ContactUsController::class, 'store']);
|
||||
|
||||
// Profile... [tested fully]
|
||||
Route::get('profile', [ProfileController::class, 'index']);
|
||||
Route::post('profile', [ProfileController::class, 'store']);
|
||||
|
||||
// Metrics...
|
||||
// Metrics... [tested]
|
||||
Route::get('/metrics', [MetricsController::class, 'index']);
|
||||
|
||||
// Loan order... [tested expect: update]
|
||||
@@ -88,13 +96,61 @@ Route::middleware(['auth:sanctum', 'not_banned'])->group(function () {
|
||||
Route::post('loan-paid-off-letter-orders/{order}', [LoanPaidOffLetterOrderController::class, 'update']);
|
||||
Route::delete('loan-paid-off-letter-orders/{order}', [LoanPaidOffLetterOrderController::class, 'destroy']);
|
||||
|
||||
// Alerts...
|
||||
// Alerts... [tested fully]
|
||||
Route::get('alerts', [AlertController::class, 'index']);
|
||||
Route::get('alerts-all', [AlertController::class, 'all']);
|
||||
|
||||
// Card order...
|
||||
// Card orders... [tested fully]
|
||||
Route::get('card-order', [CardOrderController::class, 'index']);
|
||||
Route::get('card-order/{cardOrder}', [CardOrderController::class, 'show']);
|
||||
Route::post('card-order', [CardOrderController::class, 'store']);
|
||||
Route::post('card-order/{cardOrder}', [CardOrderController::class, 'update']);
|
||||
Route::delete('card-order/{cardOrder}', [CardOrderController::class, 'destroy']);
|
||||
|
||||
// Card transactions... [tested fully]
|
||||
Route::get('card-transactions-last-month', [CardTransactionsController::class, 'lastMonth']);
|
||||
Route::get('card-transactions', [CardTransactionsController::class, 'index']);
|
||||
Route::get('card-transactions/{order}', [CardTransactionsController::class, 'show']);
|
||||
Route::get('card-transactions-download/{order}', [CardTransactionsController::class, 'download']);
|
||||
Route::post('card-transactions', [CardTransactionsController::class, 'store']);
|
||||
Route::post('card-transactions/{order}', [CardTransactionsController::class, 'update']);
|
||||
Route::delete('card-transactions/{order}', [CardTransactionsController::class, 'destroy']);
|
||||
|
||||
// Card requisites... [tested fully]
|
||||
Route::get('card-requisites', [CardRequisiteController::class, 'index']);
|
||||
Route::get('card-requisites/{order}', [CardRequisiteController::class, 'show']);
|
||||
Route::get('card-requisites-download/{order}', [CardRequisiteController::class, 'download']);
|
||||
Route::post('card-requisites', [CardRequisiteController::class, 'store']);
|
||||
Route::post('card-requisites/{order}', [CardRequisiteController::class, 'update']);
|
||||
Route::delete('card-requisites/{order}', [CardRequisiteController::class, 'destroy']);
|
||||
|
||||
// Card balances... [tested fully]
|
||||
Route::post('card-balance-quick-check', [CardBalanceController::class, 'quickCheck']);
|
||||
Route::get('card-balances', [CardBalanceController::class, 'index']);
|
||||
Route::get('card-balances/{order}', [CardBalanceController::class, 'show']);
|
||||
Route::get('card-balances-download/{order}', [CardBalanceController::class, 'download']);
|
||||
Route::post('card-balances', [CardBalanceController::class, 'store']);
|
||||
Route::post('card-balances/{order}', [CardBalanceController::class, 'update']);
|
||||
Route::delete('card-balances/{order}', [CardBalanceController::class, 'destroy']);
|
||||
|
||||
// Card pin-order...
|
||||
Route::get('card-pin-order', [CardPinController::class, 'index']);
|
||||
Route::get('card-pin-order/{order}', [CardPinController::class, 'show']);
|
||||
Route::post('card-pin-order', [CardPinController::class, 'store']);
|
||||
Route::post('card-pin-order/{order}', [CardPinController::class, 'update']);
|
||||
Route::delete('card-pin-order/{order}', [CardPinController::class, 'destroy']);
|
||||
|
||||
// Visa/Master order...
|
||||
Route::get('visa-master-order', [VisaMasterPaymentOrderController::class, 'index']);
|
||||
// Route::get('visa-master-order/{order}', [VisaMasterPaymentOrderController::class, 'show']);
|
||||
// Route::post('visa-master-order', [VisaMasterPaymentOrderController::class, 'store']);
|
||||
// Route::post('visa-master-order/{order}', [VisaMasterPaymentOrderController::class, 'update']);
|
||||
// Route::delete('visa-master-order/{order}', [VisaMasterPaymentOrderController::class, 'destroy']);
|
||||
|
||||
// Sber order...
|
||||
// Route::get('sber-order', [SberOrderController::class, 'index']);
|
||||
// Route::get('sber-order/{order}', [SberOrderController::class, 'show']);
|
||||
// Route::post('sber-order', [SberOrderController::class, 'store']);
|
||||
// Route::post('sber-order/{order}', [SberOrderController::class, 'update']);
|
||||
// Route::delete('sber-order/{order}', [SberOrderController::class, 'destroy']);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\ApiTesterController;
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Controllers\Auth\RegisterController;
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
@@ -32,8 +31,6 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::post('password-change', [PasswordChangeController::class, 'update'])->name('password-change.update');
|
||||
});
|
||||
|
||||
Route::get('tester', [ApiTesterController::class, 'index']);
|
||||
|
||||
Route::get('online-payment-store', [OnlinePaymentController::class, 'store'])
|
||||
->name('online-payment-store');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user