dbmsv4 init...3

This commit is contained in:
최준흠 2025-12-10 17:45:41 +09:00
parent d004bbb1e5
commit 071b779f6c
14 changed files with 326 additions and 157 deletions

View File

@ -72,8 +72,14 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
});
$routes->group('payment', function ($routes) {
$routes->get('/', 'PaymentController::index');
$routes->get('create', 'PaymentController::create_form');
$routes->post('create', 'PaymentController::create');
$routes->get('onetime', 'PaymentController::onetime_form');
$routes->post('onetime', 'PaymentController::create');
$routes->get('prepayment', 'PaymentController::prepayment_form');
$routes->post('prepayment', 'PaymentController::create');
$routes->get('coupon', 'PaymentController::coupon_form');
$routes->post('coupon', 'PaymentController::create');
$routes->get('point', 'PaymentController::point_form');
$routes->post('point', 'PaymentController::create');
$routes->get('modify/(:num)', 'PaymentController::modify_form/$1');
$routes->post('modify/(:num)', 'PaymentController::modify/$1');
$routes->get('view/(:num)', 'PaymentController::view/$1');

View File

@ -24,37 +24,95 @@ class PaymentController extends AdminController
//Action작업관련
//기본 함수 작업
//Custom 추가 함수
//일회성 추가용
public function create_form_process(array $formDatas = []): array
final public function onetime_form(): string|RedirectResponse
{
$formDatas = parent::create_form_process($formDatas);
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
$formDatas['billing_at'] = date('Y-m-d');
$formDatas['pay'] = PAYMENT['PAY']['ACCOUNT'];
$formDatas['status'] = STATUS['UNPAID'];
return $formDatas;
try {
$action = __FUNCTION__;
$formDatas = [];
$formDatas['serviceinfo_uid'] = $this->request->getVar('serviceinfo_uid');
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
$formDatas['billing_at'] = date('Y-m-d');
$formDatas['pay'] = PAYMENT['PAY']['ACCOUNT'];
$formDatas['status'] = STATUS['UNPAID'];
$this->action_init_process($action, $formDatas);
$this->addViewDatas('formDatas', $formDatas);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
}
}
final public function prepayment_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$formDatas = [];
$formDatas['serviceinfo_uid'] = $this->request->getVar('serviceinfo_uid');
$formDatas['billing'] = PAYMENT['BILLING']['PREPAYMENT'];
$formDatas['billing_at'] = date('Y-m-d');
$formDatas['pay'] = PAYMENT['PAY']['ACCOUNT'];
$formDatas['status'] = STATUS['PAID'];
$this->action_init_process($action, $formDatas);
$this->addViewDatas('formDatas', $formDatas);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
}
}
final public function coupon_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$formDatas = [];
$formDatas['serviceinfo_uid'] = $this->request->getVar('serviceinfo_uid');
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
$formDatas['billing_at'] = date('Y-m-d');
$formDatas['pay'] = PAYMENT['PAY']['COUPON'];
$formDatas['status'] = STATUS['PAID'];
$this->action_init_process($action, $formDatas);
$this->addViewDatas('formDatas', $formDatas);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
}
}
final public function point_form(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$formDatas = [];
$formDatas['serviceinfo_uid'] = $this->request->getVar('serviceinfo_uid');
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
$formDatas['billing_at'] = date('Y-m-d');
$formDatas['pay'] = PAYMENT['PAY']['POINT'];
$formDatas['status'] = STATUS['PAID'];
$this->action_init_process($action, $formDatas);
$this->addViewDatas('formDatas', $formDatas);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate'));
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 생성폼 오류:" . $e->getMessage());
}
}
//단일 지불 완료처리
final public function paid($uid): string|RedirectResponse
{
try {
$entity = $this->service->modify($uid, $this->service->createDTO(['status' => STATUS['PAID']]));
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 결체처리가 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제 오류:" . $e->getMessage());
}
}
//청구서 발행관련
private function invoice_pre_process(): array
{
$postDatas = $this->request->getPost();
$uids = $postDatas['batchjob_uids'] ?? [];
if (empty($uids)) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 청구서에 적용될 리스트를 선택하셔야합니다");
}
return $uids;
}
private function invoice_result_process(string $action): string|RedirectResponse
{
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'payment');
}
public function invoice(): string|RedirectResponse
final public function invoice(): string|RedirectResponse
{
try {
$action = __FUNCTION__;
$this->action_init_process($action);
//변경할 UIDS
$uids = $this->invoice_pre_process();
$uids = $this->request->getPost('batchjob_uids') ?? [];
if (empty($uids)) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 청구서에 적용될 리스트를 선택하셔야합니다");
}
$rows = [];
$clientEntities = [];
$serviceEntities = [];
@ -92,18 +150,9 @@ class PaymentController extends AdminController
}
// dd($rows);
$this->addViewDatas('rows', $rows);
return $this->invoice_result_process($action);
return $this->action_render_process($action, $this->getViewDatas(), $this->request->getVar('ActionTemplate') ?? 'payment');
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 청구서발행 오류:" . $e->getMessage());
}
}
public function paid($uid): string|RedirectResponse
{
try {
$entity = $this->service->paid($uid);
return $this->action_redirect_process('info', "{$this->getTitle()}에서 {$entity->getTitle()} 결체처리가 완료되었습니다.");
} catch (\Throwable $e) {
return $this->action_redirect_process('error', static::class . '->' . __FUNCTION__ . "에서 {$this->getTitle()} 결제 오류:" . $e->getMessage());
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -47,6 +47,7 @@ class ClientHelper extends CustomerHelper
break;
case "email":
case "phone":
//역활이 보안관리자가 아니면 정보숨김
$value = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getFieldView($field, $value, $viewDatas, $extras) : "***********";
break;
case 'account_balance':
@ -54,7 +55,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/wallet/account?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/account?clientinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",
@ -67,7 +68,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/wallet/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/coupon?clientinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",
@ -80,7 +81,7 @@ class ClientHelper extends CustomerHelper
number_format(intval($value)) . "",
'index',
[
"data-src" => "/admin/customer/wallet/point?clientinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup",
"data-src" => "/admin/customer/wallet/point?clientinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm text-primary",
@ -97,13 +98,14 @@ class ClientHelper extends CustomerHelper
public function getListButton(string $action, string $label, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'create':
case 'delete':
case 'batchjob':
case 'batchjob_delete':
//역활이 보안관리자가 아니면 사용불가
$action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : "";
break;
case 'modify':
//역활이 보안관리자가 아니면 수정불가
$action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : $label;
break;
case 'history':
@ -162,7 +164,7 @@ class ClientHelper extends CustomerHelper
$action = "{$label} 0원";
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
$action = form_label(
sprintf("총 %s: %s건/%s원", $label, $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])),
sprintf("%s건/%s원", $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])),
'payment_unpaid',
[
"data-src" => "/admin/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&status=unpaid&ActionTemplate=popup",

View File

@ -44,15 +44,13 @@ class ServiceHelper extends CustomerHelper
$value = number_format($value) . "";
break;
case 'billing_at':
if (array_key_exists('unPaids', $viewDatas)) {
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
$value .= sprintf(
"<div><a href=\"/admin/payment?serviceinfo_uid=%s\"><span style=\"color:red;\">%s개,총 %s원</span></a></div>",
$viewDatas['entity']->getPK(),
$viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'],
number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])
);
}
if (array_key_exists('unPaids', $viewDatas) && array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
$value .= sprintf(
"<div><a href=\"/admin/payment?serviceinfo_uid=%s\"><span style=\"color:red;\">%s개,총 %s원</span></a></div>",
$viewDatas['entity']->getPK(),
$viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'],
number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])
);
}
break;
default:
@ -102,18 +100,20 @@ class ServiceHelper extends CustomerHelper
]
);
break;
case 'onetime':
$action = form_label(
$label ? $label : ICONS['ONETIME'],
$action,
[
"data-src" => "/admin/payment/create?serviceinfo_uid={$viewDatas['entity']->getPK()}",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm",
...$extras
]
);
case 'unpaid':
$action = "{$label} 0원";
if (array_key_exists($viewDatas['entity']->getPK(), $viewDatas['unPaids'])) {
$action = form_label(
sprintf("%s건/%s원", $viewDatas['unPaids'][$viewDatas['entity']->getPK()]['cnt'], number_format($viewDatas['unPaids'][$viewDatas['entity']->getPK()]['amount'])),
'payment_unpaid',
[
"data-src" => "/admin/payment?clientinfo_uid={$viewDatas['entity']->getPK()}&status=unpaid&ActionTemplate=popup",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "text-primary form-label-sm",
]
);
}
break;
case 'history':
$action = form_label(
@ -128,6 +128,22 @@ class ServiceHelper extends CustomerHelper
]
);
break;
case 'onetime':
case 'prepayment':
case 'coupon':
case 'point':
$action = form_label(
$label ? $label : ICONS['ONETIME'],
$action,
[
"data-src" => "/admin/payment/{$action}?serviceinfo_uid={$viewDatas['entity']->getPK()}&ActionTemplate=popup/payment",
"data-bs-toggle" => "modal",
"data-bs-target" => "#modal_action_form",
"class" => "btn btn-sm form-label-sm",
...$extras
]
);
break;
default:
$action = parent::getListButton($action, $label, $viewDatas, $extras);
break;

View File

@ -44,6 +44,7 @@ class PaymentHelper extends CommonHelper
{
switch ($action) {
case 'modify':
//역활이 보안관리자가 아니면 수정불가
if ($this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']])) {
$action = parent::getListButton($action, $label, $viewDatas, $extras);
} else {
@ -60,6 +61,7 @@ class PaymentHelper extends CommonHelper
}
break;
case 'delete':
//역활이 보안관리자가 아니면 삭제불가
$action = $this->getAuthContext()->isAccessRole([ROLE['USER']['SECURITY']]) ? parent::getListButton($action, $label, $viewDatas, $extras) : "";
break;
case 'invoice':

View File

@ -131,11 +131,14 @@ class ServerPartService extends EquipmentService
}
//해당 파트별 설정 수정
$this->getPartService($entity->getType())->attachToServerPart($entity);
if ($entity->getServiceInfoUID() !== null) { //서비스가 정의 되어 있으면
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) { //Billing형식이 Month이면 서비스 금액설정 호출
//서비스가 정의 되어 있으면
if ($entity->getServiceInfoUID() !== null) {
//Billing형식이 Month이면 서비스 금액설정 호출
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
service('customer_serviceservice')->updateAmount($entity->getServiceInfoUID());
}
if ($entity->getBilling() == PAYMENT['BILLING']['ONETIME']) { //Billing형식이 Onetime이면 일회성결제 추가
//Billing형식이 Onetime이면 일회성결제 추가
if ($entity->getBilling() == PAYMENT['BILLING']['ONETIME']) {
service('paymentservice')->createByServerPart($entity);
}
}
@ -152,14 +155,16 @@ class ServerPartService extends EquipmentService
$formDatas['title'] = $partEntity->getTitle();
//서버파트 수정
$entity = parent::modify_process($entity, $formDatas);
//서비스가 정의 되어 있으면
if ($entity->getServiceInfoUID() !== null) {
//서비스가 정의 되어 있으면 서비스 비용 수
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) { //Billing형식이 Month이면 서비스 금액설정 호출
//월비용 서버파트 인경우 서비스 금액 재설
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
service('customer_serviceservice')->updateAmount($entity->getServiceInfoUID());
}
if ($entity->getBilling() == PAYMENT['BILLING']['ONETIME']) { //Billing형식이 Onetime이면 일회성결제 추가
service('paymentservice')->modifyByServerPart($entity);
}
//Billing형식이 Onetime이면 일회성결제 수정 (필요없는듯 하여 주석처리)
// if ($entity->getBilling() == PAYMENT['BILLING']['ONETIME']) {
// service('paymentservice')->modifyByServerPart($entity);
// }
}
return $entity;
}
@ -167,10 +172,16 @@ class ServerPartService extends EquipmentService
{
$this->getPartService($entity->getType())->detachFromServerPart($entity);
$entity = parent::delete_process($entity);
if ($entity->getServiceInfoUID() !== null) { //서비스가 정의 되어 있으면
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) { //Billing형식이 Month이면 서비스 금액설정 호출
//서비스가 정의 되어 있으면
if ($entity->getServiceInfoUID() !== null) {
//월비용 서버파트 인경우 서비스 금액 재설정
if ($entity->getBilling() == PAYMENT['BILLING']['MONTH']) {
service('customer_serviceservice')->updateAmount($entity->getServiceInfoUID());
}
//Billing형식이 Onetime이면 일회성결제 수정 (필요없는듯 하여 주석처리)
// if ($entity->getBilling() == PAYMENT['BILLING']['ONETIME']) {
// service('paymentservice')->modifyByServerPart($entity);
// }
}
return $entity;
}

View File

@ -12,7 +12,7 @@ use App\Forms\PaymentForm;
use App\Helpers\PaymentHelper;
use App\Models\PaymentModel;
use App\Services\Customer\Wallet\WalletService;
use CodeIgniter\Database\Exceptions\DatabaseException;
use DateTime;
use RuntimeException;
@ -25,6 +25,26 @@ class PaymentService extends CommonService
parent::__construct($model);
$this->addClassPaths('Payment');
}
//pay방식에따른 WalletService
private function getWalletService(string $pay): WalletService
{
$walletService = null;
switch ($pay) {
case PAYMENT['PAY']['ACCOUNT']:
$walletService = service('customer_wallet_accountservice');
break;
case PAYMENT['PAY']['COUPON']:
$walletService = service('customer_wallet_couponservice');
break;
case PAYMENT['PAY']['POINT']:
$walletService = service('customer_wallet_pointservice');
break;
default:
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$pay}는 지정되지 않은 지불방식입니다.");
// break;
}
return $walletService;
}
protected function getDTOClass(): string
{
return PaymentDTO::class;
@ -80,7 +100,7 @@ class PaymentService extends CommonService
$filters = ['user_uid', 'clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay'];
$indexFilter = ['clientinfo_uid', 'serviceinfo_uid', 'status', 'billing', 'pay'];
$batchjobFilters = ['status'];
$actionButtons = ['view' => ICONS['SEARCH'], 'paid' => '결제'];
$actionButtons = ['view' => ICONS['SEARCH'], 'paid' => '결제', 'delete' => ICONS['DELETE']];
$batchjobButtons = ['batchjob' => '일괄결제', 'invoice' => '청구서발행'];
switch ($action) {
case 'create':
@ -176,8 +196,8 @@ class PaymentService extends CommonService
$this->model->orLike($this->model->getTable() . '.email', $word, 'both');
parent::setSearchWord($word);
}
//추가기능
//일회성 입력용
//추가기능
//일회성,선결제,쿠폰,포인트 입력 관련
protected function create_process(array $formDatas): PaymentEntity
{
if (!array_key_exists('serviceinfo_uid', $formDatas)) {
@ -189,8 +209,12 @@ class PaymentService extends CommonService
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
//지불이 완료된경우 지불처리
if ($entity->getStatus() === STATUS['PAID']) {
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
}
//선결제인경우 서비스정보에 결제일 변경용
if ($formDatas['billing'] === PAYMENT['BILLING']['PREPAYMENT'] && array_key_exists('billing_at', $formDatas)) {
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUID(), $entity->getBillingAt());
}
return $entity;
@ -202,34 +226,17 @@ class PaymentService extends CommonService
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:Return Type은 PaymentEntity만 가능");
}
//지불이 완료된경우 지불처리
if ($entity->getStatus() === STATUS['PAID']) {
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
}
//선결제인경우 서비스정보에 결제일 변경용
if ($formDatas['billing'] === PAYMENT['BILLING']['PREPAYMENT'] && array_key_exists('billing_at', $formDatas)) {
if ($entity->getBilling() === PAYMENT['BILLING']['PREPAYMENT']) {
service('customer_serviceservice')->updateBillingAt($entity->getServiceInfoUID(), $entity->getBillingAt());
}
return $entity;
}
//지불 관련
//pay방식에따른 WalletService
private function getWalletService(string $pay): WalletService
{
$walletService = null;
switch ($pay) {
case PAYMENT['PAY']['ACCOUNT']:
$walletService = service('customer_wallet_accountservice');
break;
case PAYMENT['PAY']['COUPON']:
$walletService = service('customer_wallet_couponservice');
break;
case PAYMENT['PAY']['POINT']:
$walletService = service('customer_wallet_pointservice');
break;
default:
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: {$pay}는 지정되지 않은 지불방식입니다.");
// break;
}
return $walletService;
}
//일괄 지불용
protected function batchjob_process($entity, array $formDatas): object
{
@ -239,36 +246,6 @@ class PaymentService extends CommonService
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
return $entity;
}
//단일 지불용
public function paid($uid): PaymentEntity
{
$db = \Config\Database::connect();
try {
//트랜잭션 도중 DB 오류가 발생하면 DatabaseException을 던지도록 설정
$db->transException(true)->transStart();
$entity = $this->getEntity($uid);
if (!$entity instanceof PaymentEntity) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생:[{$uid}]에 대한 결제정보를 찾을 수 없습니다.");
}
//결제 완료 처리 후 추가정보 처리
$entity = parent::modify_process($entity, ['status' => STATUS['PAID']]);
//지불방식에 따른 고객 예치금,쿠폰,포인트 처리
$this->getWalletService($entity->getPay())->withdrawalByPayment($entity);
$db->transComplete();
return $entity;
} catch (DatabaseException $e) {
// DatabaseException을 포착하면 자동으로 롤백 처리됨
throw new RuntimeException(sprintf(
"\n----[%s]에서 트랜잭션 실패: DB 오류----\n%s\n%s\n------------------------------\n",
__METHOD__,
$this->model->getLastQuery(),
$e->getMessage()
), $e->getCode(), $e);
} catch (\Throwable $e) {
$db->transRollback(); // 예외 발생 시 수동으로 롤백
throw new RuntimeException($e->getMessage(), 0, $e);
}
}
//청구서 관련
public function getInvoices(ClientEntity $clientEntity, ServiceEntity $serviceEntity, PaymentEntity $entity, array $rows): array
@ -340,9 +317,6 @@ class PaymentService extends CommonService
$entity = $this->createByService($serviceEntity);
} else {
$formDatas = $this->getFormDatasByService($serviceEntity);
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
$entity = parent::modify_process($entity, $formDatas);
}
return $entity;
@ -365,6 +339,9 @@ class PaymentService extends CommonService
}
public function createByServerPart(ServerPartEntity $serverPartEntity): PaymentEntity
{
if ($serverPartEntity->getServiceInfoUID() === null) {
throw new RuntimeException(static::class . '->' . __FUNCTION__ . "에서 오류발생: 서비스정보가 정의되지 않아 일회성 상품을 설정하실수 없습니다.");
}
$formDatas = $this->getFormDatasByServerPart($serverPartEntity);
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
@ -387,9 +364,6 @@ class PaymentService extends CommonService
$entity = $this->createByServerPart($serverPartEntity);
} else {
$formDatas = $this->getFormDatasByServerPart($serverPartEntity);
$fields = array_keys($formDatas);
$this->getFormService()->setFormFields($fields);
$this->getFormService()->setFormRules('modify', $fields);
$entity = parent::modify_process($entity, $formDatas);
}
return $entity;

View File

@ -0,0 +1,25 @@
<?= $this->extend($viewDatas['layout']['layout']) ?>
<?= $this->section('content') ?>
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered">
<tr>
<th class="bg-light" colspan="2"><?= $viewDatas['title'] ?></th>
</tr>
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
<tr>
<th nowrap class="text-end bg-light" width="20%"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,25 @@
<?= $this->extend($viewDatas['layout']['layout']) ?>
<?= $this->section('content') ?>
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered">
<tr>
<th class="bg-light" colspan="2"><?= $viewDatas['title'] ?></th>
</tr>
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
<tr>
<th nowrap class="text-end bg-light" width="20%"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,25 @@
<?= $this->extend($viewDatas['layout']['layout']) ?>
<?= $this->section('content') ?>
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered">
<tr>
<th class="bg-light" colspan="2"><?= $viewDatas['title'] ?></th>
</tr>
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
<tr>
<th nowrap class="text-end bg-light" width="20%"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -0,0 +1,25 @@
<?= $this->extend($viewDatas['layout']['layout']) ?>
<?= $this->section('content') ?>
<?= session('message') ? $viewDatas['helper']->alertTrait(session('message')) : ""; ?>
<div id="container" class="content">
<div class="form_top"><?= $this->include("{$viewDatas['layout']['template']}/form_content_top"); ?></div>
<?= form_open(current_url(), $viewDatas['forms']['attributes'], $viewDatas['forms']['hiddens']) ?>
<table class="table table-bordered">
<tr>
<th class="bg-light" colspan="2"><?= $viewDatas['title'] ?></th>
</tr>
<?php foreach ($viewDatas['formFields'] as $field => $label): ?>
<tr>
<th nowrap class="text-end bg-light" width="20%"><?= $viewDatas['helper']->getFieldLabel($field, $label, $viewDatas) ?></th>
<td nowrap class="text-start">
<?= $viewDatas['helper']->getFieldForm($field, old($field) ?? ($viewDatas['formDatas'][$field] ?? null), $viewDatas) ?>
<div><?= validation_show_error($field); ?></div>
</td>
</tr>
<?php endforeach; ?>
</table>
<div class="text-center"><?= form_submit('', '입력', array("class" => "btn btn-outline btn-primary")); ?></div>
<?= form_close(); ?>
<div class="form_bottom"><?= $this->include("{$viewDatas['layout']['template']}/form_content_bottom"); ?></div>
</div>
<?= $this->endSection() ?>

View File

@ -4,18 +4,21 @@
<td nowrap><?= $serviceEntity->getBillingAT() ?></td>
</tr>
<tr>
<th class="fw-bold" nowrap>결제금</th>
<td class="amount-green" nowrap><?= number_format(intval($serviceEntity->getAmount())) ?>원</td>
<th class="fw-bold text-info" nowrap>결제금</th>
<td nowrap><?= number_format(intval($serviceEntity->getAmount())) ?>원</td>
</tr>
<tr>
<th class="fw-bold" nowrap>미납금</th>
<td class="amount-red" nowrap>
<?php if (array_key_exists($serviceEntity->getPK(), $serviceCellDatas['unPaids'])): ?>
<?= $serviceCellDatas['helper']->getListButton('unpaid', '미납금', ['serviceCellDatas' => $serviceCellDatas, 'entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?>
<?php endif ?>
<th class="fw-bold text-danger" nowrap>미납금</th>
<td nowrap>
<?= $serviceCellDatas['helper']->getListButton('unpaid', '미납금', ['unPaids' => $serviceCellDatas['unPaids'], 'entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?>
</td>
</tr>
<tr>
<td colspan="2" class="text-center"><?= $serviceCellDatas['helper']->getListButton('onetime', '일회성/선결제 추가', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
<td nowrap class="text-center"><?= $serviceCellDatas['helper']->getListButton('onetime', '일회성 결제', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
<td nowrap class="text-center"><?= $serviceCellDatas['helper']->getListButton('prepayment', '선 결제', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
</tr>
<tr>
<td nowrap class="text-center"><?= $serviceCellDatas['helper']->getListButton('coupon', '쿠폰 결제', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
<td nowrap class="text-center"><?= $serviceCellDatas['helper']->getListButton('point', '포인트 결제', ['entity' => $serviceEntity], ['class' => 'btn btn-sm btn-primary']) ?></td>
</tr>
</table>