shoppingmallv2/app/Controllers/Ecommerce/Payment/PaymentController.php
2023-08-11 18:37:22 +09:00

45 lines
1.6 KiB
PHP

<?php
namespace App\Controllers\Ecommerce\Payment;
use App\Controllers\Ecommerce\EcommerceController;
use App\Entities\PaymentEntity;
use App\Models\CategoryModel;
use App\Models\PaymentModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
abstract class PaymentController extends EcommerceController
{
private $_paymentModel = null;
private $_categoryModel = null;
protected $_category = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_viewPath .= 'payment/';
//Default 회원정보 Category
$this->_category = DEFAULTS['PAYMENT_CATEGORY'];
$this->_category ?: throw new \Exception("분류를 지정하지 않으셨습니다.");
$this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category]);
$this->_viewDatas['parent_category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_viewDatas['category']->getHierarchy_ParentUID()]);
}
final protected function getPaymentModel()
{
return $this->_paymentModel = $this->_paymentModel ?: new PaymentModel();
}
final protected function getCategoryModel()
{
return $this->_categoryModel = $this->_categoryModel ?: new CategoryModel();
}
protected function insert_process()
{
//Order 테이블에 결제완료 처리
$this->getOrderModel()->paymentCompleted();
}
}