From 7259cdcb26a49ca6217bddf05729fb5f35a9c46b Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Mon, 25 Nov 2024 18:01:18 +0500 Subject: [PATCH] wip --- app/Models/Payment/OnlinePaymentHistory.php | 25 +++++++++++++++++ .../System/Locale/LocaleManagerResource.php | 2 +- app/Policies/OnlinePaymentHistoryPolicy.php | 5 +++- app/Repos/Order/Loan/LoanOrderRepo.php | 5 ++++ app/Repos/Order/Loan/LoanTypeRepo.php | 2 ++ app/Repos/Payment/OnlinePaymentRepo.php | 27 +++++++++++++++++-- .../VisaMaster/HandlesVisaMasterPayments.php | 9 ++++++- 7 files changed, 70 insertions(+), 5 deletions(-) diff --git a/app/Models/Payment/OnlinePaymentHistory.php b/app/Models/Payment/OnlinePaymentHistory.php index 2405189..95acbf6 100644 --- a/app/Models/Payment/OnlinePaymentHistory.php +++ b/app/Models/Payment/OnlinePaymentHistory.php @@ -5,6 +5,31 @@ namespace App\Models\Payment; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +/** + * @property int $id + * @property string $refunded_amount + * @property string $booking_number + * @property string $amount + * @property string $depositedAmount + * @property string $orderNumber + * @property string $description + * @property string $orderId + * @property string $cardholderName + * @property string $pan + * @property string $approvalCode + * @property string $expiration + * @property string $formUrl + * @property string $successUrl + * @property string $errorUrl + * @property string $api_client + * @property string $paymentStatus + * @property string $callbackStatus + * @property string $username + * @property int $online_paymantable_id + * @property string $online_paymantable_type + * @property \Illuminate\Support\Carbon $created_at + * @property \Illuminate\Support\Carbon $updated_at + */ class OnlinePaymentHistory extends Model { use HasFactory; diff --git a/app/Nova/Resources/System/Locale/LocaleManagerResource.php b/app/Nova/Resources/System/Locale/LocaleManagerResource.php index 5b46316..86f9c6d 100644 --- a/app/Nova/Resources/System/Locale/LocaleManagerResource.php +++ b/app/Nova/Resources/System/Locale/LocaleManagerResource.php @@ -82,7 +82,7 @@ class LocaleManagerResource extends Resource /** * Get the actions available for the resource. * - * @return array + * @return array */ public function actions(NovaRequest $request): array { diff --git a/app/Policies/OnlinePaymentHistoryPolicy.php b/app/Policies/OnlinePaymentHistoryPolicy.php index 383bff9..0ae481d 100644 --- a/app/Policies/OnlinePaymentHistoryPolicy.php +++ b/app/Policies/OnlinePaymentHistoryPolicy.php @@ -63,7 +63,10 @@ class OnlinePaymentHistoryPolicy return false; } - public function runAction() + /** + * Run the action + */ + public function runAction(): bool { return true; } diff --git a/app/Repos/Order/Loan/LoanOrderRepo.php b/app/Repos/Order/Loan/LoanOrderRepo.php index 8f3b4d8..a07050a 100644 --- a/app/Repos/Order/Loan/LoanOrderRepo.php +++ b/app/Repos/Order/Loan/LoanOrderRepo.php @@ -9,6 +9,11 @@ use Illuminate\Database\Eloquent\Model; class LoanOrderRepo { + /** + * Satisfiable values + * + * @return array + */ public static function satisfiableValues(): array { return [ diff --git a/app/Repos/Order/Loan/LoanTypeRepo.php b/app/Repos/Order/Loan/LoanTypeRepo.php index 06af25f..340e4d3 100644 --- a/app/Repos/Order/Loan/LoanTypeRepo.php +++ b/app/Repos/Order/Loan/LoanTypeRepo.php @@ -19,6 +19,8 @@ class LoanTypeRepo /** * Only guarantor + * + * @return \Illuminate\Support\Collection|array */ public static function onlyGuarantor(): Collection|array { diff --git a/app/Repos/Payment/OnlinePaymentRepo.php b/app/Repos/Payment/OnlinePaymentRepo.php index cda568b..72580b0 100644 --- a/app/Repos/Payment/OnlinePaymentRepo.php +++ b/app/Repos/Payment/OnlinePaymentRepo.php @@ -2,8 +2,10 @@ namespace App\Repos\Payment; +use App\Models\Branch\Branch; use App\Models\Payment\OnlinePaymentHistory; use App\Repos\Payment\VisaMaster\HandlesVisaMasterPayments; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Log; use Laravel\Nova\Makeable; @@ -156,7 +158,13 @@ class OnlinePaymentRepo return 'orders.cards.online-payment.status'; } - protected static function logResourceNotFound($request, $paymentHistory): void + /** + * Log resource not found + * + * @param \Illuminate\Http\Request $request + * @param \App\Models\Payment\OnlinePaymentHistory $paymentHistory + */ + protected static function logResourceNotFound(Request $request, OnlinePaymentHistory $paymentHistory): void { Log::channel('halkbank_payment_check_error') ->error('Related resource not found', [ @@ -169,7 +177,12 @@ class OnlinePaymentRepo ]); } - public static function successfulPaymentResponse($paymentHistory, $bank_branch, $resource) + /** + * Successfully payment response + * + * @return array + */ + public static function successfulPaymentResponse($paymentHistory, $bank_branch, $resource): array { return [ 'success' => true, @@ -181,6 +194,13 @@ class OnlinePaymentRepo ]; } + /** + * Failed payment response + * + * @param $paymentHistory + * @param $bank_branch + * @param $resource + */ public static function failedPaymentResponse($paymentHistory, $bank_branch, $resource) { return [ @@ -193,6 +213,9 @@ class OnlinePaymentRepo ]; } + /** + * Resource not found + */ protected static function resourceNotFound(): array { return [ diff --git a/app/Repos/Payment/VisaMaster/HandlesVisaMasterPayments.php b/app/Repos/Payment/VisaMaster/HandlesVisaMasterPayments.php index aeb486c..78d33c1 100644 --- a/app/Repos/Payment/VisaMaster/HandlesVisaMasterPayments.php +++ b/app/Repos/Payment/VisaMaster/HandlesVisaMasterPayments.php @@ -10,7 +10,14 @@ use Illuminate\Support\Facades\Http; trait HandlesVisaMasterPayments { - public static function checkPaymentVisaMaster(Request $request) + /** + * Check payment payment visa master + * + * @param Request $request + * + * @return array + */ + public static function checkPaymentVisaMaster(Request $request): array { // Find order from history $paymentHistory = OnlinePaymentHistory::where('orderId', $request->orderId)->first();