X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   FirePay Payment module. (https://forum.x-cart.com/showthread.php?t=1138)

B00MER 01-08-2003 01:20 PM

FirePay Payment module.
Okie I had this laying around from awhile back if anyone wants to use www.firepay.com (similar to paypal but Canada based) Here is my payment module for them, keep in mind it was written on 9-20-2002 so it may need revamping.

:!: This module was written with 3.1.3a, and may need revamping for later releases.


# FirePay CC processing module
# written by www.molotovbliss.com on 9-20-2002
# released: 1-8-2003

require "../include/payment_method.php";

# Filling $_location variable depending protocol value

$module_params = func_query("SELECT param01, param02, param03 FROM ccprocessors WHERE processor = 'cc_firepay.php'");
$firepay_merchantid = $module_params[0]["param01"];
$firepay_account = $module_params[0]["param02"];
$firepay_pwd = $module_params[0]["param03"];

#print "$firepay_merchantid, $firepay_account, $firepay_pwd"; exit;

$res = func_query("SELECT protocol FROM payment_methods WHERE payment_script = 'payment_firepay.php'");

if ($res["protocol"] == "https")
        $_location = $https_location;
        $_location = $http_location;

# FirePay Request

if ($REQUEST_METHOD == "POST" && !empty($payment_type)) {

print "hi"; exit;

        $str = "";
        foreach ($HTTP_POST_VARS as $key => $val)
                $str .= "-$key=\"$val\" ";

        exec ("./firepay.pl $str", $bill_output);

        list($bill_errorcode, $bill_message) = explode(",", $bill_output[0]);

        if ($bill_errorcode != 1) {
                $bill_mesage = "Status: $payment_status Reason: $pending_reason";

                header("Location: ../customer/error_message.php?error=error_ccprocessor_error&bill_message=".urlencode($bill_message));
        } else {
                $orderids = func_place_order("$payment_method (FirePay)", "P", "");
                $_orderids = func_get_urlencoded_orderids ($orderids);

# Remove all from cart

                $cart = "";
                header("Location: ../customer/cart.php?mode=order_message&orderids=$_orderids");

# Create 'Not finished' order entry
#$orderid = func_place_order($payment_method, "N","");

#if($mode=="success" && $secureid && $secureid==$order_secureid) {
#        $orderids = func_place_order($payment_method, "P","");
#        $_orderids = func_get_urlencoded_orderids ($orderids);
# Remove all from cart
#        $cart="";
#        header("Location: $http_location/customer/cart.php?mode=order_message&orderids=$_orderids");
#        exit;

# Below is the form for POST method
<form action="https://realtime.test.firepay.com/servlet/DPServlet" method="post" name=firepay_form>

<input type=hidden name=clientVersion value="1.1">
<input type=hidden name=cvdIndicator value="0">
<input type=hidden name=operation value="P">

<input type=hidden name=mechantId value="<? echo $firepay_account ?>">
<input type=hidden name=mechantPwd value="<? echo $firepay_pwd ?>">
<input type=hidden name=mechantTxn value="<? echo $order_secureid ?>">

<input type=hidden name=cardNumber value="<? echo $userinfo["card_number"] ?>">
<input type=hidden name=cardExp value="<? echo $userinfo["card_expire"] ?>">
<input type=hidden name=cardType value="<? echo substr($userinfo["card_type"], 0, 2) ?>">
<input type=hidden name=amount value="<? print (int) ($cart["total_cost"] * 100) ?>">

<input type=hidden name=custName1 value="<? echo addslashes($userinfo["firstname"])." ".addslashes($userinfo["lastname"]) ?>">
<input type=hidden name=streetAddr value="<? echo addslashes($userinfo["b_address"]) ?>">
<input type=hidden name=city value="<? echo $userinfo["b_city"] ?>">
<input type=hidden name=state value="<? echo $userinfo["b_state"] ?>">
<input type=hidden name=zip value="<? echo $userinfo["b_zipcode"] ?>">
<input type=hidden name=phone value="<? echo $userinfo["phone"] ?>">
<input type=hidden name=country value="<? echo $userinfo["b_country"];?>">


<table width=100% height=100%>
<tr><td align=center valign=middle>Please wait while connecting to FirePay payment gateway...</td></tr>

:!: You will need to add a payment module to the x-cart_ccprocessors database as well as create a .tpl file for the admin area to fill in the param's required, I don't have the .tpl anymore but can be created for you as well as the SQL statement for inserting the processor into the database if you wish, feel free to contact me.

:!: If you find this file useful Please, please, please make a donation to me as this is time and money I'm loosing if your just blantaly taking the code and using it for your own profit!

Happy x-carting! :wink:

All times are GMT -8. The time now is 04:44 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.