/home/mjc1/public_html/plugin/nicepay/lib/nicepay/core/AbstractService.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
<?php
/**
 * Abstract Service Class
 * @id : $Id: AbstractService.php 5531 2010-04-05 07:49:11Z crimson $
 * @version : $Revision: 5531 $
 * @author : $Author: crimson $
 *
 */
abstract class AbstractService{
     
    
/**
     * Execute Service
     * @param ParameterSet $webMessageDTO
     */
    
public function service($webMessageDTO){
        
// ¿äû ¸Þ½ÃÁö »ý¼ºÇϱâ
        
$requestBytes $this->createMessage($webMessageDTO);
        
        if(
LogMode::isAppLogable()){
            
$logJournal NicePayLogJournal::getInstance();
            
$logJournal->writeAppLog("¼Û½Å ".strlen($requestBytes)." Bytes");
        }
        
        
// ¿äû ¸Þ½ÃÁö º¸³»±â
        
$responseBytes $this->send($requestBytes);
        
        if(
LogMode::isAppLogable()){
            
$logJournal NicePayLogJournal::getInstance();
            
$logJournal->writeAppLog("¼ö½Å ".strlen($responseBytes)." Bytes");
        }
        
        
// ¼ö½Å ÈÄ ¸Þ½ÃÁö ÆÄ½ÌÇϱâ
        
$responseDTO $this->parseMessage($responseBytes);
        
        if(
LogMode::isAppLogable()){
            
$logJournal NicePayLogJournal::getInstance();
            
$logJournal->writeAppLog("°á°ú -> [".$responseDTO->getParameter("ResultCode")."][".trim($responseDTO->getParameter("ResultMsg"))."]");
        }
        
        return 
$responseDTO;
        
    }
    
    
/**
     * Create a ByteMessage
     * @param ParameterSet $webMessageDTO
     */
    
public abstract function createMessage($webMessageDTO);
    
    
/**
     * Send to m&Bank Interface System
     * @param ParameterSet $webMessageDTO
     */
    
public abstract function send($webMessageDTO);
    
    
/**
     * Receive Bytes Message from m&Bank Interface System. 
     * Parsing a ByteMessage, Transform Bytes to ParameterSet 
     * @param ParameterSet $responseBytes
     */
    
public abstract function parseMessage($responseBytes);
    
}
?>