work on payments

This commit is contained in:
2025-10-30 22:33:28 +05:00
parent 68d544b9c3
commit 11f99caf42
5 changed files with 362 additions and 18 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Modules\OnlinePayment\Repositories;
use App\Modules\CardOrder\Models\CardOrder;
use App\Modules\HalkbankOnlinePayment\Repositories\HalkbankOnlinePaymentRepository;
use App\Modules\OnlinePayment\Models\OnlinePayment;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
@@ -24,7 +25,7 @@ class OnlinePaymentRepository
*/
public const PAID = 'paid';
/**
/**
* Status Values
*
* @return array<null|string, string>
@@ -39,14 +40,6 @@ class OnlinePaymentRepository
];
}
/**
* Set price
*/
public function getPrice(int|float|string $price): string
{
return number_format(floatval($price), 2, '', '');
}
/**
* Pay card order
*
@@ -57,6 +50,18 @@ class OnlinePaymentRepository
{
$orderNumber = $this->generateOrderNumber();
$response = HalkbankOnlinePaymentRepository::make()
->setUsername()
->setPassword()
->setAmount()
->setOrderNumber()
->returnUrl()
->description()
->onError()
->onResponseFail()
->onResponseSuccess()
->sendRequest();
// $paymentResponse = Http::get('https://mpi.gov.tm/payment/rest/register.do', [
// 'orderNumber' => $orderNumber,
// 'amount' => $this->getPrice($resource->priceAmount()),