Exemplo n.º 1
1
 public function getTranactionDetail($token)
 {
     $response = array("status" => 0, "message" => "Get Fail");
     $obj = new \NL_MicroCheckout($this->uid, $this->secret, $this->banking_url);
     $inputs = array('token' => $token);
     $result = $obj->getExpressCheckout($inputs);
     if ($result["result_code"] == "00" && isset($result["transaction_status"]) && $result["transaction_status"] == 4) {
         $response = array("status" => 1, "message" => "Bạn đã nạp : " . $result["amount"] . " VNĐ. Vào tài khoản : " . $this->user["ch_nickname"], "old_partner_transaction" => $token, "partner_transaction" => $result["transaction_id"], "value" => $result["amount"], "promotion" => 0);
     } else {
         $response = array("status" => 0, "message" => "Giao Dịch Không Thành Công - Mã Lỗi : " . $result["result_code"] . "-" . $result["transaction_status"], "old_partner_transaction" => $token, "partner_transaction" => isset($result["transaction_id"]) ? $result["transaction_id"] : "", "value" => isset($result["amount"]) ? $result["amount"] : "", "promotion" => 0);
     }
     $response_log = $this->_endChargeBanking($response);
     return $response;
 }
Exemplo n.º 2
0
        header('location:' . $link);
    }
}
// THANH TOÁN THẤT BẠI
function fail()
{
    desession();
    global $link;
    echo '<meta charset="utf-8"/><script>alert("Giao dịch không thành công !"); 
	window.location="' . $link . '";</script>';
}
if ($_SESSION['payment'] == 'nganluong') {
    $obj = new NL_MicroCheckout(MERCHANT_ID, MERCHANT_PASS, URL_WS);
    if ($obj->checkReturnUrlAuto()) {
        $inputs = array('token' => $obj->getTokenCode());
        $result = $obj->getExpressCheckout($inputs);
        if ($result != false) {
            if ($result['result_code'] != '00') {
                fail();
            }
        } else {
            die('<meta charset="utf-8"/>Lỗi kết nối tới cổng thanh toán Ngân Lượng');
        }
    } else {
        die('<meta charset="utf-8"/>Tham số truyền không đúng');
    }
    $code = $_SESSION['code'];
    $pass = $_SESSION['pass'];
    $link = '';
    if (isset($result) && !empty($result)) {
        if ($result['result_code'] == '00') {