flagflag  

Re: LoadUrl Money

List posts in the topic

なし Re: LoadUrl Money

msg# 1.5.1
depth:
2
Previous post - Next post | Parent - No child | Posted on 2012/2/21 15:44
milo  Not too shy to talk   Posts: 30
Hi Guy,

Here are the changes I make to be able to work with a key to security for the payment module.

sorry for the tag code, but it would nl2br() power that can be read ^^

First create table mysql:

CREATE TABLE IF NOT EXISTS `openmoney` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`avname` varchar(255) NOT NULL,
`avkey` char(36) NOT NULL,
`token` char(40) NOT NULL,
`virtualm` int(11) NOT NULL,
`realm` double NOT NULL DEFAULT '0',
`status` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=67 ;


Next modify opensim.mysql.php
add this function:

function opensim_set_avatar_session($name, $uuid,$token,$amount,$cout, &$db=null)
{
global $OpenSimVersion;

if (!isGUID($uuid)) return null;

if (!is_object($db)) $db = & opensim_new_db();
if ($OpenSimVersion==null) opensim_get_db_version($db);

$firstname = null;
$lastname = null;
$fullname = null;

if ($db->exist_table('openmoney')) {
$db->query("INSERT INTO openmoney SET avname='$name',avkey='$uuid',token='$token',virtualm='$amount',realm='$cout'");
$errno = $db->Errno;
}

return $errno;
}

On helper.php
edit this function "add_money":

function add_money($agentID, $amount, $prix, $avname, $secureID=null)
{
if (!isGUID($agentID)) return false;

//
if (!USE_CURRENCY_SERVER) {
env_set_money_transaction(null, $agentID, $amount, 5010, 0, "Buy Money", 0, 0, "");
$res["success"] = true;
return $res;
}

//
// XML RPC to Region Server
//
if (!isGUID($secureID, true)) return false;

$results = opensim_get_server_info($agentID);
$serverip = $results["serverIP"];
$httpport = $results["serverHttpPort"];
$serveruri = $results["serverURI"];
if ($serverip=="") return false;

$results = opensim_get_avatar_session($agentID);

$sessionID = $results["sessionID"];
$token = sha1($sessionID.":".uniqid(time()));
$retour = opensim_set_avatar_session($avname,$agentID,$token,$amount,$prix); //// <------------------------ ADD THIS LINE
if($retour) return false; //// <------------------------ ADD THIS LINE

if ($secureID==null) $secureID = $results["secureID"];

$req = array('clientUUID'=>$agentID,
'clientSessionID'=>$sessionID,
'clientSecureSessionID'=>$secureID,
'amount'=>$amount,
'clientTokenID'=>$token); //// <------------------------ ADD THIS LINE
$params = array($req);
$request = xmlrpc_encode_request('AddBankerMoney', $params);

$response = do_call($serverip, $httpport, $serveruri, $request);
//file_put_contents("log.txt", print_r($response,true));
return $response;
}

On Currency.php
section buy_currency

if($transactionPermit){
$res = add_money($agentid, $amount,$cost,$avname, $sessionid);
if ($res["success"])
$ret = true;
if ($ret && $res["settle"])
{
}
}

svn update
On MoneyModule.cs
i have edit this section:

public XmlRpcResponse AddBankerMoneyHandler(XmlRpcRequest request, IPEndPoint remoteClient)

search :

if (dlg!=null) {
dlg.SendUrlToUser(bankerUUID, "SYSTEM", UUID.Zero, UUID.Zero, false, m_settle_message, m_settle_url);
}

replace by:

if (dlg!=null) {
dlg.SendUrlToUser(bankerUUID, "SYSTEM", UUID.Zero, UUID.Zero, false, m_settle_message, m_settle_url+(string)requestParam["clientTokenID"]);
}

after:
./runprebuild.sh && nant clean && nant
cd opensim.currency
./build.sh

On OpenSim.ini
SettlementURL = "http://www.mywebsite.com/?token="
each avatar clicking that buy the L$, will receive a LoadURL with a unique key for each transaction.

Personally I adapt this system for multiple payment system.

Enjoy !

Milo
Votes:125 Average:4.72

Posts tree

  Advanced search


Site Search

Login

Username:

Password:


Lost Password?
Register now!!

Sub Menu

mini Calendar

Last MonthMay 2024Next Month
Su Mo Tu We Th Fr Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Today

Who's Online

106 user(s) are online (6 user(s) are browsing Forum)

Members: 0
Guests: 106

more...

Access Counter

Today : 1541615416154161541615416
Yesterday : 1223912239122391223912239
Total : 2355308623553086235530862355308623553086235530862355308623553086
Powered by XOOPS Cube 2.1© 2001-2006 XOOPS Cube Project
Design by XoopsDesign.com