Jump to content

Intuit Payment Gateway


abcsol

Recommended Posts

I am trying to get Intuit payment gateway to work with WHMCS. I have found a module from RapidFour.com, but when I put the files on my server in the locations specified by WHMCS and RapidFour, the payment module does not show up in the list to be activated. I will post the code below. If anyone can help me with where the error(s) are, I would really appreciate it.

 

I have compared it to the template in the developer kit from WHMCS, and it looks right, but not working. I am running WHMCS 5.1.3

 

<?php
// ================================================== ============================
// QBMS WHMCS Payment Module
// ================================================== ============================
// Software Version: QBMS WHMCS PM 2011-03-27 11:10
// Software by: RapidFour, LLC (http://www.rapidfour.com)
// Copyright 2011 by: RapidFour, LLC (http://www.rapidfour.com)
// Support, News, Updates at: http://www.rapidfour.com

// This program is free software; you may redistribute it and/or modify it under the terms of the
// Adobe Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0) License.

// This program is distributed in the hope that it is and will be useful, but WITHOUT ANY WARRANTIES; without even
// any implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

// Visit http://creativecommons.org/licenses/by-nc-sa/3.0/ to view detailed license information.

// The latest version can found at http://www.rapidfour.com.
// ================================================== ============================

// Require our QuickBooks library
require('QuickBooks/QuickBooks.php');

// Setup our module configuration
function qbms_config() {
$configarray = array(
"FriendlyName" => array("Type" => "System", "Value"=>"QuickBooks"),
"ApplicationID" => array("FriendlyName" => "Application ID", "Type" => "text", "Size" => "20", ),
"ApplicationLogin" => array("FriendlyName" => "Application Login", "Type" => "text", "Size" => "40", ),
"ConnectionTicket" => array("FriendlyName" => "Connection Ticket", "Type" => "text", "Size" => "40", ),
"ConnectionMethod" => array("FriendlyName" => "Connection Ticket", "Type" => "dropdown", "Options" => "Desktop,Hosted", ),
//"transmethod" => array("FriendlyName" => "Transaction Method", "Type" => "dropdown", "Options" => "Option1,Value2,Method3", ),
//"instructions" => array("FriendlyName" => "Payment Instructions", "Type" => "textarea", "Rows" => "5", "Description" => "Do this then do that etc...", ),
"testmode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "Tick this to test", ),
);
return $configarray;
}

function qbms_capture($params) {

// Create a new QuickBooks Online Edition instance
$qb = new QuickBooks;

// Define our settings
$qb->SetApplicationID($params['ApplicationID'])->SetApplicationLogin($params['ApplicationLogin'])->SetAuthenticationType($params['ConnectionMethod'])->SetConnectionTicket($params['ConnectionTicket'])->SetVersion('QBMS');

// If this is a test
if ($params['testmode'] == 'on') {
$qb->SetURL('https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway');
}

# Invoice Variables
$invoiceid = $params['invoiceid'];
$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'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Transaction Here & Generate $results Array, eg:
$qb->CreateRequest('CustomerCreditCardCharge');

$macro = explode(' ', microtime());
$p_macro = $macro[1].str_replace('.', '', $macro[0]);

// Compile our customer data
$Query = array('TransRequestID' => $p_macro,
'CreditCardNumber' => $params['cardnum'],
'ExpirationMonth' => substr($params['cardexp'], 0, 2),
'ExpirationYear' => '20'.substr($params['cardexp'], 2, 2),
'IsECommerce' => 'true',
'Amount' => $params['amount'],
'NameOnCard' => $params['clientdetails']['firstname'].' '.$params['clientdetails']['lastname'],
'CreditCardAddress' => $params['clientdetails']['address1'],
'CreditCardPostalCode' => $params['clientdetails']['postcode'],
'CardSecurityCode' => $params['cccvv'],
'InvoiceID' => $params['invoiceid'],
'GeoLocationInfo' => array('IPAddress' => $_SERVER['REMOTE_ADDR']));

// Update our request data
$qb->SetRequestData($Query);

// Process our request
$qb->ProcessRequests();

// Get our results
$response = $qb->GetResponseArray();

// Get our transaction id and status code
${'Status Code'} = $response['QBMSXMLMsgsRs']['CustomerCreditCardChargeRs']['@attributes']['statusCode'];
${'Transaction ID'} = $response['QBMSXMLMsgsRs']['CustomerCreditCardChargeRs']['CreditCardTransID'];

# Return Results
if (${'Status Code'} == 0 && ${'Transaction ID'}) {
return array('status' => 'success', 'transid' => ${'Transaction ID'}, 'rawdata' => $response);
} else {
return array('status' => 'declined', 'rawdata' => $response);
}
}

function qbms_refund($params) {

// Create a new QuickBooks Online Edition instance
$qb = new QuickBooks;

// Define our settings
$qb->SetApplicationID($params['ApplicationID'])->SetApplicationLogin($params['ApplicationLogin'])->SetAuthenticationType($params['ConnectionMethod'])->SetConnectionTicket($params['ConnectionTicket'])->SetVersion('QBMS');

// If this is a test
if ($params['testmode'] == 'on') {
$qb->SetURL('https://webmerchantaccount.ptc.quickbooks.com/j/AppGateway');
}

# Invoice Variables
$transid = $params['transid']; # Transaction ID of Original Payment
$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'];

# Card Details
$cardtype = $params['cardtype'];
$cardnumber = $params['cardnum'];
$cardexpiry = $params['cardexp']; # Format: MMYY
$cardstart = $params['cardstart']; # Format: MMYY
$cardissuenum = $params['cardissuenum'];

# Perform Transaction Here & Generate $results Array, eg:
$qb->CreateRequest('CustomerCreditCardRefund');

$macro = explode(' ', microtime());
$p_macro = $macro[1].str_replace('.', '', $macro[0]);

// Compile our customer data
$Query = array('TransRequestID' => $p_macro,
'CreditCardNumber' => $params['cardnum'],
'ExpirationMonth' => substr($params['cardexp'], 0, 2),
'ExpirationYear' => '20'.substr($params['cardexp'], 2, 2),
'IsECommerce' => 'true',
'Amount' => $params['amount'],
'NameOnCard' => $params['clientdetails']['firstname'].' '.$params['clientdetails']['lastname'],
'GeoLocationInfo' => array('IPAddress' => $_SERVER['REMOTE_ADDR']));

// Update our request data
$qb->SetRequestData($Query);

// Process our request
$qb->ProcessRequests();

// Get our results
$response = $qb->GetResponseArray();

// Get our transaction id and status code
${'Status Code'} = $response['QBMSXMLMsgsRs']['CustomerCreditCardRefundRs']['@attributes']['statusCode'];
${'Transaction ID'} = $response['QBMSXMLMsgsRs']['CustomerCreditCardRefundRs']['CreditCardTransID'];

# Return Results
if (${'Status Code'} == 0 && ${'Transaction ID'}) {
return array('status' => 'success', 'transid' => ${'Transaction ID'}, 'rawdata' => $response);
} else {
return array('status' => 'declined', 'rawdata' => $response);
}
}
?> 

 

THANK YOU IN ADVANCE FOR ANY HELP.

Link to comment
Share on other sites

  • 1 year later...

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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