public function ask_payment_again() { //其他补救脚本方法,非正式功能 $COID = $this->input->get('order_sn'); $AMOUNT = $this->input->get('amount'); $CUID = $this->input->get('currency'); $data['pay_type_id'] = 7; $data['method_id'] = 1; //由于method_id = 1, 2是的商家信息是一样的。所以此处可以这么写,但是我不知道是谁写的 $this->initial_merchant_data($data); $trans = new Trans(null); $this->trans->k = $this->k; $this->trans->v = $this->v; $this->trans->p = $this->p; // 交易訊息代碼 $trans->nodes["MSG_TYPE"] = "0500"; // 請款請使用 0500 // 交易處理代碼 $trans->nodes["PCODE"] = "300000"; // 一般交易請使用 300000, 月租交易請使用 303000, 月租退租請使用 330000 // 商家遊戲代碼 $trans->nodes["CID"] = $this->cid; // 商家訂單編號 $trans->nodes["COID"] = $COID; // 幣別 ISO Alpha Code $trans->nodes["CUID"] = $CUID; // 付款代收業者代碼 $trans->nodes["PAID"] = 'COPGAM02'; // "COPGAM02" gash点数卡储值,浏览器通用 // 交易金額 $trans->nodes["AMOUNT"] = $AMOUNT; // 以商家密碼、商家密鑰 I , II ( 已於 Common.php 內設定 ) 取得 ERQC $erqc = $trans->GetERQC($this->trans->p, $this->trans->k, $this->trans->v); // 商家請款驗證壓碼 $trans->nodes["ERQC"] = $erqc; // 取得送出之交易資料 $data = $trans->GetSendData(); $origin_transData = $data; $log_res['step'] = 'ask_payment_request_again'; //请款request $log_res = json_encode($log_res); log_message('gash', $log_res); try { // 設定請款服務位置 $serviceURL = "https://api.eg.gashplus.com/CP_Module/settle.asmx?wsdl"; // $serviceURL = "https://stage-api.eg.gashplus.com/CP_Module/settle.asmx?wsdl"; // 進行請款 $client = new SoapClient($serviceURL); $result = $client->getResponse(array("data" => $origin_transData)); // 取得結果 $transData = $result->getResponseResult; //请款的回传结果 $log_res = array(); $log_res['data'] = $transData; $log_res['step'] = 'ask_payment_response_again'; $log_res = json_encode($log_res); log_message('gash', $log_res); // 解析回傳結果 $this->trans = new Trans($transData); $this->trans->k = $this->k; $this->trans->v = $this->v; $this->trans->p = $this->p; $isSuccess = $this->trans->nodes["RCODE"] == "0000"; $isCorrect = false; if ($isSuccess) { // 檢核 GPS 請款驗證壓碼 $isCorrect = $this->trans->VerifyERPC($this->trans->k, $this->trans->v); if ($isCorrect) { $get_payment_order['order_sn'] = $this->trans->nodes["COID"]; $update_to_get_payment_res = $this->CI->payorder->update_order_to_get_payment($get_payment_order); if (!$update_to_get_payment_res) { $ask_res['res_msg'] = '更新訂單至請款成功步驟失敗'; return $ask_res; } $condition['recharge_id'] = $this->trans->nodes["COID"]; $recharge_info = $this->CI->pay_model->get_recharge_order($condition['recharge_id']); $offer_data_res = $this->offer_service($recharge_info->order_sn, $recharge_info->game_id); //在游戏中发放元宝 if (!$offer_data_res['status']) { $ask_res['res_msg'] = '發放元寶失敗'; return $ask_res; } $offer_order = array(); $offer_order['order_sn'] = $recharge_info->order_sn; $this->CI->payorder->update_order_to_offer_service($offer_order); $ask_res['res'] = TRUE; return $ask_res; } else { $ask_res['res_msg'] = ' GPS 請款驗證壓碼錯誤'; return $ask_res; } } else { $ask_res['res_msg'] = $this->trans->recvDesc; return $ask_res; } } catch (Exception $ex) { $transData = ""; } }