|
@@ -429,7 +429,10 @@ public class EasypayPaymentService extends CommonService {
|
429
|
429
|
// payInfo.setCancelDate(null);
|
430
|
430
|
unpaidMngMapper.insertPgKiccPayPtcl(userId, payInfo);
|
431
|
431
|
|
432
|
|
- if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
|
|
432
|
+ if (PayTpCd.PRE_PAY_CHARGE.getCd().equals(easypayPaymentRequest.getPayTpCd()) //
|
|
433
|
+ || PayTpCd.AFTER_PRE_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 선결제/충전
|
|
434
|
+ procPreChargePayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
|
|
435
|
+ } else if (PayTpCd.AFTER_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) { // 후불(결제)
|
433
|
436
|
procAfterPayment(userId, r_amount, r_pay_type, payInfo, easypayPaymentRequest);
|
434
|
437
|
}
|
435
|
438
|
} catch (Exception e) {
|
|
@@ -477,6 +480,55 @@ public class EasypayPaymentService extends CommonService {
|
477
|
480
|
}
|
478
|
481
|
}
|
479
|
482
|
|
|
483
|
+ private void procPreChargePayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
|
|
484
|
+ // 1. 여신관리기본정보
|
|
485
|
+ LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());
|
|
486
|
+
|
|
487
|
+ long trscBfBal = infoEntity.getAcctBal();
|
|
488
|
+ long trscAfBal = infoEntity.getAcctBal() + Long.parseLong(r_amount);
|
|
489
|
+ // 계좌잔액 증가
|
|
490
|
+ infoEntity.setAcctBal(trscAfBal);
|
|
491
|
+ dsptMngMapper.updateLoanMgntBaseInfo4AcctBal(userId, infoEntity);
|
|
492
|
+
|
|
493
|
+ // 2. 여신관리상세이력
|
|
494
|
+ // 2.1 입금 처리
|
|
495
|
+ LoanMgntDtlHstEntity hstEntity = new LoanMgntDtlHstEntity();
|
|
496
|
+ hstEntity.setLoanMgntUnqNo(infoEntity.getLoanMgntUnqNo());
|
|
497
|
+ hstEntity.setLoanRegDt(DateUtil.getCurrentDate());
|
|
498
|
+ hstEntity.setLoanRegTm(DateUtil.getCurrentTime());
|
|
499
|
+ hstEntity.setDpstPayDvsn(DpstPayDvsn.DEPOSIT.getCd());
|
|
500
|
+ // 11:신용카드, 21:계좌이체
|
|
501
|
+ if ("11".equals(r_pay_type)) {
|
|
502
|
+ hstEntity.setMediaDvsn(MediaDvsn.CARD.getCd());
|
|
503
|
+ } else if ("21".equals(r_pay_type)) {
|
|
504
|
+ hstEntity.setMediaDvsn(MediaDvsn.ACCOUNT.getCd());
|
|
505
|
+ }
|
|
506
|
+ if (PayTpCd.PRE_PAY_CHARGE.getCd().equals(easypayPaymentRequest.getPayTpCd())) {
|
|
507
|
+ hstEntity.setPayType(PayType.CHARGE_PAYMENT.getCd());
|
|
508
|
+ } else if (PayTpCd.AFTER_PRE_PAYMENT.getCd().equals(easypayPaymentRequest.getPayTpCd())) {
|
|
509
|
+ hstEntity.setPayType(PayType.PRE_PAYMENT.getCd());
|
|
510
|
+ }
|
|
511
|
+ hstEntity.setTrscAmt(Long.parseLong(r_amount)); // 거래금액
|
|
512
|
+ hstEntity.setTrscBfBal(trscBfBal);
|
|
513
|
+ hstEntity.setTrscAfBal(trscAfBal);
|
|
514
|
+ dsptMngMapper.insertLoanMgntDtlHst(userId, hstEntity);
|
|
515
|
+
|
|
516
|
+ // 4. 여신관리입금처리
|
|
517
|
+ LoanMgntDsptProcEntity entity = new LoanMgntDsptProcEntity();
|
|
518
|
+ entity.setDsptMgntNo(fnGetDealNo(21, "")); // 입금관리번호
|
|
519
|
+ entity.setReqDt(DateUtil.getCurrentDate());
|
|
520
|
+ entity.setReqTm(DateUtil.getCurrentTime());
|
|
521
|
+ entity.setDpstAmt(Long.parseLong(r_amount)); // 입금금액
|
|
522
|
+ entity.setDpstDt(entity.getReqDt()); // 입금일자
|
|
523
|
+ entity.setDpstStCd(DpstStCd.DPST_APPROVE.getCd());
|
|
524
|
+ entity.setDpstReqId(userId);
|
|
525
|
+ entity.setStoreId(payInfo.getStoreId());
|
|
526
|
+ entity.setBrandId(payInfo.getBrandId());
|
|
527
|
+ entity.setPoOrdNo(payInfo.getPoOrdNo());
|
|
528
|
+ entity.setPgId("KICC");
|
|
529
|
+ dsptMngMapper.insertLoanMgntDsptProcInfo(userId, entity);
|
|
530
|
+ }
|
|
531
|
+
|
480
|
532
|
private void procAfterPayment(String userId, String r_amount, String r_pay_type, PgKiccPayPtclEntity payInfo, EasypayPaymentRequest easypayPaymentRequest) throws Exception {
|
481
|
533
|
// 2. 여신관리기본정보
|
482
|
534
|
LoanMgntBaseInfoEntity infoEntity = dsptMngMapper.selectLoanMgntBaseInfo(payInfo.getBrandId(), payInfo.getStoreId());
|