Esempio n. 1
0
 public static function send($order_id)
 {
     $order = Myorder::instance($order_id)->get();
     $order['order_product_detail'] = Myorder_product::instance()->order_product_details(array('order_id' => $order['id']));
     $order['skulist'] = '';
     $order['qlist'] = '';
     $order['amtlist'] = '';
     $order['source'] = '1';
     $skulist = array();
     $qlist = array();
     $amtlist = array();
     foreach ($order['order_product_detail'] as $key => $order_product_detail) {
         $skulist[] = $order_product_detail['SKU'];
         $qlist[] = $order_product_detail['quantity'];
         $amtlist[] = $order_product_detail['discount_price'];
     }
     $order['skulist'] = implode("|", $skulist);
     $order['qlist'] = implode("|", $qlist);
     $order['amtlist'] = implode("|", $amtlist);
     $post_url = "http://af.statcount.org/order/";
     $post_var = "order=" . $order['order_num'] . "&amount=" . $order['total_real'] . "&skulist=" . $order['skulist'] . "&qlist=" . $order['qlist'] . "&amtlist=" . $order['amtlist'] . "&cur=" . $order['currency'] . "&source=" . $order['source'];
     $result = tool::curl_pay($post_url, $post_var);
     if (stristr($result == 'SUCCESS')) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 2
0
 /**
  * 获取账户信息
  *
  */
 public static function get($account_id)
 {
     $post_url = "http://manage.backstage-gateway.com/account";
     $post_var = "account_id=" . $account_id;
     $result = tool::curl_pay($post_url, $post_var);
     $res = @unserialize(stripcslashes($result));
     if (!is_array($res)) {
         log::write('data_error', $result, __FILE__, __LINE__);
     }
     return $res;
 }
Esempio n. 3
0
 /**
  * 往支付网关发送数据
  * 用于pp支付或者其他跳转支付的验证流程
  * 参数是order数组等等
  * 注意pay_id必须
  */
 public static function send_payment_detail($order, $pay_id, $secure_code, $submit_url)
 {
     //$post_url = "https://www.backstage-gateway.com/pp";
     $post_url = $submit_url;
     $post_var = "order_num=" . $order['order_num'] . "&order_amount=" . $order['total_real'] . "&order_currency=" . $order['currency'] . "&billing_firstname=" . $order['billing_firstname'] . "&billing_lastname=" . $order['billing_lastname'] . "&billing_address=" . $order['billing_address'] . "&billing_zip=" . $order['billing_zip'] . "&billing_city=" . $order['billing_city'] . "&billing_state=" . $order['billing_state'] . "&billing_country=" . $order['billing_country'] . "&billing_telephone=" . $order['billing_phone'] . "&billing_ip_address=" . long2ip($order['ip']) . "&billing_email=" . $order['email'] . "&shipping_firstname=" . $order['shipping_firstname'] . "&shipping_lastname=" . $order['shipping_lastname'] . "&shipping_address=" . $order['shipping_address'] . "&shipping_zip=" . $order['shipping_zip'] . "&shipping_city=" . $order['shipping_city'] . "&shipping_state=" . $order['shipping_state'] . "&shipping_country=" . $order['shipping_country'] . "&trans_id=" . $order['trans_id'] . "&secure_code=" . $secure_code . "&site_id=" . $pay_id;
     $result = tool::curl_pay($post_url, $post_var);
     $res = @unserialize(stripcslashes($result));
     if (is_array($res)) {
         return true;
     } else {
         return false;
     }
 }
Esempio n. 4
0
 public static function quote_xe($to, $from = 'USD')
 {
     if (!isset(self::$data[$to])) {
         @set_time_limit(600);
         $url = 'http://www.xe.net/ucc/convert.cgi';
         $data = 'Amount=1&From=' . $from . '&To=' . $to;
         $page = tool::curl_pay($url, $data);
         $page = explode("\n", $page);
         if (is_object($page) || $page != '') {
             $match = array();
             preg_match('/[0-9.]+\\s*' . $from . '\\s*=\\s*([0-9.]+)\\s*' . $to . '/', implode('', $page), $match);
             if (sizeof($match) > 0) {
                 self::$data[$to] = $match[1];
             } else {
                 self::$data[$to] = false;
             }
         }
     }
     return self::$data[$to];
 }
Esempio n. 5
0
 public function handle()
 {
     //echo kohana::debug($this->fileds);
     //数据验证
     $validator = new Validation($this->fileds);
     $validator->pre_filter('trim');
     $validator->add_rules('submit_url', 'required');
     $validator->add_rules('order_num', 'required');
     $validator->add_rules('order_amount', 'required');
     $validator->add_rules('order_currency', 'required');
     $validator->add_rules('card_num', 'required');
     $validator->add_rules('card_type', 'required');
     $validator->add_rules('card_cvv', 'required');
     $validator->add_rules('card_exp_month', 'required');
     $validator->add_rules('card_exp_year', 'required');
     $validator->add_rules('card_valid_month', 'standard_text');
     $validator->add_rules('card_valid_year', 'standard_text');
     $validator->add_rules('card_issue', 'standard_text');
     if (!$validator->validate()) {
         //错误输出,js层已经过滤,一般不会输出
         $validate_errors = $validator->errors();
         $errors = '';
         foreach ($validate_errors as $key => $val) {
             $errors .= $key . ' failed rule ' . $val . '<br>';
         }
         throw new PaymentException($errors, 400);
     }
     $post_url = $this->fileds['submit_url'];
     $post_var = "order_num=" . $this->fileds['order_num'] . "&order_amount=" . $this->fileds['order_amount'] . "&order_currency=" . $this->fileds['order_currency'] . "&card_num=" . $this->fileds['card_num'] . "&card_type=" . $this->fileds['card_type'] . "&card_cvv=" . $this->fileds['card_cvv'] . "&card_exp_month=" . $this->fileds['card_exp_month'] . "&card_exp_year=" . $this->fileds['card_exp_year'] . "&card_issue=" . $this->fileds['card_issue'] . "&card_valid_month=" . $this->fileds['card_valid_month'] . "&card_valid_year=" . $this->fileds['card_valid_year'] . "&billing_firstname=" . $this->fileds['billing_firstname'] . "&billing_lastname=" . $this->fileds['billing_lastname'] . "&billing_address=" . $this->fileds['billing_address'] . "&billing_zip=" . $this->fileds['billing_zip'] . "&billing_city=" . $this->fileds['billing_city'] . "&billing_state=" . $this->fileds['billing_state'] . "&billing_country=" . $this->fileds['billing_country'] . "&billing_telephone=" . $this->fileds['billing_telephone'] . "&billing_ip_address=" . $this->fileds['billing_ip_address'] . "&billing_email=" . $this->fileds['billing_email'] . "&shipping_firstname=" . $this->fileds['shipping_firstname'] . "&shipping_lastname=" . $this->fileds['shipping_lastname'] . "&shipping_address=" . $this->fileds['shipping_address'] . "&shipping_zip=" . $this->fileds['shipping_zip'] . "&shipping_city=" . $this->fileds['shipping_city'] . "&shipping_state=" . $this->fileds['shipping_state'] . "&shipping_country=" . $this->fileds['shipping_country'] . "&secure_code=" . $this->fileds['secure_code'] . "&site_id=" . $this->fileds['site_id'];
     $result = tool::curl_pay($post_url, $post_var);
     $error_msg = '';
     $is_serialization = tool::check_serialization($result, $error_msg);
     $res = null;
     if ($is_serialization) {
         $result = stripcslashes($result);
         $res = unserialize($result);
     }
     $return_key = array('status_id', 'trans_id', 'message', 'api', 'avs', 'status', 'flag');
     $return_arr = arr::init_arr($return_key, $res);
     return $return_arr;
 }
Esempio n. 6
0
 /**
 * 每天列表
 *
 * @param Int $id
 * @return Array
 			Array
 			(
 				[0] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1268092800
 					)
 
 				[1] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1268006400
 					)
 
 				[2] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267920000
 					)
 
 				[3] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267833600
 					)
 
 				[4] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267747200
 					)
 
 				[5] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267660800
 					)
 
 				[6] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267574400
 					)
 
 				[7] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267488000
 					)
 
 				[8] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267401600
 					)
 
 				[9] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267315200
 					)
 
 				[10] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267228800
 					)
 
 				[11] => Array
 					(
 						[day_count] => 1
 						[day_count_ip] => 1
 						[times] => 1267142400
 					)
 
 			)
 */
 public static function get_day_list($statking_id, $limit = NULL, $offset = NULL)
 {
     /*
     			$demo = Array
     			(
     				'0' => Array
     					(
     						'day_count' => 1212,
     						'day_count_ip' => 321,
     						'times' => 1268092800
     					),
     				'1' => Array
     					(
     						'day_count' => 989,
     						'day_count_ip' => 312,
     						'times' => 1268006400
     					),
     				'2' => Array
     					(
     						'day_count' => 321,
     						'day_count_ip' => 213,
     						'times' => 1267920000
     					),
     				'3' => Array
     					(
     						'day_count' => 1021,
     						'day_count_ip' => 509,
     						'times' => 1267833600
     					),
     				'4' => Array
     					(
     						'day_count' => 743,
     						'day_count_ip' => 231,
     						'times' => 1267747200
     					),
     				'5' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 128,
     						'times' => 1267660800
     					),
     				'6' => Array
     					(
     						'day_count' => 523,
     						'day_count_ip' => 321,
     						'times' => 1267574400
     					),
     				'7' => Array
     					(
     						'day_count' => 807,
     						'day_count_ip' => 409,
     						'times' => 1267488000
     					),
     				'8' => Array
     					(
     						'day_count' => 232,
     						'day_count_ip' => 123,
     						'times' => 1267401600
     					),
     				'9' => Array
     					(
     						'day_count' => 410,
     						'day_count_ip' => 240,
     						'times' => 1267315200
     					),
     				'10' => Array
     					(
     						'day_count' => 199,
     						'day_count_ip' => 99,
     						'times' => 1267228800
     					),
     				'11' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 120,
     						'times' => 1267142400
     					),
     				'12' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 120,
     						'times' => 1267142400
     					),
     				'13' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 120,
     						'times' => 1267142400
     					),
     				'14' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 120,
     						'times' => 1267142400
     					),
     				'15' => Array
     					(
     						'day_count' => 213,
     						'day_count_ip' => 120,
     						'times' => 1267142400
     					)
     				);
     		return $demo;
     */
     $post_url = "http://stat.abizark.com/index/day_list";
     $post_var = "statking_id=" . $statking_id . "&limit=" . $limit . "&offset=" . $offset;
     $result = tool::curl_pay($post_url, $post_var);
     $res = unserialize(stripcslashes($result));
     if (is_array($res)) {
         return $res;
     } else {
         return false;
     }
 }