public function creareorder($order_info) { $order_id = $order_info["order_id"]; $this->load->model('sale/order'); $order_totals = $this->model_sale_order->Gettotals($order_id); $products = $this->model_sale_order->getproducts($order_id); //zhangbo $cardifo_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "card where customer_id='" . $order_info['customer_id'] . "'"); if ($cardifo_query->num_rows) { $cardinfo = array("card_id" => $cardifo_query->row["card_id"], "customer_id" => $cardifo_query->row["customer_id"], "card_name" => $cardifo_query->row["card_name"], "card_code" => $cardifo_query->row["card_code"], "card_type" => $cardifo_query->row["card_type"], "card_email" => $cardifo_query->row["card_email"], "card_phone" => $cardifo_query->row["card_phone"]); } //zhangbo //支付方式 if ($order_info["payment_code"] == "alipay") { $peymentcode = "112"; } else { if ($order_info["payment_code"] == "weixinpay") { $peymentcode = "118"; } else { if ($order_info["payment_code"] == "tenpay") { $peymentcode = "117"; } else { if ($order_info["payment_code"] == "tenpay") { $peymentcode = "117"; } } } } $PayInfo = array("ProductAmount" => $order_totals["total"], "ShippingAmount" => $order_totals["shipping"], "TaxAmount" => $order_totals["tax"], "CommissionAmount" => "0", "PayTypeSysNo" => $peymentcode, "PaySerialNumber" => $order_info["payment_sn"]); $ShippingInfo = array("ReceiveName" => $order_info["shipping_firstname"], "ReceivePhone" => $order_info["shipping_mobile"], "ReceiveAddress" => $order_info["shipping_address_1"], "ReceiveAreaCode" => $order_info["shipping_city_id"], "SenderName" => "", "SenderTel" => "", "SenderCompanyName" => "", "SenderAddr" => "", "SenderZip" => "", "SenderCity" => "", "SenderProvince" => "", "SenderCountry" => "", "ReceiveAreaName" => $order_info["shipping_zone"] . "," . $order_info["shipping_city"] . ", "); $AuthenticationInfo = array("Name" => $cardinfo["card_name"], "IDCardType" => "0", "IDCardNumber" => $cardinfo["card_code"], "PhoneNumber" => $cardinfo["card_phone"], "Email" => $cardinfo["card_email"], "Address" => ""); $ItemList = array(); //订单中购买商品列表 foreach ($products as $prd) { $taxprice = 0; if ($order_totals["tax"] > 50) { //当总关税大约50时,单品的关税才使用,否则为零 $taxprice = $prd["tax"]; } $ItemList[] = array("ProductID" => $prd["sku"], "Quantity" => $prd["quantity"], "SalePrice" => $prd["price"], "TaxPrice" => $taxprice); } $submit_url = 'method=Order.SOCreate&version=1.0&appid=' . appid . '&format=json×tamp=20150524123300&nonce=321435333&data='; //$kjt_order=new kjt_order('渠道编号','商户订单编号','S02','51',$PayInfo,$ShippingInfo,$AuthenticationInfo,$ItemList); $kjt_order = new kjt_order(SaleChannelSysNo, $order_id, 'S02', '51', $PayInfo, $ShippingInfo, $AuthenticationInfo, $ItemList); $submit_url .= json_encode($kjt_order); $sign = new sign(); $sign_url = $sign->create($submit_url, secretkey); $url = 'http://preapi.kjt.com/open.api?' . $sign_url["url"] . 'sign=' . $sign_url["sign"]; // $url='http://api.kjt.com/open.api?'.$sign_url["url"].'sign='.$sign_url["sign"]; $html = file_get_contents($url); $file = fopen("submitorder_log.txt", 'a'); fwrite($file, $html . "\n"); fclose($file); //{"Code":"0","Desc":"操作成功!","Data":{"MerchantOrderID":"1111111112223","ProductAmount":880.000000,"SOSysNo":10005609,"ShippingAmount":0,"TaxAmount":176.00}} $json = json_decode($html, true); if (isset($json["Code"]) && $json["Code"] == "0") { $this->db->query("UPDATE `" . DB_PREFIX . "order` SET kjtorderid='" . $json["Data"]["SOSysNo"] . "' where order_id='" . $json["Data"]["MerchantOrderID"] . "'"); } else { $this->data['noadd'] = $json["Desc"]; } }
public function invoice() { $this->load_language('sale/order'); $this->data['title'] = $this->language->get('heading_title'); if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) { $this->data['base'] = HTTPS_SERVER; } else { $this->data['base'] = HTTP_SERVER; } $this->data['direction'] = $this->language->get('direction'); $this->data['language'] = $this->language->get('code'); $this->load->model('sale/order'); $this->load->model('setting/setting'); $this->data['orders'] = array(); $orders = array(); if (isset($this->request->post['selected'])) { $orders = $this->request->post['selected']; } elseif (isset($this->request->get['order_id'])) { $orders[] = $this->request->get['order_id']; } $param = array(); foreach ($orders as $kjtorder_id) { $param[] = $kjtorder_id; } $submit_url = 'method=Invoice.FEPBillPost&version=1.0&appid=' . appid . '&format=json×tamp=20150524123300&nonce=321435333&data={"OrderIds":' . json_encode($param) . ',"SalesChannelCode":"22"}'; $sign = new sign(); $sign_url = $sign->create($submit_url, secretkey); $url = 'http://api.kjt.com/open.api?' . $sign_url["url"] . 'sign=' . $sign_url["sign"]; $html = file_get_contents($url); //$file = fopen("submitgouhui_log.txt",'a'); fwrite($file,$html."\n"); fclose($file); //$html='{"Code":"0","Desc":"操作成功!","Data":{"FEPBillId":100834,"PurchasingTotalAmount":58.000000}}'; $json = json_decode($html, true); if ($json["Code"] == 0) { foreach ($orders as $kjtorder_id) { $this->model_sale_order->updateOrder($kjtorder_id, $json["Data"]["FEPBillId"], $json["Data"]["PurchasingTotalAmount"]); } echo '<script>alert("提交成功");window.close(); </script>'; } else { echo '<script>alert("提交失败:' . $json["Desc"] . '");window.close(); </script>'; } }
public function creareorder($order_id, $paynumbr) { $this->load->model('checkout/order'); $order_info = $this->model_checkout_order->getOrder($order_id); $order_totals = $this->model_checkout_order->Gettotals($order_id); $products = $this->model_checkout_order->getproducts($order_id); //zhangbo $cardifo_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "card where customer_id='" . ${$order_info}['customer_id'] . "'"); if ($cardifo_query->num_rows) { $cardinfo = array("card_id" => $cardifo_query->row["card_id"], "customer_id" => $cardifo_query->row["customer_id"], "card_name" => $cardifo_query->row["card_name"], "card_code" => $cardifo_query->row["card_code"], "card_type" => $cardifo_query->row["card_type"], "card_email" => $cardifo_query->row["card_email"], "card_phone" => $cardifo_query->row["card_phone"]); } //zhangbo $PayInfo = array("ProductAmount" => $order_totals["total"], "ShippingAmount" => $order_totals["shipping"], "TaxAmount" => $order_totals["tax"], "CommissionAmount" => "0", "PayTypeSysNo" => "114", "PaySerialNumber" => $paynumbr); $ShippingInfo = array("ReceiveName" => $order_info["shipping_firstname"], "ReceivePhone" => $order_info["shipping_mobile"], "ReceiveAddress" => $order_info["shipping_address_1"], "ReceiveAreaCode" => $order_info["100010"], "ReceiveZip" => $order_info["shipping_firstname"], "SenderName" => "", "SenderTel " => "", "SenderCompanyName " => "", "SenderAddr " => "", "SenderZip" => "", "SenderCity " => "", "SenderProvince " => "", "SenderCountry " => "", "ReceiveAreaName " => ""); $AuthenticationInfo = array("Name" => $cardinfo["card_name"], "IDCardType " => "0", "IDCardNumber" => $cardinfo["card_code"], "PhoneNumber " => $cardinfo["card_phone"], "Email " => $cardinfo["card_email"], "Address " => ""); $ItemList = array(); //订单中购买商品列表 foreach ($products as $prd) { $ItemList[] = array("ProductID " => $prd["sku"], "Quantity" => $prd["quantity"], "SalePrice" => $prd["price"], "TaxPrice" => $prd["tax"]); } $submit_url = 'method=Order.SOCreate&version=1.0&appid=' . appid . '&format=json×tamp=20150524123300&nonce=321435333&data='; //$kjt_order=new kjt_order('渠道编号','商户订单编号','S02','51',$PayInfo,$ShippingInfo,$AuthenticationInfo,$ItemList); $kjt_order = new kjt_order(SaleChannelSysNo, '111111111', 'S02', '51', $PayInfo, $ShippingInfo, $AuthenticationInfo, $ItemList); $submit_url .= json_encode($kjt_order); $sign = new sign(); $sign_url = $sign->create($submit_url, secretkey); $url = 'http://preapi.kjt.com/open.api?' . $sign_url["url"] . 'sign=' . $sign_url["sign"]; $html = file_get_contents($url); $json = json_decode($html, true); if ($json["code"] == "0") { $this->model_checkout_order->updateOrderStatus($order_id, '2'); } }
* * @author zhangbo */ include "kjt_order.php"; include "sign.php"; $PayInfo = array("ProductAmount" => "950.00", "ShippingAmount" => "10.00", "TaxAmount" => "0", "CommissionAmount" => "0", "PayTypeSysNo" => "112", "PaySerialNumber" => "T2014111716262000000003221"); $ShippingInfo = array("ReceiveName" => "张三", "ReceivePhone" => "13874916678", "ReceiveAddress" => "万达广场c3懂", "ReceiveAreaCode" => "430105", "ReceiveAreaName" => "湖南省,长沙市, "); $AuthenticationInfo = array("Name" => "zhangsan", "IDCardType" => "0", "IDCardNumber" => "430121198703066713", "PhoneNumber" => "13874915560", "Email" => "*****@*****.**", "Address" => ""); $ItemList = array(array("ProductID" => "136ARE338430001", "Quantity" => "1", "SalePrice" => "950", "TaxPrice" => "0")); $submit_url = 'method=Order.SOCreate&version=1.0&appid=seller135&format=json×tamp=20150524123300&nonce=321435333&data='; //$kjt_order=new kjt_order('渠道编号','商户订单编号','S02','51',$PayInfo,$ShippingInfo,$AuthenticationInfo,$ItemList); $kjt_order = new kjt_order('38', '2015061904137383', 'S02', '51', $PayInfo, $ShippingInfo, $AuthenticationInfo, $ItemList); $submit_url .= json_encode($kjt_order); //echo $submit_url; $sign = new sign(); $sign_url = $sign->create($submit_url, "kjt@135"); //生成签名 echo '<a href="http://preapi.kjt.com/open.api?' . $sign_url["url"] . 'sign=' . $sign_url["sign"] . '" >提交订单</a>'; //$html = file_get_contents($url); // // //$file = fopen("submitorder_log.txt",'a'); fwrite($file,$html."\n"); fclose($file); // //{"Code":"0","Desc":"操作成功!","Data":{"MerchantOrderID":"11111111122232","ProductAmount":880.000000,"SOSysNo":10005609,"ShippingAmount":0,"TaxAmount":176.00}} // $json=json_decode($html, true); // if(isset($json["Code"]) && $json["Code"]=="0") // { // echo $json["Data"]["SOSysNo"]; // exit; // //$this->db->query("UPDATE `" . DB_PREFIX . "order` SET kjtorderid='".$json["Data"]["SOSysNo"]"'"); // // $this->model_checkout_order->updateOrderStatus($order_id,'2'); // }else // {
$xml .= "</xml>"; ?> <form action="http://www.shcoyee.com/index.php?route=checkout/Weixinnotifyurl" method="post" id="payment"> <input type="hidden" name="ss" id="SENDER_CODE" value="<?php echo $xml; ?> " /> <input type="submit" value="退款" /> </form> <?php $json = '{"CommitTime":"20150612020241","MerchantOrderID":"201506090442468","Message":null,"ShipTypeID":"2","Status":"1","TrackingNumber":"111111111111111111111111111"}'; $aasdf = new sign(); $submit_url = "method=Order.SOOutputCustoms&data=" . $json . "&format=json&version=1.0&nonce=0.770259068706194&appid=seller135×tamp=20150612100735"; $keysing = $aasdf->create($submit_url, "kjt@135"); echo $keysing["sign"]; $json = urlencode($json); ?> <form action="http://www.shcoyee.com/index.php?route=checkout/SOOutputCustoms" method="post" id="payment"> <input type="hidden" name="method" id="SENDER_CODE" value="Order.SOOutputCustoms" /> <input type="hidden" name="data" id="SENDER_CODE" value="<?php echo $json; ?> " /> <input type="hidden" name="format" id="SENDER_CODE" value="json" /> <input type="hidden" name="version" id="SENDER_CODE" value="1.0" /> <input type="hidden" name="nonce" id="SENDER_CODE" value="0.770259068706194" /> <input type="hidden" name="appid" id="SENDER_CODE" value="seller135" />