payment providers and some stan

This commit is contained in:
2025-10-31 01:13:04 +05:00
parent 11f99caf42
commit 834527647d
11 changed files with 232 additions and 121 deletions

View File

@@ -111,4 +111,12 @@ class CardOrder extends Model implements BelongsToBranch, HasStatus
static::creating(LoanOrderRepository::creating());
static::created(LoanOrderRepository::created());
}
/**
* Price for card
*/
public function priceAmount(): int|float|string
{
return $this->cardState->price ?? 32;
}
}

View File

@@ -2,4 +2,32 @@
namespace App\Modules\CardOrder\Repositories;
class CardOrderRepository {}
use App\Modules\CardOrder\Models\CardOrder;
use App\Modules\HalkbankOnlinePayment\Repositories\HalkbankOnlinePaymentRepository;
use App\Modules\Makeable;
use App\Modules\OnlinePayment\Repositories\OnlinePaymentRepository;
class CardOrderRepository
{
use Makeable;
/**
* Create online payment order
*/
public function createOnlinePaymentOrder(CardOrder $record): OnlinePaymentRepository
{
/** @var \App\Modules\Branch\Models\Branch */
$branch = $record->branch;
return OnlinePaymentRepository::make()
->paymentProvider(
HalkbankOnlinePaymentRepository::make()
->setUsername($branch->billingUsername())
->setPassword($branch->billingPassword())
->setAmount($record->priceAmount())
->setReturnUrl(route('halkbank-online-payment.store'))
->setDescription('Kart tölegi')
)
->sendRequest();
}
}