Exemple #1
0
function ewayuk_link($params)
{
    $query = "";
    $gatewaytestmode = $params['testmode'];
    if ($gatewaytestmode == "on") {
        $query .= "CustomerID=87654321";
        $query .= "&UserName=TestAccount";
    } else {
        $query .= "CustomerID=" . $params['customerid'];
        $query .= "&UserName="******"&MerchantInvoice=" . $params['invoiceid'];
    $query .= "&MerchantReference=" . $params['invoiceid'];
    $query .= "&Amount=" . urlencode($params['amount']);
    $query .= "&Currency=" . $params['currency'];
    $query .= "&CustomerFirstName=" . $params['clientdetails']['firstname'];
    $query .= "&CustomerLastName=" . $params['clientdetails']['lastname'];
    $query .= "&CustomerAddress=" . $params['clientdetails']['address1'] . " " . $params['clientdetails']['address2'];
    $query .= "&CustomerCity=" . $params['clientdetails']['city'];
    $query .= "&CustomerState=" . $params['clientdetails']['state'];
    $query .= "&CustomerPostCode=" . $params['clientdetails']['postcode'];
    $query .= "&CustomerCountry=" . $params['clientdetails']['country'];
    $query .= "&CustomerEmail=" . $params['clientdetails']['email'];
    $query .= "&CustomerPhone=" . $params['clientdetails']['phonenumber'];
    $query .= "&CancelUrl=" . urlencode($params['systemurl'] . "/viewinvoice.php?id=" . $params['invoiceid']);
    $query .= "&ReturnUrl=" . urlencode($params['systemurl'] . "/modules/gateways/callback/ewayuk.php");
    $query = str_replace(" ", "%20", $query);
    $posturl = "https://payment.ewaygateway.com/Request/?" . $query;
    $response = curlCall($posturl, "");
    $responsemode = strtolower(ewayuk_fetch_data($response, "<Result>", "</Result>"));
    if ($responsemode == "true") {
        $redirecturl = ewayuk_fetch_data($response, "<Uri>", "</Uri>");
        $code = "<input type=\"button\" value=\"" . $params['langpaynow'] . "\" onclick=\"window.location='" . $redirecturl . "'\" />\n</form>";
        return $code;
    }
    logTransaction("eWay UK", $response, "Error");
    return "An Error Occurred. Please try again later or submit a ticket if the error persists.";
}
Exemple #2
0
$postfields = array();
if ($GATEWAY['testmode']) {
    $postfields['CustomerID'] = "87654321";
    $postfields['UserName'] = "******";
} else {
    $postfields['CustomerID'] = $GATEWAY['customerid'];
    $postfields['UserName'] = $GATEWAY['username'];
}
$postfields['AccessPaymentCode'] = $_REQUEST['AccessPaymentCode'];
$merchantposturl = "https://payment.ewaygateway.com/Result/?";
foreach ($postfields as $k => $v) {
    $merchantposturl .= "" . $k . "=" . urlencode($v) . "&";
}
$response = curlCall($merchantposturl, "");
$authecode = ewayuk_fetch_data($response, "<authCode>", "</authCode>");
$responsecode = ewayuk_fetch_data($response, "<responsecode>", "</responsecode>");
$returnamount = ewayuk_fetch_data($response, "<returnamount>", "</returnamount>");
$txn_id = ewayuk_fetch_data($response, "<trxnnumber>", "</trxnnumber>");
$trxnstatus = ewayuk_fetch_data($response, "<trxnstatus>", "</trxnstatus>");
$invoiceid = ewayuk_fetch_data($response, "<MerchantInvoice>", "</MerchantInvoice>");
$trxnresponsemessage = ewayuk_fetch_data($response, "<trxnresponsemessage>", "</trxnresponsemessage>");
$invoiceid = checkCbInvoiceID($invoiceid, "eWay UK Hosted Payments");
$response = array("response" => $response);
if ($trxnstatus == "true") {
    logTransaction("eWay UK Hosted Payments", array_merge($_REQUEST, $postfields, $response), "Successful");
    addInvoicePayment($invoiceid, $txn_id, $returnamount, "", "ewayuk");
    redirSystemURL("id=" . $invoiceid . "&paymentsuccess=true", "viewinvoice.php");
    return 1;
}
logTransaction("eWay UK Hosted Payments", array_merge($_REQUEST, $postfields, $response), "Error");
redirSystemURL("id=" . $invoiceid . "&paymentfailed=true", "viewinvoice.php");