Jump to content

chrismberi

Member
  • Posts

    1
  • Joined

  • Last visited

About chrismberi

chrismberi's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. I made a custom gateway which does not seem to redirect to gateway site. Upon initiating payment, gateway returns status and url to which client browser should be redirected. instead of reditecting to that site, the replay string just appears in the browser and thats it My custom module files are as follows: <?php # Required File Includes include("../../../dbconnect.php"); include("../../../includes/functions.php"); include("../../../includes/gatewayfunctions.php"); include("../../../includes/invoicefunctions.php"); $gatewaymodule = "mygate"; # 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 $browserurl = $_POST['browserurl']; $hash = $_POST['hash']; $pollurl = $_POST['pollurl']; $status = $_POST["status"]; $invoiceid = $_POST["reference"]; $transid = $_POST["mygatereference"]; $amount = $_POST["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 ($status=="Ok") { # Successful addInvoicePayment($invoiceid,$transid,$amount,$gatewaymodule); # Apply Payment to Invoice: invoiceid, transactionid, amount paid, fees, modulename logTransaction($GATEWAY["name"],$_POST,"Successful"); # Save to Gateway Log: name, data array, status } else { # Unsuccessful logTransaction($GATEWAY["name"],$_POST,"Unsuccessful"); # Save to Gateway Log: name, data array, status } ?> <?php function mygate_config() { $configarray = array( "FriendlyName" => array("Type" => "System", "Value"=>"mygate"), "intkey" => array("FriendlyName" =>"Key","Type" => "text", "Size"=>"70"), "userid" => array("FriendlyName" => "User ID", "Type" => "text", "Size" => "20"), "testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test") ); return $configarray; } function mygate_link($params) { # Gateway Specific Variables $gatewayusername = $params['userid']; $gatewaytestmode = $params['testmode']; $GatewayKey = $params['intkey']; # 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... $values=array("$gatewayusername","$invoiceid","$amount","$systemurl","http://www.easysites.co/wed/modules/gateways/callback/mygate.php","Message"); function CreateHash($values, $GatewayKey){ $string = ""; foreach($values as $key=>$value){ if($key != '6'){ $string.=$value; } } $string .= $GatewayKey; $hash = hash('sha512', $string); return strtoupper($hash); } $hashh = CreateHash($values,$GatewayKey); $code = '<form method="post" action="https://www.mygate.co/interface/initiatetransaction"> <input type="hidden" name="id" value="'.$gatewayusername.'"/> <input type="hidden" name="reference" value="'.$invoiceid.'" /> <input type="hidden" name="amount" value="'.$amount.'" /> <input type="hidden" name="returnurl" value="'.$systemurl.'"/> <input type="hidden" name="resulturl" value="http://www.getnames.co.zw/wed/modules/gateways/callback/mygate.php"/> <input type="hidden" name="status" value="'.Message.'"/> <input type="hidden" name="hash" value="'.$hashh.'"/> <input type="submit" value="Pay Now" /> </form>'; return $code; } ?>
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated