/home/mjc1/public_html/plugin/nicepay/lib/nicepay/validator/CardBodyMessageValidator.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require_once dirname(__FILE__).'/BodyMessageValidator.php';
/**
 *
 * @author kblee
 *
 */
class CardBodyMessageValidator implements BodyMessageValidator{

    
/**
     *
     */
    
public function CardBodyMessageValidator(){

    }

    
/**
     * validate.
     *
     * @param paramSet the param set
     *
     * @throws ServiceException the service exception
     */
    
public function validate($mdto){

    if (
$mdto->getParameter(TR_KEY) == null) {
          
// Ä«µåÇüÅÂ(°³ÀÎ, ¹ýÀÎ, ÇØ¿Ü)
          
if($mdto->getParameter(CARD_TYPE) == null || $mdto->getParameter(CARD_TYPE) == ""){
              if(
LogMode::isAppLogable()){
                  
$logJournal NicePayLogJournal::getInstance();
                  
$logJournal->errorAppLog("Ä«µåÇüÅ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
              }
              throw new 
ServiceException("V501","Ä«µåÇüÅ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
          }
  
  
  
          
// Ä«µåÄÚµå
          
if($mdto->getParameter(CARD_CODE) == null || $mdto->getParameter(CARD_CODE) == ""){
              if(
LogMode::isAppLogable()){
                  
$logJournal NicePayLogJournal::getInstance();
                  
$logJournal->errorAppLog("Ä«µåÄڵ堹̼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
              }
              throw new 
ServiceException("V503","Ä«µåÄڵ堹̼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
          }
  
          
// ¹«ÀÌÀÚ¿©ºÎ
          
if($mdto->getParameter(CARD_INTEREST) == null || $mdto->getParameter(CARD_INTEREST) == ""){
              if(
LogMode::isAppLogable()){
                  
$logJournal NicePayLogJournal::getInstance();
                  
$logJournal->errorAppLog("Ä«µå ¹«ÀÌÀÚ¿©ºÎ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
              }
              throw new 
ServiceException("V505","Ä«µå ¹«ÀÌÀÚ¿©ºÎ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
          }
  
  
          
// Ä«µåÇüÅ °ª Ã¼
          
if((PERSONAL_CARD_TYPE != $mdto->getParameter(CARD_TYPE)) &&
          (
BUSINESS_CARD_TYPE != $mdto->getParameter(CARD_TYPE))){
                  
              if(
LogMode::isAppLogable()){
                  
$logJournal NicePayLogJournal::getInstance();
                  
$logJournal->errorAppLog("Ä«µåÇüÅ ¼³Á¤ ¿À·ùÀÔ´Ï´Ù. °³ÀÎ(0), ±â¾÷(1), ÇØ¿Ü(2) Ä«µåÇüŸ¸  ¼³Á¤ °¡´ÉÇÕ´Ï´Ù. Çö ¼³Á¤°ª :".$mdto->getParameter(CARD_TYPE));
              }
                  
              throw new 
ServiceException("V508","Ä«µåÇüÅ Çã¿ëÇÏÁö ¾Ê´Â °ªÀ» ¼³Á¤ÇÏ¿´½À´Ï´Ù.");
          }
  
  
  
          
// KeyInÀÎÁõÀÏ °æ¿ì
          
if(CARD_AUTH_TYPE_KEYIN == $mdto->getParameter(CARD_AUTH_FLAG)){
              
// Ä«µå¹øÈ£+À¯È¿±â°£
              
if( (CARD_KEYIN_CL01 == $mdto->getParameter(CARD_KEYIN_CL)) || (CARD_KEYIN_CL11 == $mdto->getParameter(Constants.CARD_KEYIN_CL))) {
                  
// À¯È¿±â°£
                  
if($mdto->getParameter(CARD_EXPIRE) == null || $mdto->getParameter(CARD_EXPIRE) == ""){
                      if(
LogMode::isAppLogable()){
                          
$logJournal NicePayLogJournal::getInstance();
                          
$logJournal->errorAppLog("À¯È¿±â°£ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
                      }
                      throw new 
ServiceException("V510","À¯È¿±â°£ ¹Ì¼³Á¤ ¿À·ùÀÔ´Ï´Ù.");
                  }
  
                  
//À¯È¿±â°£ ÀÚ¸®¼ö Ã¼Å©
                  
$expireYYMM $mdto->getParameter(CARD_EXPIRE);
                  if(
strlen($expireYYMM) != 4){
                      if(
LogMode::isAppLogable()){
                          
$logJournal NicePayLogJournal::getInstance();
                          
$logJournal->errorAppLog("À¯È¿±â°£Àº  4ÀÚ¸®¿©¾ß ÇÕ´Ï´Ù.");
                      }
                      throw new 
ServiceException("V511","À¯È¿±â°£ Çã¿ëÇÏÁö ¾Ê´Â °ªÀ» ¼³Á¤ÇÏ¿´½À´Ï´Ù.");
                  }
                  
// À¯È¿±â°£ ¹üÀ§ Ã¼Å©
                  
$expireMonth =  (int) substr($expireYYMM,2,2);
                  if(
$expireMonth <|| $expireMonth 12){
                      if(
LogMode::isAppLogable()){
                          
$logJournal NicePayLogJournal::getInstance();
                          
$logJournal->errorAppLog("À¯È¿±â°£ÀÇ ¿ù ÇüŰ¡ À߸ø ¼³Á¤µÇ¾ú½À´Ï´Ù. 1¿ù¿¡¼­ 12¿ù»çÀÌ ÀԷ °¡´ÉÇÕ´Ï´Ù. Çö ÀԷ°ª :".$expireMonth);
                      }
                      throw new 
ServiceException("V512","À¯È¿±â°£ÀÇ ¿ù ÇüŰ¡ À߸ø ¼³Á¤µÇ¾ú½À´Ï´Ù.");
                  }
              }
                  
              if(
CARD_KEYIN_CL11 == $mdto->getParameter(CARD_KEYIN_CL)){
                  
// ºñ¹Ð¹øÈ£ Ã¼Å©
                  
if($mdto->getParameter(CARD_PWD) == null || $mdto->getParameter(CARD_PWD) == ""){
                      if(
LogMode::isAppLogable()){
                          
$logJournal NicePayLogJournal::getInstance();
                          
$logJournal->errorAppLog("Ä«µå ºñ¹Ð¹øÈ£°¡ ÀԷµÇÁö ¾Ê¾Ò½À´Ï´Ù. º»ÀÎÀÎÁõ½Ã ºñ¹Ð¹øÈ£°¡ ÇÊ¿äÇÕ´Ï´Ù.");
                      }
                      throw new 
ServiceException("V513","Ä«µå ºñ¹Ð¹øÈ£ ¹ÌÀԷ ¿À·ùÀÔ´Ï´Ù.");
                  }
              }
          }
        } else {
        
        
        
        }
        
    }

}
        
?>