View Single Post
  #4  
Old 8th December 2014, 00:03
goXXip goXXip is offline
Member
 
Join Date: Jun 2008
Posts: 4
Default
PHP Code:
<?php
    
function analyzeNotificationXML(&$xml, &$operation, &$status, &$transid$idformerchant) {
        
$operation '';
        
$status '';
        
$transid '';
        
$idformerchant '';
        
SimpleXMLElement;
        
$obj = new ( $xml )(  );
        
Exception {
            
logTransaction$GATEWAY['name'], 'Exception: ' $e'Unsuccessful' );
            return 
false;

            if (isset( 
$obj->result[0]->operation )) {
                
$operation $obj->result[0]->operation;
            } 
else {
                return 
false;
            }


            if (isset( 
$obj->result[0]->status )) {
                
$status $obj->result[0]->status;
            } 
else {
                return 
false;
            }


            if (isset( 
$obj->result[0]->transid )) {
                
$transid $obj->result[0]->transid;
            } 
else {
                return 
false;
            }


            if (isset( 
$obj->result[0]->idForMerchant )) {
                
$idformerchant $obj->result[0]->idForMerchant;
            } 
else {
                return 
false;
            }

            return 
true;
        }
    }

    include( 
'../../../dbconnect.php' );
    include( 
'../../../includes/functions.php' );
    include( 
'../../../includes/gatewayfunctions.php' );
    include( 
'../../../includes/invoicefunctions.php' );
    require_once( 
'../hipay/mapi_package.php' );
    
$gatewaymodule 'hipay';
    
$GATEWAY getGatewayVariables$gatewaymodule );

    if (!
$GATEWAY['type']) {
        exit( 
'Module Not Activated' );
    }

    
$xml html_entity_decodetrim$_POST['xml'] ) );

    if (isset( 
$xml )) {
        
$ret analyzeNotificationXML$xml, &$operation, &$status, &$transid, &$idformerchant );
    } 
else {
        
logTransaction$GATEWAY['name'], 'No POST data''Unsuccessful' );
        return 
null;
    }


    if (
$ret   false) {
        
logTransaction$GATEWAY['name'], $xml'Unsuccessful' );
        return 
1;
    }

    
$status $status;
    
$invoiceid $idformerchant;
    
$transid $transid;
    
$amount $amount;
    
$fee 0;
    
$invoiceid checkCbInvoiceID$invoiceid$GATEWAY['name'] );
    
checkCbTransID$transid );

    if (( 
$status  'ok' && $operation  'capture' )) {
        
addInvoicePayment$invoiceid$transid$amount$fee$gatewaymodule );
        
logTransaction$GATEWAY['name'], $xml'Successful' );
        return 
1;
    }

    
logTransaction$GATEWAY['name'], $xml'Unsuccessful' );
?>
Reply With Quote