Example #1
0
 private function _pro_initial()
 {
     $gsmOperator = 0;
     if ($this->order['method_id'] == 3) {
         $gsmOperator = 20;
     }
     $extra = '';
     if ($this->order['method_id'] == 2) {
         $extra = '3pay=true&cconly=true';
     } else {
         if ($this->order['method_id'] == 3) {
             $extra = 'wap=true';
         }
     }
     $token = array('UserCode' => $this->usercode, 'Pin' => $this->pin);
     $res_arr = $this->pay_model->get_currency_by_id($this->order['currency']);
     $currency = $res_arr[0]['currency_name'];
     $productList['MSaleProduct'] = array('ProductId' => 0, 'ProductCategory' => 2, 'ProductDescription' => $this->order['yuanbao_amount'] . " Gold", 'Price' => $this->order['pay_amount'], 'Unit' => 1);
     $input = array('MPAY' => $this->order['order_sn'], 'Content' => $this->order['pay_amount'] . ' ' . $currency . " for " . $this->order['yuanbao_amount'] . " Gold", 'SendOrderResult' => 'True', 'PaymentTypeId' => 1, 'ReceivedSMSObjectId' => '00000000-0000-0000-0000-000000000000', 'ProductList' => $productList, 'SendNotificationSMS' => 'True', 'OnSuccessfulSMS' => $this->recharge_lang['recharge_success'] . ' ' . $this->order['yuanbao_amount'] . " Gold", 'OnErrorSMS' => $this->recharge_lang['ask_to_try'], 'RequestGsmOperator' => $gsmOperator, 'RequestGsmType' => 0, 'Url' => 'http://' . PAY_URL, 'SuccessfulPageUrl' => 'http://' . PAY_URL . '/threepay/successfulPage', 'ErrorPageUrl' => 'http://' . PAY_URL . '/threepay/errorPage', 'Country' => $this->country == '' ? 'TR' : $this->country, 'Currency' => $currency == '' ? 'TRY' : $currency, 'Extra' => $extra, 'TurkcellServiceId' => $this->TurkcellServiceId);
     $source = array('token' => $token, 'input' => $input);
     $log_array = array('type' => '3pay pro request', 'value' => $source);
     log_message('gash', json_encode($log_array));
     $soap = new SoapClient($this->url . '?wsdl');
     $response = $soap->SaleWithTicket($source);
     $log_array = array('type' => '3pay pro response', 'value' => $response);
     log_message('gash', json_encode($log_array));
     $result = $response->SaleWithTicketResult;
     $update_order = array('order_sn' => $this->order['order_sn'], 'auth_code' => $result->TicketObjectId);
     $this->CI->pay_model->update_order_by_order_sn($update_order);
     if ($result->StatusCode == 0) {
         redirect($result->RedirectUrl);
     } else {
         $msg = $this->recharge_lang['ask_to_try'];
         $message = $result->ErrorMessage . "</br>" . $msg;
         $this->CI->payorder->over($message);
         exit;
     }
 }