Welcome Guest, Not a member yet? Register   Sign In
successWarning in direct payment Pro
#1

[eluser]nandish[/eluser]
Hi guys


I intergrated standard paypal stuff its working fine.

After few ayds i integrated direct payment Pro instead of standard paypal but its giving error

ERROR
This transaction has been completed, but the total of items in the cart did not match the total of all items.

1) how to resolve above the error.
2) ipn is also giving Failed response.


Thanks in advance


this is my controller

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');


//----------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------

class Checkout extends Controller {
function __Construct() {
parent::Controller();
$this->load->model('MCheckout');
}

// -------------------------------------------------------------------------------------------------------------
//assigning user information and providing constant values
// -------------------------------------------------------------------------------------------------------------

function direct_payment_setup() {
$this->load->library( 'CI_WebsitePaymentsPro');
$this->load->library('session');

$Paypal = $this->Payment_method_name();
$currency_code = $this->config->item('currency_code');

$ip = $_SERVER['REMOTE_ADDR'];
$unique_session_id = session_id();

$salutation = 'Mr.';
$paymentAction = 'Sale';

//get the user information or details
$userid = $this->session->userdata('s_user_id');

$useRdetail = $this->MCheckout->getuserBookdetails($userid);

//log_message('debug','get the used details'.print_R($useRdetail->row()));

$fname = $useRdetail->row()->s_first_name;//
$lname = $useRdetail->row()->s_last_name;
$address1 = $useRdetail->row()->s_address1;
$address2 = $useRdetail->row()->s_address2;
$city = $useRdetail->row()->s_city;
$state = $useRdetail->row()->s_state;
$zip = $useRdetail->row()->s_zipcode;
$cc_country = "US";
$phone = $useRdetail->row()->s_phone;
$email =$useRdetail->row()->s_email;

// credit information of the user
$cc_type = ucfirst(strtolower($useRdetail->row()->s_card_type));
$cc_number = $useRdetail->row()->s_card_number;
$cv2 = $useRdetail->row()->s_cvv;
$exp_month = $useRdetail->row()->month;
$exp_year = $useRdetail->row()->year;


//description of the items

$order_desc = 'Purchase from silibi,Inc';

$custom = $this->session->userdata('transaction_id');

$invoice = date('U');

$order_total = $this->getTotlaCost();


$Address = PayPalTypes::AddressType($fname.''.$lname, $address1, $address2, $city, $state, $zip, $cc_country, $phone);

$PersonName = PayPalTypes:TongueersonNameType($salutation,$fname,'',$lname);

$PayerInfo = PayPalTypes:TongueayerInfoType($email,'israelekpo','verified',$PersonName,$cc_country,'',$Address);

$CreditCardDetails = PayPalTypes::CreditCardDetailsType($cc_type,$cc_number,$exp_month,$exp_year,$PayerInfo,$cv2);

$PaymentDetails = PayPalTypes:TongueaymentDetailsType($order_total,'','','','', $order_desc, $custom, $invoice, '', site_url('cpaypal/verify_ipn'), $Address);

$Paypal->setParams($paymentAction,$PaymentDetails,$CreditCardDetails,$ip,$unique_session_id);

$Paypal->addPaymentItem('Books','ItemNumber SILIBI',1,'','',$currency_code);

$Paypal->execute();

if($Paypal->success()) {
$response = $Paypal->getAPIResponse();
// if the transaction is complete and success store the information

$acknowledge = $response->Ack;
$amount = $response->Amount->_;
$txn_id = $response->TransactionID;
$paymentdate = $response->Timestamp;
$CorrelationID = $response->CorrelationID;
$Build = $response->Build;
$version = $response->Version;
$custom = $this->session->userdata('transaction_id');
$this->MCheckout->storePaypal_response($custom,$paymentdate,$amount,$txn_id,$custom,$acknowledge,$acknowledge);

// call stored procedure to store this information


} else {
$response = $Paypal->getAPIException();
}


// if you use native header will get error
$redirect = "[removed]";
$redirect .= "self.location='/confirmation';";
$redirect .= "[removed]";
echo $redirect;


}

//----------------------------------------------------------------------------------------------------------------
//get the option (method name) to execute
//----------------------------------------------------------------------------------------------------------------

function Payment_method_name() {
return $this->WebsitePaymentsPro->selectOperation('DoDirectPayment');
}
//----------------------------------------------------------------------------------------------------------------
//get the total Cost for the transaction
//----------------------------------------------------------------------------------------------------------------

function getTotlaCost() {
$transaction_id = $this->session->userdata('transaction_id');
$totalCost = $this->MCheckout->getCostTotal($transaction_id);
if($totalCost->num_rows() > 0 ) {
return $totalCost->row()->f_total_amount;
}
}
}
?>



Thanks in advance




Theme © iAndrew 2016 - Forum software by © MyBB