Additional modules of payment systems

From ISPWiki

Jump to: navigation, search

Payment systems are described in the following BILLmanager modules:


1. The Company management module ->Payment methods for administrators;
2. The Credits/Payments module for customers.

To add a custom payment interface:

  • create a program or script to fill out and handle form fields, as well as start the payment process, if necessary;
  • create an xml document describing the interface elements and text messages in different languages;
  • create CGI scripts and programs to exchange data with payment gateways, if necessary.

Contents

XML-document

Locate the XML document in /usr/local/ispmgr/etc and name it as billmgr_mod_xxx.xml, where xxx is a random name, for example, test (billmgr_mod_test.xml). The document should be encoded in the UTF-8 character set:

 <?xml version="1.0" encoding="UTF-8"?>
 <mgrdata>
   <metadata name="company.paymethod.edit_XXX" type="form">
     <form>
       <field name="name">
         <input type="text" name="name" empty="no"/>
       </field>
       <field name="minamount">
         <input type="text" name="minamount"/>
       </field>
       ----the filds you need----
     </form>
       <jscript>
               document.frm.func.value = 'company.paymethod.edit';
       </jscript>
   </metadata>
   <metadata name="credit.pay.XXX" type="form">
     <form>
       <field name="amount">
         <input type="text" name="amount" readonly="yes"/>
       </field>
       ----the fields you need----        
       <field name="merchantfield">  If you use a link to the payment system web-site
         <link name="merchant"/>
       </field>
     </form>
     <jscript>  If you use a link to the payment system web-site
       function GoMerchant(id, lnk) {
         window.open('/mancgi/testcgi?elid='+id);
         if (lnk) {
           lnk.className = 'disabled';
           lnk.onclick = function () { return false; }
         }
       }
     </jscript>
   </metadata>
   <lang name="en">
     <messages name="credit.pay.XXX">
       <msg name="amount">Amount</msg>
       <msg name="merchant">Pay now</msg>
       <msg name="title">XXX pay method</msg>
       <msg name="hint_default">Fill form</msg>
       <msg name="hint_amount">Amount</msg>
       ---other messages----
     </messages>
   </lang>
 </mgrdata>

XXX is the internal name of a payment system. It is strongly recommended that messages are described in English, otherwise other languages may not be created. The merchant field is required if you want to use a link to the web-site.

Handler program

The program or script should locate in the /usr/local/ispmgr/sbin/ directory. The file's name should start with the pm symbols. The symbols following pm is the internal name of a payment system used by the interface elements. When started with the feature parameter, the program must return a list of supported features space separated.

List of features

pmtune The program will modify the payment method edit form. It is used to provide required data. BILLmanager passes the XML-document describing the form to STDIN and waits for the modified XML-document to be returned to STDOUT.

pmvalidate The program will verify the data provided by user. BILLmanager passes the XML-document containing the form fields to STDIN. If the field name is param1, param2 b param3, the XML will be as follows:

 <?xml version="1.0" encoding="UTF-8"?>
 <doc>
   <param1>value</param1>
   <param2>value</param2>
   <param3>value</param3>
 </doc>

If all of the parameters have correct values, the program will send pmok to STDOUT, otherwise Error: parameter_name will return. If a success, BILLmanager will record parameters in the same XML-form into the params field of the companycrtype table. You can use these data when creating payments.

crtune The program will edit the add payment form. It is used to provide required values. For details see "pmtune".

crvalidate The program will check the data provided by user when making a payment. For details see "pmvalidate".

crget The program will fill out the add new payment form. It is used to enter data from the database into the payment edit form. For details see "pmtune".

crset It is used if a user is not required to go to the payment system's web-site and the payment is made basing on the input data. BILLmanager uses this method when making payments via WebMoney and Ogone. It is based on the LongTask system. In case of the errors, the following warning message will be shown:

 crid payment_code error_description

The yellow banner will be displayed:

 An error occurred while making payment. Id: 'payment_id' Error: 'error message'. Edit the incorrect data or contact the Support center. 

You can add funds to a personal account by starting

 /usr/local/ispmgr/sbin/mgrctl -m billmgr credit.setpaid elid=payment_id info="data to be saved"

Cgi program

If you want to exchange data with a payment system, create CGI programs and locate them in /usr/local/ispmgr/cgi The URL is https://your_domain/mancgi/XXX, where XXX is a file name. We do not provide examples of CGI program, as you can find them on the Internet.

Database structure

The following is the list of tables you may need when creating a module:

1. companycrtype - table containing the information about a payment method. It has the following rows:
1.1 id - payment method id;
1.2 currency - currency. Link to the currency table;
1.3 minamount - minimum payment amount;
1.4 params - XML-document with data provided in the form;

2. credit - table containing payments. The rows:
2.1 id - payment id;
2.2 nativeamount - currency amount;
2.3 state - current payment status;
2.4 userinfo - XML-document with data provided in the form;
2.5 info - information related to the payment.

The tables may contain more rows, but they are not for public use.

Example on Perl

Example of executable files

The following example contains test functions that you may need when creating a payment interface. You will need XML::LibXML and Mysql modules. The file name is pmtest. This example does not implement any protocol, but shows the features that can be realized if our system is used.
Brief description:
The main part is used to specify how the process was started, either as the LongTask or not. Thus, the functions may start in different ways.
pmtune - defines how you can fill out the select with values. pmvalidate - check that testinput includes "test". Otherwise, an error will return. crtune - see pmtune. crget - selects values from the database to paste them into the form.

Provide a script interpreter:

#!/usr/bin/perl
no warnings;

Enable the libraries:

use XML::LibXML;
use Mysql;
use Env;

Open the log file to add new records:

open(DEBUG, ">>/tmp/debug.log");

Select the error check box (change into 1 if an error occurs):

$errflg = 0;

Process the command that was passed to the module:

foreach $x(@ARGV) { 
   if ($x eq "pmtune"){
      pmtune();
   }
   if ($x eq "feature"){
     print "pmtune pmvalidate crtune crget crset";
   }
   if ($x eq "pmvalidate"){
     pmvalidate();
   }	
   if ($x eq "crtune"){
     crtune();
   }
   if ($x eq "crget"){
     crget();
   }
   if ($x eq "crset"){
     crset();
   }
}

Process

if ($env{"MGR_LT_PID"}) {
   if ($errflg) {
     system "/usr/local/ispmgr/sbin/mgrctl -m billmgr longtask.finish elid=".$env{"MGR_LT_PID"}." status=ok";
   } else {
     system "/usr/local/ispmgr/sbin/mgrctl -m billmgr longtask.finish elid=".$env{"MGR_LT_PID"}." status=err errmsg='Error message'";
   }
}

Close the log file:

close(DEBUG);

Return the XML file that was sent to STDIN:

sub GetInputXml(){
   my $input;
   my $buf = <STDIN>;
   while($buf) {
     $input = "$input$buf";
     $buf = <STDIN>;
   }
   return $input;
}

Check the parameters that were passed:

sub pmvalidate{
   my $parser = XML::LibXML->new();
   my $xml = $parser->parse_string(GetInputXml());
   @testinput = $xml->getElementsByTagName('testinput');
   print DEBUG $testinput[0]->textContent;
   if($testinput[0]->textContent eq "test"){
     print "pmok";
   } else {
     print "Error: testinput";
   }
}

Get an XML of the payment method edit form from STDIN, add values and return the XML form of the file:

sub pmtune{
   my $input = GetInputXml;
   my $parser = XML::LibXML->new();
   my $xml = $parser->parse_string($input);
   my $root = $xml->getDocumentElement();
   my $elem2 = $xml->createElement("slist");
   $elem2->setAttributeNode($xml->createAttribute("name","testselect")); 
   my $slist1=$xml->createElement("msg");
   $slist1->appendText( "select_1");
   $elem2->appendChild($slist1);
 
   my $slist2=$xml->createElement("msg");
   $slist2->appendText( "select_2");
   $elem2->appendChild($slist2);
 
   my $slist3=$xml->createElement("msg");
   $slist3->appendText( "select_3");
   $elem2->appendChild($slist3);
   $root->appendChild($elem2);
 
   #print DEBUG $root->toString;
   print $root->toString;
}

Get the XML of the payment creation form from STDIN, edit and return the XML form of the file:

sub crtune{
   my $input = GetInputXml;   
   my $parser = XML::LibXML->new();
   my $xml = $parser->parse_string($input);
   my $root = $xml->getDocumentElement();
   my $elem2 = $xml->createElement("slist");
   $elem2->setAttributeNode($xml->createAttribute("name","testselect")); 
   my $slist1=$xml->createElement("msg");
   $slist1->appendText( "select_1");
   $elem2->appendChild($slist1);
 
   my $slist2=$xml->createElement("msg");
   $slist2->appendText( "select_2");
   $elem2->appendChild($slist2);
 
   my $slist3=$xml->createElement("msg");
   $slist3->appendText( "select_3");
   $elem2->appendChild($slist3);
 
 
   $root->appendChild($elem2);
 
   #print DEBUG $root->toString;
   print $root->toString;
}

Get the XML of the payment creation form from STDIN, add the values from the database and return the XML form of the file:

sub crget{
   my $input = GetInputXml;  
   my $parser = XML::LibXML->new();
   my $xml = $parser->parse_string($input);
   my $root = $xml->getDocumentElement();
   my @xelid = $xml->getElementsByTagName('elid');
   #print DEBUG $xelid[0]->textContent;
   my $elid = $xelid[0]->textContent;
   $user = "root";
   $password = "1";
   $database = "billmgr";
   $host = "localhost";
   my $query="select cr.nativeamount, cr.state, cu.iso, type.params from credit cr \
        join companycrtype type on type.id=cr.type join currency cu on cu.id=type.currency where cr.id=$elid";
   $dbh = Mysql->Connect($host,$database,$user,$password);
   $sth = $dbh->Query($query);
   @arr = $sth->FetchRow;
   my $elem = $xml->createElement("amount");
   $elem->appendText("$arr[0] $arr[2]");
   $root->appendChild($elem);
   if($arr[1] eq "4"){
     $elem = $xml->createElement("merchant");
     $elem->appendText("GoMerchant($elid, this); return false;");
     $root->appendChild($elem);
   } else {
 	#$root->removeChild($xml->findnodes("//field/merchantfield"));
   }
    print $root->toString;
}

Payment handler (if a module is used for handling):

sub crset(){
   print DEBUG "\nin crset\n";
   print DEBUG "credit id: $ltparams[2]";
   return "crid $ltparams[2] Test error";	
}

Example of the XML-document

 <?xml version="1.0" encoding="UTF-8"?>
 <mgrdata>
   <metadata name="company.paymethod.edit_test" type="form">
     <form>
       <field name="name">
         <input type="text" name="name" empty="no"/>
       </field>
       <field name="minamount">
         <input type="text" name="minamount"/>
       </field>
       <field name="testselect">
         <select name="testselect"/>
       </field>
       <field name="testinput">
         <input type="text" name="testinput"/>
       </field>
     </form>
     <jscript>
       document.frm.func.value = 'company.paymethod.edit';
     </jscript>
   </metadata>
   <metadata name="credit.pay.test" type="form">
     <form>
       <field name="amount">
         <input type="text" name="amount" readonly="yes"/>
       </field>
       <field name="testselect">
         <select name="testselect"/>
       </field>
         <field name="merchantfield">
       <link name="merchant"/>
         </field>
     </form>
     <jscript>
       function GoMerchant(id, lnk) {
         window.open('/mancgi/testcgi?elid='+id);
         if (lnk) {
           lnk.className = 'disabled';
           lnk.onclick = function () { return false; }
         }
       }
     </jscript>
   </metadata>
   <lang name="en">
     <messages name="credit.pay.test">
       <msg name="amount">Amount</msg>
       <msg name="merchant">pay now</msg>
       <msg name="testselect">Testselect</msg>
       <msg name="title">Test pay method</msg>
       <msg name="hint_default">Fill form</msg>
       <msg name="hint_amount">Amount</msg>
     </messages>
   </lang>
 </mgrdata>

Example on PHP

The below example describes a PayPal module written on PHP.

Example of executable files

File pmpaypal.php

The file, which is the main file of the payment module, is located in the /usr/local/ispmgr/sbin/ directory. The module validates the merchant's email when configuring the payment module, and provides the payment amount in the payment form.

#!/usr/bin/php
<?php
	$LOG_FILE = fopen("/usr/local/ispmgr/var/pmpaypal.php.log", "a");

	function Debug($log_str) {
           fwrite($GLOBALS["LOG_FILE"], date("M d H:i:s")." [".posix_getpid()."] ".$log_str."\n");
	}

	function defErrorHandler($errno, $errstr, $errfile, $errline) {
		if (!(error_reporting() & $errno)) {
			return;
		}
		Debug($errfile.":".$errline." Error: ".$errno.", error message: ".$errstr);
		return true;
	}
       
       class DB extends mysqli {
           public function __construct($host, $user, $pass, $db) {
               parent::init();
               if (!parent::options(MYSQLI_INIT_COMMAND, "SET AUTOCOMMIT = 0")) {
                   die("MYSQLI_INIT_COMMAND installation failed");
               }
               if (!parent::options(MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
                   die("MYSQLI_OPT_CONNECT_TIMEOUT installation failed");
               }
               if (!parent::real_connect($host, $user, $pass, $db)) {
                   die("Connection error (".mysqli_connect_errno().") ".mysqli_connect_error());
               }
               Debug("MySQL connection established");
           }
           
           public function __destruct() {
               parent::close();
               Debug("MySQL connection closed");
           }
       }
       
       function DBConnect() {
           $config = file_get_contents("/usr/local/ispmgr/etc/billmgr.conf");
           $lines = explode("\n", $config);
           $params = array();
           $params["DBHost"] = "localhost";
           $params["DBUser"] = "root";
           $params["DBName"] = "billmgr";
           foreach ($lines as $line) {
               $param_line = preg_split("/\s+/", $line, 2);
               if (count($param_line) == 2) {
                   $params[$param_line[0]] = $param_line[1];
               }
           }
           
           return new DB($params["DBHost"], $params["DBUser"], $params["DBPassword"], $params["DBName"]);
       }
       
       function GetInput() {
           return file_get_contents("php://stdin");
       }

       function PMValidate() {
           $input = GetInput();
           Debug("input: ".$input);
           $pm_params = new SimpleXMLElement($input);
           if (!filter_var((string)$pm_params->aemail, FILTER_VALIDATE_EMAIL)) {
               echo "aemail";
           } else {
               echo "pmok";
           }
       }
       
       function CRGet() {
           $db = DBConnect();
           $input = GetInput();
           Debug("input: ".$input);
           $cr_params = new SimpleXMLElement($input);
           $res = $db->query("select concat(cr.nativeamount, ' ', cu.iso) from credit cr join companycrtype type on type.id=cr.type join currency cu on cu.id=type.currency where cr.id=".(string)$cr_params->elid);
           $res_array = $res->fetch_array();
           $cr_params->addChild("amount", $res_array[0]);
           $res->close();
           echo $cr_params->asXML();
       }

       function CRTune() {
           $db = DBConnect();
           $input = GetInput();
           Debug("input: ".$input);
           $cr_params = new SimpleXMLElement($input);
           $res = $db->query("select cr.state from credit cr where cr.id=".(string)$cr_params->elid);
           $res_array = $res->fetch_array();
           if ($res_array[0] == "4") {
               $cr_params->metadata->form->addAttribute("nosubmit", "yes");
           }
           $res->close();
           echo $cr_params->asXML();
       }

	set_error_handler("defErrorHandler");

       $request_str = "";
       foreach ($argv as $arg) {
           $request_str .= $arg;
       }
       
       Debug("Request: ".$request_str);
       $cmd = ($argc > 1 ? $argv[1] : "");
       Debug("Command: ".$cmd);
       
       switch ($cmd) {
           case "feature":
               echo "pmvalidate crget crtune";
               break;
           case "pmvalidate":
               PMValidate();
               break;
           case "crget":
               CRGet();
               break;
           case "crtune":
               CRTune();
               break;
       }
?>

The filr paypalpayment.php

The file is located in the /usr/local/ispmgr/cgi/ directory and redirects a user to the payment form. The html form is generated. It is not displayed to a client, but is sent automatically by the specified address once the page is loaded.

#!/usr/bin/php
<?php
   echo "Content-type: text/html\n\n";

   $LOG_FILE = fopen("/usr/local/ispmgr/var/paypalpayment.php.log", "a");
   
   function Debug($log_str) {
       fwrite($GLOBALS["LOG_FILE"], date("M d H:i:s")." [".posix_getpid()."] ".$log_str."\n");
   }
   
   function defErrorHandler($errno, $errstr, $errfile, $errline) {
       if (!(error_reporting() & $errno)) {
           return;
       }
       Debug($errfile.":".$errline." Error: ".$errno.", error message: ".$errstr);
       return true;
   }
   
   function GetMgrObject($func, $elid, $auth) {
       Debug("execute: ".$func.", elid: ".$elid);
       $out = shell_exec("/usr/local/ispmgr/sbin/mgrctl -m billmgr -o json ".$func." elid=".$elid.($auth != "" ? " auth=".$auth : ""));
       Debug($out);
       return json_decode($out);
   }

   set_error_handler("defErrorHandler");
   
   if($_SERVER['REQUEST_METHOD'] == 'POST'){
       $input = file_get_contents("php://stdin");
   }elseif($_SERVER['REQUEST_METHOD'] == 'GET'){
       $input = $_SERVER['QUERY_STRING'];
   }
   
   $param = array();
   parse_str($input, $param);
   
   $auth = "";
   $lang = "";
   
   if (isset($param["auth"])) {
       Debug("by auth param");
       $auth = $param["auth"];
   } elseif (isset($_COOKIE["billmgr4"])) {
       Debug("by standart cookie");
       $cookie = $_COOKIE["billmgr4"];
       $cookie_param = explode(":", $cookie);
       $lang = $cookie_param[1];
       $auth = $cookie_param[2];
   } elseif (isset($_SERVER["HTTP_COOKIE"])) {
       Debug("by server cookie");
       $cookies = explode("; ", $_SERVER["HTTP_COOKIE"]);
       foreach ($cookies as $cookie) {
           $param_line = explode("=", $cookie);
           if (count($param_line) > 1 && $param_line[0] == "billmgr4") {
               $cookies_bill = explode(":", $param_line[1]);
               $lang = $cookies_bill[1];
               $auth = $cookies_bill[2];
           }
       }
   }
    
   if ($auth == "") {
       echo "Not authorized";
       exit();
   }
   
   $credit = GetMgrObject("credit.info", $param["elid"], $auth);
   
   $url = $credit->{"posturl"};
   $amount = $credit->{"nativeamount"};
   $currency = $credit->{"typecurrency"};
   $logourl = $credit->{"logourl"};
   $merchant_email = $credit->{"aemail"};

   echo "<html>\n";
   echo "<head>\n\t<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n";
   echo "\t<link rel='shortcut icon' href='billmgr.ico' type='image/x-icon'/>\n";
   echo "\t<script language='JavaScript'>\n";
   echo "\t\tfunction SubmitForm() {\n";
   echo "\t\t\tvar loc = location.host;\n";
   echo "\t\t\tdocument.ppform.notify_url.value = loc+'/mancgi/paypalresult.php';\n";
   echo "\t\t\tdocument.ppform.return.value = loc+'/manimg/userdata/paysuccess_".$lang.".html';\n";
   echo "\t\t\tdocument.ppform.cancel_return.value = loc+'/manimg/userdata/payfail_".$lang.".html';\n";
   echo "\t\t\tdocument.ppform.submit();\n";
   echo "\t\t}\n";
   echo "\t</script>\n";
   echo "</head>\n";
   echo "<body onload='SubmitForm()'>\n";
   echo "\t<form name='ppform' action='".$url."' method='post'>\n";
   echo "\t\t<input type='hidden' name='cmd' value='_xclick'>\n";
   echo "\t\t<input type='hidden' name='business' value='".$merchant_email."'>\n";
   echo "\t\t<input type='hidden' name='item_name' value='Advance payment #".$param["elid"]."'>\n";
   echo "\t\t<input type='hidden' name='item_number' value='".$param["elid"]."'>\n";
   echo "\t\t<input type='hidden' name='invoice' value='".$param["elid"]."'>\n";
   echo "\t\t<input type='hidden' name='amount' value='".$amount."'>\n";
   echo "\t\t<input type='hidden' name='currency_code' value='".$currency."'>\n";
   echo "\t\t<input type='hidden' name='no_shipping' value='1'>\n";
   echo "\t\t<input type='hidden' name='no_note' value='1'>\n";
   echo "\t\t<input type='hidden' name='notify_url' value=>\n";
   echo "\t\t<input type='hidden' name='return' value=>\n";
   echo "\t\t<input type='hidden' name='cancel_return' value=>\n";
   echo "\t\t<input type='hidden' name='lc' value='".$lang."'>\n";
   if ($logourl != "") {
       echo "\t\t<input type='hidden' name='image_url' value='".$logourl."'>\n";
   }
   echo "\t</form>\n";
   echo "</body>\n";
   echo "</html>\n"; 
?>


The file paypalresult.php

The file is located in the /usr/local/ispmgr/cgi/ directory and processes incoming IPN messages from PayPal to verify data received and then sends them to the Paypal server for validation. Payment amount is also checked. Once the data is verified, the corresponding status is set.

#!/usr/bin/php
<?php
   echo "Content-type: text/html\n\n";
   
   $LOG_FILE = fopen("/usr/local/ispmgr/var/paypalresult.php.log", "a");
   
   function Debug($log_str) {
       fwrite($GLOBALS["LOG_FILE"], date("M d H:i:s")." [".posix_getpid()."] ".$log_str."\n");
   }
   
   function defErrorHandler($errno, $errstr, $errfile, $errline) {
       if (!(error_reporting() & $errno)) {
           return;
       }
       Debug($errfile.":".$errline." Error: ".$errno.", error message: ".$errstr);
       return true;
   }
   
   function GetMgrObject($func, $elid, $auth) {
       Debug("execute: ".$func.", elid: ".$elid);
       $out = shell_exec("/usr/local/ispmgr/sbin/mgrctl -m billmgr -o json ".$func." elid=".$elid.($auth != "" ? " auth=".$auth : ""));
       Debug($out);
       return json_decode($out);
   }
   
   function SetPaymentInfo($func, $elid, $info) {
       Debug("execute: ".$func.", elid: ".$elid);
       $out = shell_exec("/usr/local/ispmgr/sbin/mgrctl -m billmgr -o json ".$func." elid=".$elid.($info != "" ? " info=".escapeshellarg($info) : ""));
       Debug($out);
       return json_decode($out);
   }
   
   set_error_handler("defErrorHandler");
   
   if ($_SERVER['REQUEST_METHOD'] == 'POST'){
       $input = file_get_contents("php://stdin");
   } elseif ($_SERVER['REQUEST_METHOD'] == 'GET'){
       $input = $_SERVER['QUERY_STRING'];
   }
   
   Debug(print_r($_SERVER, true));
   
   Debug("input data: ".$input);
   
   $param = array();
   parse_str($input, $param);
   
   $credit_id = $param["invoice"];
   
   if ($credit_id == "") {
       echo "Epmty invoice";
   } else {
       $credit = GetMgrObject("credit.info", $credit_id, "");
       
       Debug(print_r($credit, true));
       
       $url = $credit->{"posturl"};
       $amount = $credit->{"nativeamount"};
       $merchant_email = $credit->{"aemail"};
       
       if ($param["receiver_email"] != $merchant_email) {
           echo "Invalid receiver";
           exit();
       }
       
       if ($param["mc_gross"] != $amount) {
           echo "Invalid amount";
           exit();
       }
       
       $result = file_get_contents($url."?cmd=_notify-validate&".$input);
       
       Debug($result);
       
       if ($result == "VERIFIED") {
           $payment_status = $param["payment_status"];
           
           if ($payment_status == "Completed") {
               SetPaymentInfo("credit.setpaid", $credit_id, $input);
           } else if ($payment_status == "Pending") {
               SetPaymentInfo("credit.setinpay", $credit_id, $input);
           } else if ($payment_status == "Denied") {
               SetPaymentInfo("credit.setnotpay", $credit_id, "");
           }
           echo "OK\n";
       } else {
           echo "Data not verified";
           exit();
       }
   }
?>

Example of the XML document

The billmgr_mod_paypal.php.xml file

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
	<metadata name="company.paymethod.edit_paypal.php" type="form">
		<form>
			<field name="name">
				<input type="text" name="name" empty="no"/>
			</field>
			<field name="ptype">
				<select name="ptype"/>
			</field>
			<field name="autodelete">
				<input type="text" name="autodelete"/>
				<desc name="days"/>
			</field>
			<field name="minamount">
				<input type="text" name="minamount"/>
			</field>
			<field name="priority">
				<input type="text" name="priority"/>
			</field>
			<field name="commission">
				<input type="text" name="commission"/>
				<desc name="percent"/>
			</field>
			<field name="checkpayer">
				<input type="checkbox" name="checkpayer"/>
				<desc name="checkpayerd"/>
			</field>
			<field name="posturl">
				<input type="text" name="posturl"/>
			</field>
			<field name="logourl">
				<input type="text" name="logourl"/>
			</field>
			<field name="aemail">
				<input type="text" name="aemail"/>
			</field>		
		</form>
		<jscript>
			document.frm.func.value = 'company.paymethod.edit';
		</jscript>
	</metadata>
	<metadata name="credit.pay.paypal.php" type="form">
		<form extokmsg="yes" event="yes">
			<field name="amount">
				<input type="text" name="amount" readonly="yes"/>
			</field>
		</form>
		<jscript>
		function frm_event() {
			var id = frm.elid.value;
			window.open('/mancgi/paypalpayment.php?elid='+id);
			return true;
		}
		</jscript>
	</metadata>
	<lang name="ru">
		<messages name="company.paymethod.edit">
			<msg name="paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod">
			<msg name="module_paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod.edit_paypal.php">
			<msg name="hint_name">Name of the payment method</msg>
			<msg name="days">days</msg>
			<msg name="autodelete">Period to delete overdue invoices</msg>
			<msg name="hint_autodelete">Provide a number of days that an overdue invoice will stay on the system.</msg>
			<msg name="hint_default">Enter all parameters that are required for the payment system and making a payment</msg>
			<msg name="hint_minamount">Minimum payment amount</msg>	  
			<msg name="minamount">Minimum payment amount</msg>
			<msg name="title">Properties</msg>
			<msg name="priority">Priority</msg>
			<msg name="percent">percent</msg>
			<msg name="hint_priority">Payment methods will be sorted out according to the priority. Payment methods with higher priority will stand first on the list.</msg>
			<msg name="commission">Commission</msg>
			<msg name="hint_commission">payment system commission. This amount will be charged form a customer account. </msg>
			<msg name="pperson">Individual</msg>
			<msg name="psoleproprietor">Sole proprietor</msg>
			<msg name="pcompany">Company</msg>
			<msg name="ptype">Payer status</msg>
			<msg name="hint_ptype">Select types of payers for whom the newly created payment method will be available</msg>
			<msg name="null">Any</msg>
			<msg name="checkpayerd">Check payer information</msg>
			<msg name="hint_checkpayer">If some data is missing, the user won't be able to make a payment. He will have to provide all required user information.</msg>
			<msg name="aemail">Invoice email</msg>
			<msg name="hint_aemail">Email (paypal email)</msg>
			<msg name="hint_default">Fill out the form</msg>
			<msg name="hint_logourl">Logo URL</msg>
			<msg name="hint_minamount">Minimum payment amount</msg>
			<msg name="hint_posturl">API address</msg>
			<msg name="hint_country">Define a language by the invoice's country</msg>
			<msg name="logourl">Logo (URL)</msg>
			<msg name="minamount">Minimum payment amount</msg>
			<msg name="posturl">API URL</msg>
			<msg name="title">Details</msg>
		</messages>
		<messages name="credit.pay.paypal.php">
			<msg name="msg_extokmsg">Payment</msg>
			<msg name="amount">Amount due</msg>
			<msg name="hint_amount">total amount due</msg>
			<msg name="title">PayPal PHP</msg>
			<msg name="hint_default">PayPal PHP payment form</msg>        
		</messages>
	</lang>
</mgrdata>

The file billmgr_mod_paypal.php.xml

The file is located in the /usr/local/ispmgr/etc/ directory and generates the payment method edit form and payment form. It also specifies messages that are displayed next to the fields and their translation into required languages.

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
	<metadata name="company.paymethod.edit_paypal.php" type="form">
		<form>
			<field name="name">
				<input type="text" name="name" empty="no"/>
			</field>
			<field name="ptype">
				<select name="ptype"/>
			</field>
			<field name="autodelete">
				<input type="text" name="autodelete"/>
				<desc name="days"/>
			</field>
			<field name="minamount">
				<input type="text" name="minamount"/>
			</field>
			<field name="priority">
				<input type="text" name="priority"/>
			</field>
			<field name="commission">
				<input type="text" name="commission"/>
				<desc name="percent"/>
			</field>
			<field name="checkpayer">
				<input type="checkbox" name="checkpayer"/>
				<desc name="checkpayerd"/>
			</field>
			<field name="posturl">
				<input type="text" name="posturl"/>
			</field>
			<field name="logourl">
				<input type="text" name="logourl"/>
			</field>
			<field name="aemail">
				<input type="text" name="aemail"/>
			</field>		
		</form>
		<jscript>
			document.frm.func.value = 'company.paymethod.edit';
		</jscript>
	</metadata>
	<metadata name="credit.pay.paypal.php" type="form">
		<form extokmsg="yes" event="yes">
			<field name="amount">
				<input type="text" name="amount" readonly="yes"/>
			</field>
		</form>
		<jscript>
		function frm_event() {
			var id = frm.elid.value;
			window.open('/mancgi/paypalpayment.php?elid='+id);
			return true;
		}
		</jscript>
	</metadata>
	<lang name="ru">
		<messages name="company.paymethod.edit">
			<msg name="paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod">
			<msg name="module_paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod.edit_paypal.php">
			<msg name="hint_name">Name of the payment method</msg>
			<msg name="days">days</msg>
			<msg name="autodelete">Period to delete due invoices</msg>
			<msg name="hint_autodelete">Provide period to delete due invoices.</msg>
			<msg name="hint_default">Provide data for integration with the payment system and other related data</msg>
			<msg name="hint_minamount">Minimum payment amount </msg>	  
			<msg name="minamount">Minimum payment amount</msg>
			<msg name="title">Parameters</msg>
			<msg name="priority">Priority</msg>
			<msg name="percent">percent</msg>
			<msg name="hint_priority">Payment methods will be sorted out based on priority. The higher the priority, the higher position this method will have on the drop-down menu.</msg>
			<msg name="commission">Commission</msg>
			<msg name="hint_commission">Payment system's commission. If specified, that sum will be deducted from the  client's account</msg>
			<msg name="pperson">Individual</msg>
			<msg name="psoleproprietor">Sole proprietor</msg>
			<msg name="pcompany">Company</msg>
			<msg name="ptype">Payer status</msg>
			<msg name="hint_ptype">Select a payer for whom this payment method will be available</msg>
			<msg name="null">Any</msg>
			<msg name="checkpayerd">Check payer information</msg>
			<msg name="hint_checkpayer">Selecting this check box will check that all required payer data are provided, and if not, the payment will be cancelled</msg>
			<msg name="aemail">Invoice email</msg>
			<msg name="hint_aemail">Authorized email  (paypal address)</msg>
			<msg name="hint_default">Fill out the form</msg>
			<msg name="hint_logourl">URL of the logo</msg>
			<msg name="hint_posturl">URL for accessing via API</msg>
			<msg name="hint_country">Define payment confirmation language by the country</msg>
			<msg name="logourl">Logo (URL)</msg>
			<msg name="minamount">Minimum payment amount</msg>
			<msg name="posturl">API URL</msg>
			<msg name="title">Details</msg>
		</messages>
		<messages name="credit.pay.paypal.php">
			<msg name="msg_extokmsg">Payment</msg>
			<msg name="amount">Amount due</msg>
			<msg name="hint_amount">total amount due</msg>
			<msg name="title">PayPal PHP</msg>
			<msg name="hint_default">PayPal PHP payment form</msg>        
		</messages>
	</lang>
	<lang name="en">
		<messages name="company.paymethod.edit">
			<msg name="paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod">
			<msg name="module_paypal.php">PayPal PHP</msg>
		</messages>
		<messages name="company.paymethod.edit_paypal.php">
			<msg name="hint_name">Payment method name</msg>
			<msg name="days">days</msg>
			<msg name="autodelete">Period to delete overdue invoices</msg>
			<msg name="hint_autodelete">provide period to delete due invoices</msg>
			<msg name="hint_default">Provide data for integration with the payment system and other related data</msg>
			<msg name="hint_minamount">Minimum payment amount</msg>	  
			<msg name="minamount">Minimum payment amount</msg>
			<msg name="title">Options</msg>
			<msg name="priority">Priority</msg>
			<msg name="percent">percent</msg>
			<msg name="hint_priority">Methods of payment will be arranged according to priority. The higher the priority is, the higher the payment method will be on the drop-down list.</msg>
			<msg name="commission">Commission</msg>
			<msg name="hint_commission">Commission of the payment system. If specified, the specified sum will be deducted from client's account</msg>
			<msg name="pperson">Individual</msg>
			<msg name="psoleproprietor">Sole Proprietor</msg>
			<msg name="pcompany">Company</msg>
			<msg name="ptype">Status of the payer</msg>
			<msg name="hint_ptype">Select a payer for whom that method of payment will be available</msg>
			<msg name="null">Any</msg>
			<msg name="checkpayerd">Check payer information</msg>
			<msg name="hint_checkpayer">Selecting this check box will check that all required payer data are provided, and if not, the payment will be cancelled</msg>
			<msg name="aemail">Email</msg>
			<msg name="hint_aemail">Email</msg>
			<msg name="hint_default">Fill out the form</msg>
			<msg name="hint_logourl">URL of the logo</msg>
			<msg name="hint_posturl">API URL</msg>
			<msg name="logourl">Logo (URL)</msg>
			<msg name="posturl">API URL</msg>
		</messages>
		<messages name="credit.pay.paypal.php">
			<msg name="msg_extokmsg">Payment</msg>
			<msg name="amount">Amount</msg>
			<msg name="hint_amount">Total amount</msg>
			<msg name="title">PayPal PHP</msg>
			<msg name="hint_default">PayPal PHP</msg>        
		</messages>
	</lang>
</mgrdata>
Was this helpful? Yes | No
Personal tools