This commit is contained in:
2024-11-25 18:01:18 +05:00
parent 2404feebe6
commit 7259cdcb26
7 changed files with 70 additions and 5 deletions

View File

@@ -5,6 +5,31 @@ namespace App\Models\Payment;
use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model; 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 class OnlinePaymentHistory extends Model
{ {
use HasFactory; use HasFactory;

View File

@@ -82,7 +82,7 @@ class LocaleManagerResource extends Resource
/** /**
* Get the actions available for the resource. * Get the actions available for the resource.
* *
* @return array * @return array<int, \Laravel\Nova\Actions\Action>
*/ */
public function actions(NovaRequest $request): array public function actions(NovaRequest $request): array
{ {

View File

@@ -63,7 +63,10 @@ class OnlinePaymentHistoryPolicy
return false; return false;
} }
public function runAction() /**
* Run the action
*/
public function runAction(): bool
{ {
return true; return true;
} }

View File

@@ -9,6 +9,11 @@ use Illuminate\Database\Eloquent\Model;
class LoanOrderRepo class LoanOrderRepo
{ {
/**
* Satisfiable values
*
* @return array<string|null, string>
*/
public static function satisfiableValues(): array public static function satisfiableValues(): array
{ {
return [ return [

View File

@@ -19,6 +19,8 @@ class LoanTypeRepo
/** /**
* Only guarantor * Only guarantor
*
* @return \Illuminate\Support\Collection<string, mixed>|array<int, string>
*/ */
public static function onlyGuarantor(): Collection|array public static function onlyGuarantor(): Collection|array
{ {

View File

@@ -2,8 +2,10 @@
namespace App\Repos\Payment; namespace App\Repos\Payment;
use App\Models\Branch\Branch;
use App\Models\Payment\OnlinePaymentHistory; use App\Models\Payment\OnlinePaymentHistory;
use App\Repos\Payment\VisaMaster\HandlesVisaMasterPayments; use App\Repos\Payment\VisaMaster\HandlesVisaMasterPayments;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Laravel\Nova\Makeable; use Laravel\Nova\Makeable;
@@ -156,7 +158,13 @@ class OnlinePaymentRepo
return 'orders.cards.online-payment.status'; 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') Log::channel('halkbank_payment_check_error')
->error('Related resource not found', [ ->error('Related resource not found', [
@@ -169,7 +177,12 @@ class OnlinePaymentRepo
]); ]);
} }
public static function successfulPaymentResponse($paymentHistory, $bank_branch, $resource) /**
* Successfully payment response
*
* @return array<string, bool|string>
*/
public static function successfulPaymentResponse($paymentHistory, $bank_branch, $resource): array
{ {
return [ return [
'success' => true, '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) public static function failedPaymentResponse($paymentHistory, $bank_branch, $resource)
{ {
return [ return [
@@ -193,6 +213,9 @@ class OnlinePaymentRepo
]; ];
} }
/**
* Resource not found
*/
protected static function resourceNotFound(): array protected static function resourceNotFound(): array
{ {
return [ return [

View File

@@ -10,7 +10,14 @@ use Illuminate\Support\Facades\Http;
trait HandlesVisaMasterPayments trait HandlesVisaMasterPayments
{ {
public static function checkPaymentVisaMaster(Request $request) /**
* Check payment payment visa master
*
* @param Request $request
*
* @return array<string, bool|string>
*/
public static function checkPaymentVisaMaster(Request $request): array
{ {
// Find order from history // Find order from history
$paymentHistory = OnlinePaymentHistory::where('orderId', $request->orderId)->first(); $paymentHistory = OnlinePaymentHistory::where('orderId', $request->orderId)->first();