Example #1
0
function item_url_replace($channel, &$item, $old, $new, $oldnick = '')
{
    if ($item['attach']) {
        json_url_replace($old, $new, $item['attach']);
        if ($oldnick) {
            json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['attach']);
        }
    }
    if ($item['object']) {
        json_url_replace($old, $new, $item['object']);
        if ($oldnick) {
            json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['object']);
        }
    }
    if ($item['target']) {
        json_url_replace($old, $new, $item['target']);
        if ($oldnick) {
            json_url_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['target']);
        }
    }
    if (string_replace($old, $new, $item['body'])) {
        $item['sig'] = base64url_encode(rsa_sign($item['body'], $channel['channel_prvkey']));
        $item['item_verified'] = 1;
    }
    $item['plink'] = str_replace($old, $new, $item['plink']);
    if ($oldnick) {
        $item['plink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['plink']);
    }
    $item['llink'] = str_replace($old, $new, $item['llink']);
    if ($oldnick) {
        $item['llink'] = str_replace('/' . $oldnick . '/', '/' . $channel['channel_address'] . '/', $item['llink']);
    }
}
Example #2
0
function item_url_replace($channel, &$item, $old, $new)
{
    if ($item['attach']) {
        json_url_replace($old, $new, $item['attach']);
    }
    if ($item['object']) {
        json_url_replace($old, $new, $item['object']);
    }
    if ($item['target']) {
        json_url_replace($old, $new, $item['target']);
    }
    if (string_replace($old, $new, $item['body'])) {
        $item['sig'] = base64url_encode(rsa_sign($item['body'], $channel['channel_prvkey']));
        $item['item_verified'] = 1;
    }
}
Example #3
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;
}