diff --git a/app/Config/Constants.php b/app/Config/Constants.php
index 2d66e0f..4e0a541 100644
--- a/app/Config/Constants.php
+++ b/app/Config/Constants.php
@@ -175,9 +175,9 @@ define('URLS', [
'Order' => '/front/order',
'addCart' => '/front/order/addCart',
'cancelCart' => '/front/order/cancelCart',
- 'Billing' => '/front/billing/insert',
- 'cardPayment' => '/front/billing/payment/card',
- 'depositPayment' => '/front/billing/payment/deposit',
+ 'Billing' => '/front/billing',
+ 'card' => '/front/billing/card',
+ 'deposit' => '/front/billing/deposit',
]);
//SESSION 관련
define('SESSION_NAMES', [
@@ -207,7 +207,11 @@ define('AUTH_ADAPTERS', [
define("MALLS", [
"support" => "support@idcjp.jp",
"master" => "master@idcjp.jp",
- "title" => "Mall Master"
+ "title" => "Mall Master",
+ "banks" => [
+ ["name" => "신한은행", "account" => "계좌번호", "holder" => "예금주"],
+ ["name" => "국민은행", "account" => "계좌번호1", "holder" => "예금주1"],
+ ]
]);
//Upload , Download 관련
diff --git a/app/Config/Routes.php b/app/Config/Routes.php
index 2ce5e5e..d238bea 100644
--- a/app/Config/Routes.php
+++ b/app/Config/Routes.php
@@ -174,14 +174,12 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
$routes->get('cancelCart/(:uuid)', 'CartController::delete/$1');
});
$routes->group('billing', ['namespace' => 'App\Controllers\Front\Billing', 'filter' => 'authFilter:user'], static function ($routes) {
- $routes->get('', 'BillingController::index', ['filter' => 'authFilter:user']);
- $routes->get('download/(:any)/(:num)', 'BillingController::download/$1/$2');
- $routes->group('payment', ['namespace' => 'App\Controllers\Front\Billing\Payment'], static function ($routes) {
- $routes->get('card/(:num)', 'CardController::update_form/$1');
- $routes->post('card/(:num)', 'CardController::update/$1');
- $routes->get('deposit/(:num)', 'DepositController::update_form/$1');
- $routes->post('deposit/(:num)', 'DepositController::update/$1');
- });
+ $routes->get('', 'BillingController::index');
+ $routes->post('', 'BillingController::insert');
+ $routes->get('card', 'CardController::insert_form');
+ $routes->post('card', 'CardController::insert');
+ $routes->get('deposit', 'DepositController::insert_form');
+ $routes->post('deposit', 'DepositController::insert');
});
});
/*
diff --git a/app/Controllers/Front/Billing/BillingController.php b/app/Controllers/Front/Billing/BillingController.php
index 92eb0e0..1f1dc3e 100644
--- a/app/Controllers/Front/Billing/BillingController.php
+++ b/app/Controllers/Front/Billing/BillingController.php
@@ -2,16 +2,22 @@
namespace App\Controllers\Front\Billing;
+use App\Controllers\Front\FrontController;
+use App\Entities\BillingEntity;
+use App\Entities\OrderEntity;
use App\Models\BillingModel;
+use App\Models\OrderBillingModel;
+use App\Models\OrderModel;
+use App\Models\UserModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
-use App\Controllers\Front\FrontController;
-use App\Models\UserModel;
class BillingController extends FrontController
{
private $_userModel = null;
+ private $_orderModel = null;
+ private $_orderBillingModel = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
@@ -25,6 +31,9 @@ class BillingController extends FrontController
//Default 회원정보 Category
$this->_category = DEFAULTS['CATEGORY_BILLING'];
$this->isRole('index');
+
+ //사용자정보
+ $this->_viewDatas['user'] = $this->getUserModel()->getEntity([$this->getUserModel()->getPrimaryKey() => $this->_viewDatas['auth'][AUTH_FIELDS['ID']]]);
}
final protected function getUserModel(): UserModel
@@ -32,32 +41,100 @@ class BillingController extends FrontController
return $this->_userModel = $this->_userModel ?: new UserModel();
}
- final public function getFields(string $action = ""): array
+ final protected function getOrderModel(): OrderModel
+ {
+ return $this->_orderModel = $this->_orderModel ?: new OrderModel();
+ }
+ final protected function getOrderBillingModel(): OrderBillingModel
+ {
+ return $this->_orderBillingModel = $this->_orderBillingModel ?: new OrderBillingModel();
+ }
+
+ public function getFields(string $action = ""): array
{
switch ($action) {
- case 'update':
- return ['order_uid', "title", "upload_file", "status"];
+ case "insert":
+ return ["price"];
break;
case "index":
case "excel":
- return ["order_uid", "title", "upload_file", "status", "updated_at", "created_at"];
+ return ["email", "phone", "title", "price", "status", "updated_at", "created_at"];
break;
case "view":
- return ['order_uid', "title", "upload_file", "status", "updated_at", "created_at", 'response'];
+ return ["email", "phone", "title", "price", "status", "updated_at", "created_at", 'response'];
break;
default:
return [];
break;
}
}
- final public function getFieldFilters(): array
- {
- return ['order_uid', "status"];
- }
- final public function getFieldBatchFilters(): array
+ public function getFieldFilters(): array
{
return ["status"];
}
+ public function getFieldBatchFilters(): array
+ {
+ return ["status"];
+ }
+
+ //Insert관련 (결제처리용)
+ protected function insert_form_process()
+ {
+ parent::insert_form_process();
+ }
+
+ //Insert관련
+ private function linkOrderBilling(BillingEntity $entity, array $order_uids)
+ {
+ foreach ($order_uids as $order_uid) {
+ $this->getOrderBillingModel()->create([
+ "billing_uid" => $entity->getPrimaryKey(),
+ 'order_uid' => $order_uid
+ ]);
+ }
+ }
+ protected function insert_process()
+ {
+ //title지정하기
+ $this->_viewDatas['fieldDatas']['title'] = date("Y년m월") . " 청구서입니다.";
+ //사용자정보
+ $this->_viewDatas['fieldDatas']['email'] = $this->_viewDatas['user']->email;
+ $this->_viewDatas['fieldDatas']['phone'] = $this->_viewDatas['user']->phone;
+ return parent::insert_process();
+ }
+ public function insert()
+ {
+ $msg = "";
+ try {
+ $this->_viewDatas = $this->init(__FUNCTION__);
+ $this->insert_validate();
+ //주문정보 가져오기
+ $order_uids = $this->request->getVar('order_uids') ?: throw new \Exception("주문정보가 지정되지 않았습니다.");
+ //Transaction 시작
+ $this->_model->transStart();
+ //Billing 생성
+ $entity = $this->insert_process();
+ //DB연결용
+ $this->linkOrderBilling($entity, $order_uids);
+ //Transaction Commit
+ $this->_model->transComplete();
+ $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다.";
+ //기존 return_url 무시
+ $this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']);
+ return redirect()->to(URLS['Billing']);
+ } catch (\Exception $e) {
+ //Transaction Rollback
+ $this->_model->transRollback();
+
+ $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage();
+ log_message("error", $e->getMessage());
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
+ return redirect()->back()->withInput();
+ } finally {
+ $this->_session->setFlashdata("return_message", $msg);
+ }
+ }
+
//Index관련
protected function index_setCondition()
@@ -68,13 +145,37 @@ class BillingController extends FrontController
parent::index_setCondition();
}
- //Download관련
- public function download_process($field, $entity)
+ //추가기능
+ //청구서관련
+ final protected function createBilling(OrderEntity $entity, string $subject, string $html, $response = ''): BillingEntity
{
- list($filename, $uploaded_filename) = explode(DEFAULTS['DELIMITER_FILE'], $entity->$field);
- if (!is_file(PATHS['BILLING'] . "/" . $uploaded_filename)) {
- throw new \Exception("첨부파일이 확인되지 않습니다.\n");
- }
- return $this->response->download(PATHS['BILLING'] . "/" . $uploaded_filename, null)->setFileName(date("Ymd") . '_' . $filename);
+ //청구서파일 생성
+ $fileName = sprintf("%s_%s", $entity->getPrimaryKey(), date('Y-m-d_Hm') . '.xlsx');
+ $writer = $this->spreadSheet($html);
+ $writer->save(PATHS['BILLING'] . '/' . $fileName);
+ //메일발송
+ $this->sendBilling($this->_viewDatas['fieldDatas']['email'], $subject, $html);
+ $fieldDatas = [
+ 'order_uid' => $entity->getPrimaryKey(),
+ 'user_uid' => $this->_viewDatas['auth'][AUTH_FIELDS['ID']],
+ 'email' => $this->_viewDatas['fieldDatas']['email'],
+ 'phone' => $this->_viewDatas['fieldDatas']['phone'],
+ 'title' => $subject,
+ 'content' => $html,
+ 'upload_file' => sprintf("%s%s%s", $this->_viewDatas['className'] . '.xlsx', DEFAULTS['DELIMITER_FILE'], $fileName),
+ 'response' => $response,
+ 'status' => DEFAULTS['STATUS']
+ ];
+ return $this->_model->create($fieldDatas);
+ }
+ final protected function sendBilling($email, string $subject, string $html): bool
+ {
+ $mail = \Config\Services::email();
+ $mail->setFrom(MALLS['support'], MALLS['title'], MALLS['master']);
+ $mail->setTo($email);
+ $mail->setCC(MALLS['master']);
+ $mail->setSubject($subject);
+ $mail->setMessage($html);
+ return $mail->send();
}
}
diff --git a/app/Controllers/Front/Billing/Payment/CardController.php b/app/Controllers/Front/Billing/CardController.php
similarity index 97%
rename from app/Controllers/Front/Billing/Payment/CardController.php
rename to app/Controllers/Front/Billing/CardController.php
index faf570e..e91d5d3 100644
--- a/app/Controllers/Front/Billing/Payment/CardController.php
+++ b/app/Controllers/Front/Billing/CardController.php
@@ -1,13 +1,13 @@
_viewDatas['title'] = lang($this->_viewDatas['className'] . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_viewDatas['className'])];
helper($this->_viewDatas['className']);
- $this->_viewDatas['bank'] = [
- "name" => getenv("payment.deposit.bank.name") ?: "은행명",
- "account" => getenv("payment.deposit.bank.account") ?: "계좌번호",
- "holder" => getenv("payment.deposit.bank.holder") ?: "예금주"
- ];
}
public function getFields(string $action = ""): array
{
switch ($action) {
- case 'update':
+ case 'insert':
return ["email", "phone"];
break;
default:
@@ -37,15 +32,21 @@ class DepositController extends PaymentController
protected function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
- case "order_uid":
- $rules[$field] = 'required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]';
- break;
case "email":
$rules[$field] = 'required|valid_email';
break;
case "phone":
$rules[$field] = 'required|regex_match[/^[0-9]{3}-[0-9]{4}-[0-9]{4}/]';
break;
+ case "title":
+ $rules[$field] = 'required|string';
+ break;
+ case "price":
+ $rules[$field] = 'required|numeric';
+ break;
+ case "content":
+ $rules[$field] = 'required|string';
+ break;
default:
$rules = parent::getFieldRule($field, $rules, $action);
break;
@@ -62,6 +63,34 @@ class DepositController extends PaymentController
}
//Insert관련
+ protected function insert_form_process()
+ {
+ parent::insert_form_process();
+ $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => ['price' => $this->_viewDatas['price']]];
+ }
+ public function insert_form()
+ {
+ try {
+ $this->_viewDatas = $this->init(__FUNCTION__);
+ //결제금액 가져오기
+ $this->_viewDatas['price'] = $this->request->getVar('price') ?: throw new \Exception("결제금액이 지정되지 않았습니다.");
+ //주문정보 가져오기
+ $order_uids = $this->request->getVar('order_uids') ?: throw new \Exception("주문정보가 지정되지 않았습니다.");
+ // echo var_export($order_uids, true);
+ // exit;
+ $this->_viewDatas['orders'] = $this->getOrderModel()->whereIn($this->getOrderModel()->getPrimaryKey(), $order_uids)->findAll();
+ if (!count($this->_viewDatas['orders'])) {
+ throw new \Exception("해당하는 주문정보가 없습니다.");
+ }
+ $this->insert_form_process();
+ helper(['form']);
+ $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
+ return view($this->_viewPath . '/insert', ['viewDatas' => $this->_viewDatas]);
+ } catch (\Exception $e) {
+ log_message("error", $e->getMessage());
+ return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
+ }
+ }
//무통장입금결제처리
protected function update_process($entity)
{
diff --git a/app/Controllers/Front/Billing/Payment/PaymentController.php b/app/Controllers/Front/Billing/Payment/PaymentController.php
deleted file mode 100644
index 0ef2a4b..0000000
--- a/app/Controllers/Front/Billing/Payment/PaymentController.php
+++ /dev/null
@@ -1,98 +0,0 @@
-_viewDatas['user'] = $this->getUserModel()->getEntity([$this->getUserModel()->getPrimaryKey() => $this->_viewDatas['auth'][AUTH_FIELDS['ID']]]);
- return $entity;
- }
- final public function update_form($uid)
- {
- try {
- $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
- $this->_viewDatas = $this->init(__FUNCTION__);
- $this->_viewDatas['entity'] = $this->update_form_process($entity);
- helper(['form']);
- $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
- return view($this->_viewPath . '/update', ['viewDatas' => $this->_viewDatas]);
- } catch (\Exception $e) {
- log_message("error", $e->getMessage());
- return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage());
- }
- }
- final public function update($uid)
- {
- $msg = "";
- try {
- $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
- $this->_viewDatas = $this->init(__FUNCTION__);
- $this->update_validate($entity);
- //Transaction 시작
- $this->_model->transStart();
- $entity = $this->update_process($entity);
- //Transaction Commit
- $this->_model->transComplete();
- $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 결제가 완료하였습니다.";
- return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
- } catch (\Exception $e) {
- //Transaction Rollback
- $this->_model->transRollback();
- $msg = "{$this->_viewDatas['title']}에서 결제를 실패하였습니다.\n" . $e->getMessage();
- log_message("error", $e->getMessage());
- $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
- return redirect()->back()->withInput();
- } finally {
- $this->_session->setFlashdata("return_message", $msg);
- }
- }
-
- //청구서관련
- final protected function createBilling(OrderEntity $entity, string $subject, string $html, $response = ''): BillingEntity
- {
- //청구서파일 생성
- $fileName = sprintf("%s_%s", $entity->getPrimaryKey(), date('Y-m-d_Hm') . '.xlsx');
- $writer = $this->spreadSheet($html);
- $writer->save(PATHS['BILLING'] . '/' . $fileName);
- //메일발송
- $this->sendBilling($this->_viewDatas['fieldDatas']['email'], $subject, $html);
- $fieldDatas = [
- 'order_uid' => $entity->getPrimaryKey(),
- 'user_uid' => $this->_viewDatas['auth'][AUTH_FIELDS['ID']],
- 'email' => $this->_viewDatas['fieldDatas']['email'],
- 'phone' => $this->_viewDatas['fieldDatas']['phone'],
- 'title' => $subject,
- 'content' => $html,
- 'upload_file' => sprintf("%s%s%s", $this->_viewDatas['className'] . '.xlsx', DEFAULTS['DELIMITER_FILE'], $fileName),
- 'response' => $response,
- 'status' => DEFAULTS['STATUS']
- ];
- return $this->_model->create($fieldDatas);
- }
- final protected function sendBilling($email, string $subject, string $html): bool
- {
- $mail = \Config\Services::email();
- $mail->setFrom(MALLS['support'], MALLS['title'], MALLS['master']);
- $mail->setTo($email);
- $mail->setCC(MALLS['master']);
- $mail->setSubject($subject);
- $mail->setMessage($html);
- return $mail->send();
- }
-}
diff --git a/app/Database/shoppingmall.sql b/app/Database/shoppingmall.sql
index 954456b..f7588ea 100644
--- a/app/Database/shoppingmall.sql
+++ b/app/Database/shoppingmall.sql
@@ -148,7 +148,7 @@ CREATE TABLE shoppingmall.tw_order (
quantity varchar(255) NOT NULL COMMENT '수량',
type varchar(10) NOT NULL DEFAULT 'rental' COMMENT 'rental: 월임대, onetime:판매,일회성',
paymentday int(2) UNSIGNED NULL COMMENT '결제일',
- status varchar(10) NOT NULL DEFAULT 'unuse' COMMENT 'use: 사용, unuse: 장바구니/사용않함',
+ status varchar(10) NOT NULL DEFAULT 'unuse' COMMENT 'use: 사용, unuse: 사용않함',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
deleted_at timestamp NULL DEFAULT NULL,
@@ -161,10 +161,12 @@ DROP TABLE IF EXISTS shoppingmall.tw_billing;
CREATE TABLE shoppingmall.tw_billing (
uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
user_uid varchar(36) NOT NULL COMMENT '사용자 정보',
+ type varchar(10) NULL DEFAULT 'Card' COMMENT 'Card: 카드결제, Deposit:무통장입금',
+ email varchar(50) NOT NULL,
+ phone varchar(20) NULL COMMENT '연락처',
title varchar(255) NOT NULL COMMENT '청구서제목',
price int(10) UNSIGNED NOT NULL COMMENT '청구금액',
- content text NOT NULL COMMENT '정구서내용',
- upload_file varchar(255) NULL COMMENT '파일명',
+ content text NULL COMMENT '정구서내용',
response text NULL COMMENT '결제처리결과',
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 미납, unuse: 납부완료 등등',
updated_at timestamp NULL DEFAULT NULL,
@@ -172,4 +174,17 @@ CREATE TABLE shoppingmall.tw_billing (
deleted_at timestamp NULL DEFAULT NULL,
PRIMARY KEY (uid),
CONSTRAINT FOREIGN KEY (user_uid) REFERENCES tw_user (uid)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='청구서 정보';
\ No newline at end of file
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='청구서 정보';
+
+
+DROP TABLE IF EXISTS shoppingmall.tw_orderbilling;
+CREATE TABLE shoppingmall.tw_orderbilling (
+ uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ order_uid varchar(36) NOT NULL COMMENT 'Order 정보',
+ billing_uid int(10) UNSIGNED NOT NULL COMMENT '청구서 정보',
+ updated_at timestamp NULL DEFAULT NULL,
+ created_at timestamp NOT NULL DEFAULT current_timestamp(),
+ PRIMARY KEY (uid),
+ CONSTRAINT FOREIGN KEY (order_uid) REFERENCES tw_order (uid),
+ CONSTRAINT FOREIGN KEY (billing_uid) REFERENCES tw_billing (uid)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='주문-청구서 정보';
\ No newline at end of file
diff --git a/app/Entities/BillingEntity.php b/app/Entities/BillingEntity.php
index 8f804ff..7c60e4b 100644
--- a/app/Entities/BillingEntity.php
+++ b/app/Entities/BillingEntity.php
@@ -15,17 +15,5 @@ class BillingEntity extends BaseEntity
return $this->attributes['title'];
}
//추가기능
- //파일관련 Field전용
- final public function getFileDownload($url, $field = "upload_file")
- {
- if (is_null($this->attributes[$field])) {
- return "";
- }
- $files = explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field]);
- return anchor(
- $url,
- ICONS['IMAGE_FILE'] . $files[0],
- ["target" => "_self"]
- );
- }
+
}
diff --git a/app/Entities/OrderBillingEntity.php b/app/Entities/OrderBillingEntity.php
new file mode 100644
index 0000000..1088c1b
--- /dev/null
+++ b/app/Entities/OrderBillingEntity.php
@@ -0,0 +1,19 @@
+attributes['order_uid'];
+ }
+ //추가기능
+
+}
diff --git a/app/Language/ko/Deposit.php b/app/Language/ko/Deposit.php
index 23addbe..c48fd50 100644
--- a/app/Language/ko/Deposit.php
+++ b/app/Language/ko/Deposit.php
@@ -2,7 +2,6 @@
return [
'title' => "무통장입금결제",
'label' => [
- 'order_uid' => '주문번호',
'email' => '이메일',
'phone' => '연락처',
],
diff --git a/app/Models/BillingModel.php b/app/Models/BillingModel.php
index 81639f4..d6af6f3 100644
--- a/app/Models/BillingModel.php
+++ b/app/Models/BillingModel.php
@@ -3,7 +3,6 @@
namespace App\Models;
use App\Entities\BillingEntity;
-use App\Entities\ProductEntity;
class BillingModel extends BaseModel
{
@@ -15,8 +14,8 @@ class BillingModel extends BaseModel
{
parent::__construct('Billing');
$this->allowedFields = [
- ...$this->allowedFields, 'order_uid', "user_uid", "email", "phone",
- "title", "upload_file", "response", "status"
+ ...$this->allowedFields, "user_uid", "type", "email", "phone",
+ "title", "price", "content", "response", "status"
];
$this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
}
@@ -27,9 +26,6 @@ class BillingModel extends BaseModel
public function getFieldRule(string $field, array $rules, string $action = ""): array
{
switch ($field) {
- case 'order_uid':
- $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
- break;
case "email":
$rules[$field] = "required|trim|valid_email";
break;
@@ -39,9 +35,6 @@ class BillingModel extends BaseModel
case $this->getTitleField():
$rules[$field] = "required|trim|string";
break;
- case "upload_file": //uploaded[{$field}] == requried와 같은의미
- $rules[$field] = "if_exist|string";
- break;
case "response":
$rules[$field] = "if_exist|string";
break;
diff --git a/app/Models/OrderBillingModel.php b/app/Models/OrderBillingModel.php
new file mode 100644
index 0000000..6c78848
--- /dev/null
+++ b/app/Models/OrderBillingModel.php
@@ -0,0 +1,50 @@
+allowedFields = [
+ ...$this->allowedFields, "order_uid", "billing_uid"
+ ];
+ $this->validationRules = [...$this->validationRules, ...$this->getFieldRules($this->allowedFields),];
+ }
+ final public function getTitleField(): string
+ {
+ return 'billing_uid';
+ }
+ public function getFieldRule(string $field, array $rules, string $action = ""): array
+ {
+ switch ($field) {
+ case 'order_uid':
+ $rules[$field] = "required|regex_match[/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/]";
+ break;
+ case 'billing_uid':
+ $rules[$field] = "required|numeric";
+ break;
+ default:
+ $rules = parent::getFieldRule($field, $rules, $action);
+ break;
+ }
+ return $rules;
+ }
+ public function getEntity($conditions): OrderBillingEntity
+ {
+ return parent::getEntity($conditions);
+ }
+ public function create(array $formDatas): OrderBillingEntity
+ {
+ return $this->create_process(new OrderBillingEntity(), $formDatas);
+ }
+ public function modify(OrderBillingEntity $entity, array $formDatas): OrderBillingEntity
+ {
+ return $this->modify_process($entity, $formDatas);
+ }
+}
diff --git a/app/Views/front/billing/card/update.php b/app/Views/front/billing/card/insert.php
similarity index 91%
rename from app/Views/front/billing/card/update.php
rename to app/Views/front/billing/card/insert.php
index 762c20e..c348343 100644
--- a/app/Views/front/billing/card/update.php
+++ b/app/Views/front/billing/card/insert.php
@@ -3,7 +3,7 @@
= html_entity_decode($viewDatas['category']->head) ?>
- = form_open_multipart(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+ = form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+
- = form_open(URLS['Billing'], $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
+ = form_open(URLS['Billing'], ['method' => 'post'], $viewDatas['forms']['hiddens']) ?>
+
+ = form_hidden("order_uids[]", $entity->getPrimaryKey()) ?>
+
+ = form_hidden("price", $price) ?>
결제정보
상품수
@@ -59,15 +64,16 @@
총결제금액
- = number_format($total_price - $total_sale) ?>원
+ = number_format($price) ?>원
+
+
+ = form_submit('', '구매하기', array('', "class" => "btn btn-outline btn-primary")); ?>
-
= form_submit('', '결제하기', array("class" => "btn btn-outline btn-primary")); ?>
= form_close(); ?>
+ = $viewDatas['pagination'] ?>
+ = html_entity_decode($viewDatas['category']->tail) ?>
- = $viewDatas['pagination'] ?>
- = html_entity_decode($viewDatas['category']->tail) ?>
-
-= $this->endSection() ?>
\ No newline at end of file
+ = $this->endSection() ?>
\ No newline at end of file