Added whmcs module files
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
# Required File Includes
|
||||
include("../../../includes/functions.php");
|
||||
include("../../../includes/gatewayfunctions.php");
|
||||
include("../../../includes/invoicefunctions.php");
|
||||
|
||||
$gatewaymodule = "payanyway"; # Enter your gateway module name here replacing template
|
||||
|
||||
$GATEWAY = getGatewayVariables($gatewaymodule);
|
||||
if (!$GATEWAY["type"]) die("Module Not Activated"); # Checks gateway module is active before accepting callback
|
||||
|
||||
# Get Returned Variables - Adjust for Post Variable Names from your Gateway's Documentation
|
||||
$invoiceid = $_GET["MNT_TRANSACTION_ID"];
|
||||
$transid = $_GET["MNT_OPERATION_ID"];
|
||||
$amount = $_GET["MNT_AMOUNT"];
|
||||
|
||||
$invoiceid = checkCbInvoiceID($invoiceid, $GATEWAY["name"]); # Checks invoice ID is a valid invoice number or ends processing
|
||||
|
||||
checkCbTransID($transid); # Checks transaction number isn't already in the database and ends processing if it does
|
||||
|
||||
if (_checkSignature($GATEWAY)) {
|
||||
# Successful
|
||||
addInvoicePayment($invoiceid, $transid, $amount, null, $gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename
|
||||
logTransaction($GATEWAY["name"], $_GET, "Successful"); # Save to Gateway Log: name, data array, status
|
||||
die("SUCCESS");
|
||||
} else {
|
||||
# Unsuccessful
|
||||
logTransaction($GATEWAY["name"], $_GET, "Unsuccessful"); # Save to Gateway Log: name, data array, status
|
||||
}
|
||||
die("FAIL");
|
||||
|
||||
|
||||
|
||||
function _checkSignature($GATEWAY) {
|
||||
$params = '';
|
||||
if (isset($_GET['MNT_COMMAND'])) $params .= $_GET['MNT_COMMAND'];
|
||||
$params .= $_GET['MNT_ID'] . $_GET['MNT_TRANSACTION_ID'];
|
||||
if (isset($_GET['MNT_OPERATION_ID'])) $params .= $_GET['MNT_OPERATION_ID'];
|
||||
if (isset($_GET['MNT_AMOUNT'])) $params .= $_GET['MNT_AMOUNT'];
|
||||
$params .= $_GET['MNT_CURRENCY_CODE'];
|
||||
if (isset($_GET['MNT_SUBSCRIBER_ID'])) $params .= $_GET['MNT_SUBSCRIBER_ID'];
|
||||
$params .= $_GET['MNT_TEST_MODE'];
|
||||
|
||||
$signature = md5($params . $GATEWAY['mnt_dataintegrity_code']);
|
||||
|
||||
if (strcasecmp($signature, $_GET['MNT_SIGNATURE']) == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
function payanyway_config() {
|
||||
$configarray = array(
|
||||
"FriendlyName" => array("Type" => "System", "Value"=>"PayAnyWay"),
|
||||
"mnt_id" => array("FriendlyName" => "Account Number", "Type" => "text", "Size" => "20", ),
|
||||
"mnt_dataintegrity_code" => array("FriendlyName" => "Code of data integrity verification", "Type" => "text", "Size" => "20", ),
|
||||
"mnt_test_mode" => array("FriendlyName" => "Test Mode", "Type" => "yesno" ),
|
||||
);
|
||||
return $configarray;
|
||||
}
|
||||
|
||||
function payanyway_link($params) {
|
||||
|
||||
# Gateway Specific Variables
|
||||
$gatewayusername = $params['mnt_id'];
|
||||
$gatewaytestmode = intval($params['mnt_test_mode']);
|
||||
$gatewaykey = $params['mnt_dataintegrity_code'];
|
||||
|
||||
# Invoice Variables
|
||||
$invoiceid = $params['invoiceid'];
|
||||
$description = $params["description"];
|
||||
$amount = $params['amount']; # Format: ##.##
|
||||
$currency = $params['currency']; # Currency Code
|
||||
|
||||
# Client Variables
|
||||
$firstname = $params['clientdetails']['firstname'];
|
||||
$lastname = $params['clientdetails']['lastname'];
|
||||
$email = $params['clientdetails']['email'];
|
||||
$address1 = $params['clientdetails']['address1'];
|
||||
$address2 = $params['clientdetails']['address2'];
|
||||
$city = $params['clientdetails']['city'];
|
||||
$state = $params['clientdetails']['state'];
|
||||
$postcode = $params['clientdetails']['postcode'];
|
||||
$country = $params['clientdetails']['country'];
|
||||
$phone = $params['clientdetails']['phonenumber'];
|
||||
|
||||
# System Variables
|
||||
$companyname = $params['companyname'];
|
||||
$systemurl = $params['systemurl'];
|
||||
$currency = $params['currency'];
|
||||
|
||||
# Enter your code submit to the gateway...
|
||||
$signature = md5($gatewayusername . $invoiceid . $amount . $currency . $gatewaytestmode . $gatewaykey);
|
||||
|
||||
$code = '<form method="post" action="https://www.payanyway.ru/assistant.htm">
|
||||
<input type="hidden" name="MNT_ID" value="'.$gatewayusername.'" />
|
||||
<input type="hidden" name="MNT_TRANSACTION_ID" value="'.$invoiceid.'" />
|
||||
<input type="hidden" name="MNT_AMOUNT" value="'.$amount.'" />
|
||||
<input type="hidden" name="MNT_CURRENCY_CODE" value="'.$currency.'" />
|
||||
<input type="hidden" name="MNT_SIGNATURE" value="'.$signature.'" />
|
||||
<input type="hidden" name="MNT_TEST_MODE" value="'.$gatewaytestmode.'" />
|
||||
<input type="hidden" name="MNT_DESCRIPTION" value="'.$description.'" />
|
||||
<input type="submit" value="Pay Now" />
|
||||
</form>';
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user