Example #1
0
 $orderNoLabel = $messages["lblOrderNumber"];
 $amountLabel = $messages["lblpayment"];
 $isPendingPayment = $payResultJson["isPendingPayment"];
 if ($status == "0000") {
     $orderNo = $payResultJson['data']['orderNO'];
     $siteOrderNo = substr($orderNo, 8);
     $amount = $payResultJson['data']['amount'];
     $currCode = $payResultJson['data']['par6'];
     $pkid = $payResultJson["data"]["par3"];
     $acctNo = $payResultJson["data"]["par1"];
     $result = $payResultJson["data"]["par5"];
     $succeed = $payResultJson["data"]["par4"];
     $hashValue = $payResultJson['data']['hashValue'];
     $signkey = trim(Configuration::get('NEWORDER_MERCHANT_KEY'));
     $signSrc = $signkey . $acctNo . $orderNo . $pkid . $succeed . $result . $currCode;
     $signInfo = szComputeMD5Hash($signSrc);
     if ($hashValue == $signInfo) {
         if ($succeed == "00") {
             Paylog::msg($cart->id, "00", "支付成功");
             $pay = Module::Hook($paymentid);
             $pay->validateOrder($cart, $pay->id, 2);
             $order = new Order($pay->currentOrder);
             $redirct = $link->getPage('PaymentResultView') . "?id_order=" . $pay->currentOrder . "&id_module=" . $paymentid . "&toke_open=" . md5($order->id_user);
             die(json_encode(array("isError" => "NO", "redirct" => $redirct, "msg" => 'Transaction has been successfully,the page will redirect after 3 seconds,If there is no redirect, please click <a href="' . $redirct . '">here</a>')));
         } else {
             //信息不是从支付服务器返回
             Paylog::msg($cart->id, "202", "返回状态码是成功,但succeed不为00" . (empty($errorMessage) ? $messages["errorNote"] : str_replace("@@@", $errorMessage, $messages["payFailure"])));
             die(json_encode(array("isError" => "YES", "isPendingPayment" => $isPendingPayment, "msg" => "Payment failed!, Response Code: 202," . (empty($errorMessage) ? $messages["errorNote"] : str_replace("@@@", $errorMessage, $messages["payFailure"])))));
         }
     } else {
         //信息不是从支付服务器返回
Example #2
0
function buildNameValueList($neworder, $cart, $mycurrency, $additionInfo)
{
    $merNo = trim(Configuration::get('NEWORDER_MERCHANT_NO'));
    $signKey = trim(Configuration::get('NEWORDER_MERCHANT_KEY'));
    $orderAmount = number_format($cart->getOrderTotal(), 2, '.', '');
    $orderNo = 'NB-' . $cart->id;
    $billInfo = new Address(intval($cart->id_address));
    $customer = new User(intval($cart->id_user));
    $shipInfo = $billInfo;
    $message = $cart->msg;
    $shipFee = number_format($cart->getShippingTotal(), 2, '.', '');
    $orderCurrency = toCurrencyCode($mycurrency->iso_code);
    //账单地址
    $firstName = $billInfo->first_name;
    $lastName = $billInfo->last_name;
    $address = strtolower($billInfo->address . $billInfo->address2);
    $city = $billInfo->city;
    $state = "";
    if ($billInfo->id_state > 0) {
        $_state = new State((int) $billInfo->id_state);
        $state = $_state->name;
    }
    $country = $billInfo->country->name;
    $zip = $billInfo->postcode;
    $email = $customer->email;
    $phone = $billInfo->phone;
    //发货地址
    $shipFirstName = $shipInfo->first_name;
    $shipLastName = $shipInfo->last_name;
    $shipZip = $shipInfo->postcode;
    $shipAddress = strtolower($shipInfo->address . $shipInfo->address2);
    $shipCity = $shipInfo->city;
    $shipState = $state;
    $shipCountry = $shipInfo->country->name;
    $countryCode = $shipInfo->country->iso_code;
    $shipPhone = $shipInfo->phone;
    $shipEmail = $email;
    $cardNo = $additionInfo["CardPAN"];
    $cardSecurityCode = $additionInfo["CVV2"];
    $cardExpireMonth = $additionInfo["ExpirationMonth"];
    $cardExpireYear = substr($additionInfo["ExpirationYear"], 2);
    $ip = get_client_ip();
    $userAgent = $_SERVER['HTTP_USER_AGENT'];
    $webSite = $_SERVER["HTTP_HOST"];
    $products = $cart->getProducts();
    $goodsInfo = "";
    for ($i = 0; $i < count($products); $i++) {
        $goodsInfo .= md5($products[$i]["name"]) . "#,#" . $products[$i]["id_product"] . "#,#" . number_format($products[$i]["price"], 2, '.', '') . "#,#" . $products[$i]["quantity"] . "#;#";
    }
    $_shipMethod = new Carrier(intval($cart->id_carrier));
    $shipMethod = $_shipMethod->name;
    //配置到那去的?
    $notifyUrl = 'http://' . $_SERVER['HTTP_HOST'] . __TM_BASE_URI__ . 'modules/payment/neworder/notify.php';
    $remark = trim($message);
    $signSrc = $signKey . $merNo . (date('Ymd') . $orderNo) . $orderAmount * 100 . $orderCurrency;
    $hasValue = szComputeMD5Hash($signSrc);
    $cookies = '';
    foreach ($_COOKIE as $key => $val) {
        $cookies = $cookies . $key . '=' . $val . ';';
    }
    $lang = Configuration::get('NEWORDER_MERCHANT_LANG');
    $data = array('URL' => $webSite, 'AcctNo' => $merNo, 'CartID' => $neworder->generateOrderNo($cart->id), 'OrderID' => $neworder->generateOrderNo($orderNo), 'CurrCode' => $orderCurrency, 'Amount' => $orderAmount * 100, 'IPAddress' => $ip, 'Telephone' => $shipPhone, 'CName' => $shipFirstName . ' ' . $shipLastName, 'ExpDate' => $cardExpireYear . '' . $cardExpireMonth, 'BAddress' => $address, 'BCity' => $shipCity, 'PostCode' => $shipZip, 'Email' => $email, 'Bstate' => $shipState, 'Bcountry' => $country, 'PName' => string_replace($goodsInfo), 'HashValue' => $hasValue, 'OrderUrl' => $webSite, 'Framework' => 'TMShop', 'BCountryCode' => $countryCode, 'CardPAN' => $cardNo, 'ExpirationMonth' => $cardExpireMonth, 'ExpirationYear' => $cardExpireYear, 'CVV2' => $cardSecurityCode, 'IFrame' => '1', 'cookies' => $cookies, 'IVersion' => $neworder->IVersion, 'Language' => $lang);
    return $data;
}