function run_transaction($vars)
 {
     $bp = new BluePayment($this->config[account_id], $this->config[secret], $this->config[test] ? "TEST" : LIVE);
     $bp->sale($vars[amount]);
     $bp->payType = 'CREDIT';
     $bp->setCustInfo($vars[cc], $vars[cvv2], $vars[expire], $vars[name1], $vars[name2], $vars[street], $vars[city], $vars[state], $vars[zip], $vars[country]);
     $bp->process();
     $res = array('STATUS' => $bp->getStatus(), 'AVS' => $bp->getAvsResp(), 'PNREF' => $bp->getTransId(), 'CVV_VALID' => $bp->getCvv2Resp(), 'AUTH_CODE' => $bp->getAuthCode(), 'RESPMSG' => $bp->getMessage());
     return $res;
 }
Exemple #2
0
function bluepay_refund($params)
{
    if ($params['testmode'] == "on") {
        $gateway_testmode = "TEST";
    } else {
        $gateway_testmode = "LIVE";
    }
    define("MODE", $gateway_testmode);
    define("POST_URL", "https://secure.bluepay.com/interfaces/bp20post");
    define("ACCOUNT_ID", $params['accountid']);
    define("SECRET_KEY", $params['secretkey']);
    define("STATUS_DECLINE", "0");
    define("STATUS_APPROVED", "1");
    define("STATUS_ERROR", "2");
    $bp = new BluePayment();
    $bp->refund($params['transid']);
    $bp->setCustInfo($params['cardnum'], "", $params['cardexp'], $params['clientdetails']['firstname'], $params['clientdetails']['lastname'], $params['clientdetails']['address1'], $params['clientdetails']['city'], $params['clientdetails']['state'], $params['clientdetails']['postcode'], $params['clientdetails']['country']);
    $bp->process();
    $desc = "Action => Refund\nClient => " . $params['clientdetails']['firstname'] . " " . $params['clientdetails']['lastname'] . "\n";
    $desc .= "TransId => " . $bp->getTransId() . "\n" . "Status => " . $bp->getStatus() . "\n" . "AVS Resp => " . $bp->getAvsResp() . "\n" . "CVV2 Resp => " . $bp->getCvv2Resp() . "\n" . "Auth Code => " . $bp->getAuthCode() . "\n" . "Message => " . $bp->getMessage() . "\n";
    switch ($bp->getStatus()) {
        case "1":
            array("status" => "success", "transid" => $bp->getTransId(), "rawdata" => $desc);
    }
    return;
}