PDA

View Full Version : WHMCS perfectmoney module error 2013



Fli
11-13-2013, 09:34 AM
#1

I faced error in WHMCS payment gateway module (original free from PM (https://perfectmoney.is/whmcs.html)), that invoices was not marked as Paid after successfull payment. WHMCS helped by:


Please check and ensure that your dbconnect.php file is the correct version for WHMCS 5.2.12. From the description, it would suggest the file is an older version.

Within your callback file, you can replace the following code:

include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/gatewayfunctions.php");
include("../../../includes/invoicefunctions.php");

with

require("../../../init.php");
$whmcs->load_function('gateway');
$whmcs->load_function('invoice');

Which is the new method and will load the required information for you also.

And indeed this replacement worked. I commented out mentioned 4 lines and added mentioned 3 lines. It started marking invoices as Paid.


#2
=============Another error i experienced with WHMCS payment module: =============

Please anyone else experienced error:

Fatal error: Cannot redeclare perfectmoney_config() (previously declared in /home/myusername/public_html/modules/gateways/perfectmoney_-_.php:6) in /home/myusername/public_html/modules/gateways/perfectmoney.php on line 13

at page: https://yourwhmcswebsite.com/admin/configgateways.php ?


This is the /modules/gateway/perfectmoney.php


<?php


function perfectmoney_config(){


$configarray = array(
"FriendlyName" => array("Type" => "System", "Value"=>"Perfect Money"),
"perfectmoney_id" => array("FriendlyName" => "Perfect Money Payee Account", "Type" => "text", "Size" => "20", "Description" => "example: U1234567"),
"perfectmoney_pass" => array("FriendlyName" => "Perfect Money Alternate PassPhrase", "Type" => "text", "Size" => "20", "Description" => "Alternate PassPhrase can be found and set under Settings section in your PM account"),
"UsageNotes" => array("Type" => "System", "Value"=>"You must select USD or EUR in \"Convert To For Processing\" field in order to accept Perfect Money."),
);
return $configarray;


}


function perfectmoney_link($params) {


global $_LANG;


# Gateway Specific Variables
$perfectmoney_id = $params['perfectmoney_id'];

# Invoice Variables
$invoiceid = $params['invoiceid'];
$description = $params["description"];
$amount = $params['amount']; # Format: ##.##
$currency = $params['currency']; # Currency Code

# System Variables
$companyname = $params['companyname'];
$systemurl = $params['systemurl'];
$currency = $params['currency'];


# Enter your code submit to the gateway...


$code = '<form action="https://perfectmoney.is/api/step1.asp" method="post">
<input type="hidden" name="SUGGESTED_MEMO" value="'.$description.'">


<input type="hidden" name="PAYMENT_ID" value="'.$invoiceid.'" />
<input type="hidden" name="PAYMENT_AMOUNT" value="'.$amount.'" />
<input type="hidden" name="PAYEE_ACCOUNT" value="'.$perfectmoney_id.'" />
<input type="hidden" name="PAYMENT_UNITS" value="'.$currency.'" />
<input type="hidden" name="PAYEE_NAME" value="'.$companyname.'" />
<input type="hidden" name="PAYMENT_URL" value="'.$systemurl.'/viewinvoice.php?id='.$invoiceid.'" />
<input type="hidden" name="PAYMENT_URL_METHOD" value="LINK" />
<input type="hidden" name="NOPAYMENT_URL" value="'.$systemurl.'/viewinvoice.php?id='.$invoiceid.'" />
<input type="hidden" name="NOPAYMENT_URL_METHOD" value="LINK" />
<input type="hidden" name="STATUS_URL" value="'.$systemurl.'/modules/gateways/callback/perfectmoney.php" />
<input type="submit" value="'.$_LANG['invoicespaynow'].'" />
</form>';


return $code;


}
?>


The WHMCS API developers page: http://docs.whmcs.com/Gateway_Module_Developer_Docs

The email i sent to perfect money:


Hello, your WHMCS module is corrupt thanks to WHMCS change in their code. Here is more details: http://docs.whmcs.com/Gateway_Module_Developer_Docs


Please can you check your module variables,code? In my WHMCS it outputs this error:


Fatal error: Cannot redeclare perfectmoney_config() (previously declared in /home/postcd/public_html/modules/gateways/perfectmoney_-_.php:6) in /home/postcd/public_html/modules/gateways/perfectmoney.php on line 13


I ask you to send me updated code or say what i need to change in module code.


Please assign my request a priority.


Thank you,
XY


UPDATE/FIXED: this error went away when i deleted all module files and uploaded original one. (i had two files of same module in same directory).
But still original one dont mark invoices as paid when customer returning from Perfectmoney gateway to a WHMCS website (viewinvoice). // EDIT: Even this was fixed, see at the top of this post #1.