Пример #1
0
function cc_iPayGate_refund($transInfo, $bankInfo, $companyInfo)
{
    require_once "subFunctions/banks.ipaygate.php";
    require_once "SOAP/Client.php";
    $response = "";
    $response['errormsg'] = "Transaction could not be processed.";
    $processor = new iPayGate_Client($bankInfo);
    //$orig_query = explode("?",$transInfo['td_process_query']);
    $orig_result = unserialize(str_replace('[credit_card]', etelDec($transInfo['CCnumber']), $transInfo['td_process_result']));
    $params = array("customerPaymentPageText" => strval($orig_result['CUSTOMERPAYMENTPAGETEXT']), "orderDescription" => strval($orig_result['ORDERDESCRIPTION']), "refundamount" => strval($transInfo['amount']), "referralorderreference" => strval($orig_result['ORDERREFERENCE']), "comment1" => strval(substr($transInfo['reason'], 0, 249)));
    $process_result = $processor->Execute_Refund($params);
    $response['success'] = false;
    $response['cancelstatus'] = 'N';
    $response['errormsg'] = $process_result['TRANSACTIONSTATUSTEXT'] . ': ' . $process_result['ERRORMESSAGE'];
    $response['errorcode'] = $process_result['ERRORCODE'];
    $response['td_process_query'] = serialize($params);
    $response['td_process_result'] = serialize($process_result);
    if ($process_result['RESPONSECODE'] == '000' || $process_result['TRANSACTIONSTATUSTEXT'] == 'SUCCESSFUL') {
        $response['cancelstatus'] = 'Y';
        $response['success'] = true;
    }
    return $response;
}