Service.php 1.56 KB
<?php

require_once('lib/chinabank_utf8.MotoClient.php');

class QCPay_Utils_Motopay_Service
{
	
	//var $motoClient;

	
	function __construct()
	{		
		//$myConfig = json_decode($paymentParams["pay_params"]) ;
//		/$this->motoClient = new MotoClient ();
		//$this->motoClient->setMerchantTerminalAndKey($myConfig->merchant_id, $myConfig->other_code, $myConfig->merchant_key);	
	}

	function consumeF()
		{$motoClient = new MotoClient();
		 // $motoClient->setMerchantTerminalAndKey('20003518', '8', 'test'); 
		$result = $motoClient->consume("", $_POST['cardid'], $_POST['month'].$_POST['year'], $_POST['money'], array('name'=>$_POST['name'], 'idcard'=>$_POST['idcard'], 'cvv2'=>$_POST['cvv'], 'mobile'=>'139', 'note'=>'nothing'));
		echo "oid: {$result[$motoClient->MOTO_KEY_OID]},<br/> authcode: {$result[$motoClient->MOTO_KEY_AUTHID]},<br/>";
		echo "result: {$result[result]}<br/>";
		echo "bankname: {$result[$motoClient->MOTO_KEY_BANKNAME]},<br/>";
		echo "cardname: {$result[$motoClient->MOTO_KEY_CARDNAME]},<br/>";
		echo 'error msg: '.iconv('UTF-8', 'GBK', $result[$motoClient->MOTO_KEY_ERROR_CN]).',<br/>';
		echo "The end <br/>";
		
		$str_utf = $result[$motoClient->MOTO_KEY_ERROR_CN];
		$str_gbk = iconv('UTF-8', 'GBK', $str_utf);
		echo "utf8: '$str_utf'<br/>";
		echo "gbk: '$str_gbk'<br/>";
		echo '00: '.($str_utf == $str_utf).'<br/>';
		echo '01: '.($str_utf != $str_gbk).'<br/>';
		echo 'md5($str_utf): "'.md5($str_utf).'"<br/>';
		echo 'md5($str_gbk): "'.md5($str_gbk).'"<br/>';
		echo '02: '.( md5($str_utf) != md5($str_gbk) ).'<br/>';
		}
	}