예제 #1
0
파일: codapay.php 프로젝트: helenseo/pay
 private function _initTxn()
 {
     $request = new InitTxnRequest();
     $request->apiKey = $this->apiKey;
     $request->orderId = $this->order['order_sn'];
     $request->country = $this->country;
     $request->currency = $this->currency;
     // $request->payType = $this->payType;
     $request->payType = $this->order['method_id'];
     //Carrier Billing : 1, ATM Transfers : 2,OTC Payment : 3
     $itemList = array();
     $item = new ItemInfo();
     $item->name = 'Item_' . $this->order['pay_amount'];
     $item->price = $this->order['pay_amount'];
     $item->code = 'Item_' . $this->order['pay_amount'];
     $item->type = '';
     array_push($itemList, $item);
     $request->items = $itemList;
     log_message('gash', 'codapay initTxn request parameter : ' . json_encode($request));
     $result = CodaUtil::initTxn($request);
     log_message('gash', 'codapay initTxn response result  : ' . json_encode($result));
     //插入外部订单号
     $orderInfo = array('order_sn' => $this->order['order_sn'], 'tradeseq' => $result->txnId);
     $this->CI->pay_model->update_order_by_order_sn($orderInfo);
     echo $result->txnId;
 }
예제 #2
0
파일: InitTxn.php 프로젝트: helenseo/pay
<?php

include 'coda/CodaUtil.php';
include 'coda/InitTxnRequest.php';
$request = new InitTxnRequest();
$request->country = CodaUtil::country();
$request->currency = CodaUtil::currency();
$request->orderId = (string) round(microtime(true) * 1000);
$request->apiKey = CodaUtil::apiKey();
$request->payType = CodaUtil::payType();
//log_message('info', 'The purpose of some variable is to provide some value.');
$request->items = CodaUtil::getItems($_REQUEST);
$result = CodaUtil::initTxn($request);
//r_dump(json_encode($result)); die();
echo $result->txnId;