From 009c3ac38102b04e368a46d1622cfcdb094825c4 Mon Sep 17 00:00:00 2001 From: Nurmuhammet Allanov Date: Mon, 22 Apr 2024 20:25:27 +0500 Subject: [PATCH] Card Order --- app/Models/Order/Card/CardOrder.php | 3 +-- app/Repos/Payment/OnlinePaymentRepo.php | 12 +++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/Models/Order/Card/CardOrder.php b/app/Models/Order/Card/CardOrder.php index 7b6996b..3aafd50 100644 --- a/app/Models/Order/Card/CardOrder.php +++ b/app/Models/Order/Card/CardOrder.php @@ -117,8 +117,7 @@ class CardOrder extends Model */ public function priceAmount(): float { - return 1; - // return floatval($this->cardType->price); + return $this->cardType->price ?? 32; } /** diff --git a/app/Repos/Payment/OnlinePaymentRepo.php b/app/Repos/Payment/OnlinePaymentRepo.php index dc6b794..4977a82 100644 --- a/app/Repos/Payment/OnlinePaymentRepo.php +++ b/app/Repos/Payment/OnlinePaymentRepo.php @@ -24,6 +24,16 @@ class OnlinePaymentRepo */ public const PAID = 'paid'; + /** + * Set price + * + * @param int $price + */ + public function getPrice(int|float|string $price): int + { + return intval(number_format($price, 2, "", "")); + } + /** * Pay card order */ @@ -33,7 +43,7 @@ class OnlinePaymentRepo $paymentResponse = Http::get('https://mpi.gov.tm/payment/rest/register.do', [ 'orderNumber' => $orderNumber, - 'amount' => '00'.$resource->priceAmount(), + 'amount' => getPrice($resource->priceAmount()), 'currency' => 934, 'language' => 'ru', 'userName' => $resource->branch->billing_username,