09-29-2011, 10:27 AM
Сделал скрипт robokassa для L2donate 0.2b, но проверить не смог т.к. нет персонального аттестата.
Надо закинуть в l2donate\lib\paymentPHP код:
<?php
if (__FILE__==$_SERVER['SCRIPT_FILENAME']) {
die ("You can't access this file directly...");
}
class robokassa {
var $sys_code = "robokassa";
var $purse = "";
var $purse_secret = "";
var $order_id = "0";
var $amount = "0.0";
var $description = "exchange operation";
var $url_success = '';
var $url_fail = '';
var $url_result = '';
var $image_path = '';
var $opts = array();
var $shp_item = "1";
function robokassa ($opts) {
$this->opts = $opts;
$this->purse = $this->get_opt('robokassa_login');
$this->purse_secret = $this->get_opt('robokassa_pass1');
}
function draw_button () {
$str = $this->purse.':'.$this->amount.':'.$this->order_id.':'.$this->purse_secret.':Shp_item='.$this->shp_item;
return '
<form method="POST" action="https://merchant.roboxchange.com/Index.aspx" onclick="this.target=\'_blank\';">
<div>
<input type="hidden" name="MrchLogin" value="'.$this->purse.'" />
<input type="hidden" name="OutSum" value="'.$this->amount.'" />
<input type="hidden" name="InvId" value="'.$this->order_id.'" />
<input type="hidden" name="Desc" value="'.$this->description.'" />
<input type="hidden" name="SignatureValue" value="'.md5($str).'" />
<input type="hidden" name="Shp_item" value="'.$this->shp_item.'" />
<input type="hidden" name="IncCurrLabel" value="PCR" />
<input type="hidden" name="Culture" value="ru" />
'.func_get_arg(0).'
<input type="image" src="'.$this->image_path.'robokassa.png" alt="'.$this->sys_code.'" />
</div>
</form>
';
}
function verify_payment () {
if (isset($_REQUEST['robokassa_v2'])) {
$str = $_REQUEST['OutSum'].':'.$_REQUEST['InvId'].':'.$this->purse_secret.':Shp_item='.$_REQUEST['Shp_item'];
if (strtoupper(md5($str))==strtoupper($_REQUEST['robokassa_v2'])) {
$this->order_id = $_REQUEST['InvId'];
$this->amount = $_REQUEST['OutSum'];
return 1; //ok
}
}
return 0;
}
function install () {
$install = array(
"INSERT INTO `{db_prefix}systems` SET sys_name='Robokassa', sys_code='robokassa'
,sys_desc='Webmoney Transfer', sys_image='./images/24.gif', sell='1'
, sys_currency='rub', sys_rate2usd='1.0', sys_fee='0.8', sys_unique='robokassa_v2'",
"INSERT INTO {db_prefix}system_opts SET sys_code='robokassa', opt_name='robokassa_login'
, opt_desc='mrh login', opt_type='text', opt_value=''",
"INSERT INTO {db_prefix}system_opts SET sys_code='robokassa', opt_name='robokassa_pass1'
, opt_desc='mrh pass1', opt_type='password', opt_value=''",
);
return $install;
}
function get_opt ($opt_name) {
return $this->opts[$opt_name];
}
}
?>
robokassa.class.zip
Если нашли ошибку отпишитесь.
Это в l2donate\client\skin\images\payment\robokassa.png