Jump to content

Ccnow Payment Correct Code For Cubecart Version 3


Guest jackli

Recommended Posts

<?php

/*

+--------------------------------------------------------------------------

| CubeCart v3.0.7-pl1

| ========================================

| by Alistair Brookbanks

| CubeCart is a Trade Mark of Devellion Limited

| Copyright Devellion Limited 2005 - 2006. All rights reserved.

| Devellion Limited,

| Westfield Lodge,

| Westland Green,

| Little Hadham,

| Nr Ware, HERTS.

| SG11 2AL

| UNITED KINGDOM

| http://www.devellion.com

| UK Private Limited Company No. 5323904

| ========================================

| Web: http://www.cubecart.com

| Date: Monday, 2nd January 2006

| Email: info (at) cubecart (dot) com

| License Type: CubeCart is NOT Open Source Software and Limitations Apply

| Licence Info: http://www.cubecart.com/site/faq/license.php

+--------------------------------------------------------------------------

| transfer.php

| ========================================

| Core functions for the ccNOW GATEWAY

+--------------------------------------------------------------------------

*/

/*

//////////////////////////

// CCNOW GATEWAY

//////////////////////////

// L@@K AT ALL THE LOVELY

// VARIABLES WE HAVE TO

// PLAY WITH!!

//////

//////////////////////////

// IN THE REPEATED REGION

//////

$orderInv['productId'] - product id as an integer

$orderInv['name'] - product name as a varchar

$orderInv['price'] - price of each product (inc options)

$orderInv['quantity'] - quantity of products as an integer

$orderInv['product_options'] - products attributes as test

$orderInv['productCode'] - product code as a varchar

$i - This is the current incremented integer starting at 0

/////////////////////////

// FIXED VARS

///////

$cart_order_id - cart order id as a varchar

$ccUserData[0]['email'] - Customers email address

$ccUserData[0]['title'] - Customers title (Mr Miss etc...)

$ccUserData[0]['firstName'] - Customers first name

$ccUserData[0]['lastName'] - Customers last name

$ccUserData[0]['add_1'] - Invoice Address line 1

$ccUserData[0]['add_2'] - Invoice Address line 1

$ccUserData[0]['town'] - Invoice Town or city

$ccUserData[0]['county'] - Invoice County or state

$ccUserData[0]['postcode'] - Invoice Post/Zip Code

$ccUserData[0]['country'] - Invoice country Id we can look up the country name like this

countryName($ccUserData[0]['country']);

$ccUserData[0]['phone'] - Contact phone no

$ccUserData[0]['mobile'] - Mobile/Cell phone number

$basket['delInf']['title'] - Delivery title (Mr Miss etc...)

$basket['delInf']['firstName'] - Delivery customers first name

$basket['delInf']['lastName'] - Delivery customers last name

$basket['delInf']['add_1'] - Delivery Address line 1

$basket['delInf']['add_2'] - Delivery Address line 1

$basket['delInf']['town'] - Delivery Town or city

$basket['delInf']['county'] - Delivery County or state

$basket['delInf']['postcode'] - Delivery Post/Zip Code

$basket['delInf']['country'] - Delivery country Id we can look up the country name like this

countryName($basket['delInf']['country']);

$basket['subTotal'] - Order Subtotal (exTax and Shipping)

$basket['grandTotal'] - Basket total which has to be paid (inc Tax and Shipping).

$basket['tax'] - Total tax to pay

$basket['shipCost'] - Shipping price

////////////////////////////////////////////////////////

*/

$module = fetchDbConfig("ccNow");

function repeatVars(){

global $i, $orderInv;

$hiddenVars = "<input type='hidden' name='x_product_sku_".$i."' value='".$orderInv['productCode']."' />

<input type='hidden' name='x_product_title_".$i."' value='".$orderInv['name']."' />

<input type='hidden' name='x_product_quantity_".$i."' value='".$orderInv['quantity']."' />

<input type='hidden' name='x_product_unitprice_".$i."' value='".sprintf("%.2f",$orderInv['price']/$orderInv['quantity'])."' />

<input type='hidden' name='x_product_url_".$i."' value='".$GLOBALS['storeURL']."/index.php?_a=viewProd&productId=".$orderInv['productId']."' />";

return $hiddenVars;

}

function fixedVars(){

global $module, $basket, $ccUserData, $cart_order_id, $config, $GLOBALS;

$hiddenVars = "<input type='hidden' name='x_login' value='".$module['acName']."' />

<input type='hidden' name='x_version' value='1.0' />

<input type='hidden' name='x_fp_arg_list' value='x_login^x_fp_arg_list^x_fp_sequence^x_amount^x_currency_code' />

<input type='hidden' name='x_fp_hash' value='".md5($module['acName']."^x_login^x_fp_arg_list^x_fp_sequence^x_amount^x_currency_code^".str_replace("-","",$cart_order_id)."^".$basket['grandTotal']."^".$config['defaultCurrency']."^".$module['actKey'])."' />

<input type='hidden' name='x_fp_sequence' value='".str_replace("-","",$cart_order_id)."' />

<input type='hidden' name='x_currency_code' value='".$config['defaultCurrency']."' />

<input type='hidden' name='x_method' value='NONE' />

<input type='hidden' name='x_name' value='".$ccUserData[0]['title']." ".$ccUserData[0]['firstName']." ".$ccUserData[0]['lastName']."' />

<input type='hidden' name='x_address' value='".$ccUserData[0]['add_1']."' />

<input type='hidden' name='x_address2' value='".$ccUserData[0]['add_2']."' />

<input type='hidden' name='x_city' value='".$ccUserData[0]['town']."' />

<input type='hidden' name='x_state' value='".$ccUserData[0]['county']."' />

<input type='hidden' name='x_zip' value='".$ccUserData[0]['postcode']."' />

<input type='hidden' name='x_country' value='".countryIso($ccUserData[0]['country'])."' />

<input type='hidden' name='x_phone' value='".$ccUserData[0]['phone']."' />

<input type='hidden' name='x_email' value='".$ccUserData[0]['email']."' />

<input type='hidden' name='x_invoice_num' value='".$cart_order_id."' />

<input type='hidden' name='x_instructions' value='".$basket['customer_comments']."' />

<input type='hidden' name='x_amount' value='".$basket['grandTotal']."' />

<input type='hidden' name='x_shipping_amount' value='".$basket['shipCost']."' />";

return $hiddenVars;

}

function success(){

global $basket;

if( (base64_decode($_GET['oid']) == $basket['cart_order_id']) && !isset($_GET['f']) ) {

return TRUE;

} else {

return FALSE;

}

}

///////////////////////////

// Other Vars

////////

$formAction = "https://www.ccnow.com/cgi-local/transact.cgi";

$formMethod = "post";

$formTarget = "_self";

$transfer = "auto";

$stateUpdate = TRUE;

?>

Link to comment
Share on other sites

  • 3 months later...

Guest lcools

Are you saying that CCNOW (my preferred processor) now works with Cubecart? I spoke extensively with Brooky and CCNow way back when and never got it going.

This would be great news.

Leila

Link to comment
Share on other sites

Guest CapnK

I have set up a site for some customers using CC v3.0.17* , activated and configured the CCNow module with the Merchant ID and Auth Key from CCNow, and am still getting the "ERROR: 7: FP mismatch" message when attempting to process an order. I have a ticket in to CCNow tech support, and will relay what information I get as to the cause of this when I can.

Per one other thread on this forum, I have set the shipping cost (flat rate) to a format like so: xx.xx, with the last integer being an odd number.

I am surprised at the lack of info available on the web regarding using these 2 solutions together. Including the fact that if you want to use CCNow, it is best to set it up *through* CubeCart; I didn't see that anywhere prior, and so it has taken longer to get the Auth Key needed.

Once I get it set up, I will write up a short FAQ detailing what I've found so that others might find it easier than I have to get it all working. :whistle:

In the meanwhile - any help or input on the "FP error" is welcome. Thanks!

----------

*(yes, eventually I think they will pay for a license, but they are starting off right now, with precious little to spend)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...