Example #1
0
<?php

// Include the paypal library
include_once 'TwoCo.php';
// Create an instance of the authorize.net library
$my2CO = new TwoCo();
// Log the IPN results
$my2CO->ipnLog = TRUE;
// Specify your authorize login and secret
$my2CO->setSecret('YOUR_SECRET_KEY');
// Enable test mode if needed
$my2CO->enableTestMode();
// Check validity and write down it
if ($my2CO->validateIpn()) {
    file_put_contents('2co.txt', 'SUCCESS');
} else {
    file_put_contents('2co.txt', "FAILURE\n\n" . $my2CO->ipnData);
}
Example #2
0
 *********************************************************************************************************
 *
 * Authors:     Liran Tal <*****@*****.**>
 *
 *********************************************************************************************************
 */
// Include the 2checkout library
include_once 'include/merchant/TwoCo.php';
include_once 'include/common/common.php';
include 'library/config_read.php';
// Create an instance of the 2Checkout library
$my2CO = new TwoCo();
// Log the IPN results
// $my2CO->ipnLog = TRUE;
// Specify your 2Checkout login and secret
$my2CO->setSecret($configValues['CONFIG_MERCHANT_IPN_SECRET']);
// Enable test mode if needed
$my2CO->enableTestMode();
// Check validity and write it down.
if ($my2CO->validateIpn()) {
    $logFile = $configValues['CONFIG_LOG_MERCHANT_IPN_FILENAME'];
    logToFile("\n", $logFile);
    saveToDb($my2CO->ipnData, "Completed");
    include 'library/opendb.php';
    require_once 'include/common/provisionUser.php';
    // the payment is valid, we activate the user by adding him to freeradius's set of tables (radcheck etc)
    // get transaction id from 2checkout ipn POST
    $txnId = $dbSocket->escapeSimple($my2CO->ipnData['custom']);
    provisionUser($dbSocket, $txnId);
    include 'library/closedb.php';
} else {
<?php

include_once '../../../wp-load.php';
include_once 'lib/gateway/TwoCo.php';
include_once 'eStore_process_payment_data.php';
$my2CO = new TwoCo();
// Log the INS results
$debug_on = get_option('eStore_cart_enable_debug');
if ($debug_on) {
    $my2CO->ipnLog = TRUE;
}
// Specify your 2co login and secret
$tco_secret_word = get_option('eStore_2co_secret_word');
$my2CO->setSecret($tco_secret_word);
// Enable test mode if needed
if (get_option('eStore_cart_enable_sandbox')) {
    $my2CO->enableTestMode();
}
// Check validity and write down it
if ($my2CO->validateIpn()) {
    $txn_id = $my2CO->ipnData['invoice_id'];
    if (eStore_txn_prcoessed($txn_id)) {
        eStore_do_thank_you_page_display_tasks_with_txn_id($txn_id);
    } else {
        handle_payment_data($my2CO->ipnData, "2co");
    }
} else {
    handle_payment_data($my2CO->ipnData, "2co");
}
Example #4
0
<?php

// Include the paypal library
include_once 'TwoCo.php';
// Create an instance of the authorize.net library
$my2CO = new TwoCo();
// Log the IPN results
$my2CO->ipnLog = TRUE;
// Specify your authorize login and secret
$my2CO->setSecret('tango');
// Enable test mode if needed
$my2CO->enableTestMode();
// Check validity and write down it
if ($my2CO->validateIpn()) {
    file_put_contents('2co.txt', 'SUCCESS');
} else {
    file_put_contents('2co.txt', "FAILURE\n\n" . $my2CO->ipnData);
}
Example #5
0
 function two_checkout()
 {
     // Include the paypal library
     include_once APPPATH . 'libraries/payment/TwoCo.php';
     $this->gateway = '3';
     $gate = $this->db->get_where('gateways', array('name' => 'twoco'))->row();
     $gate_conf = unserialize($gate->settings);
     // Create an instance of the authorize.net library
     $my2CO = new TwoCo();
     // Log the IPN results
     // $my2CO->ipnLog = TRUE;
     // Specify your authorize login and secret
     $my2CO->setSecret($gate_conf['secret_id']);
     // Enable test mode if needed
     $my2CO->enableTestMode();
     // Check validity and write down it
     if ($my2CO->validateIpn()) {
         $settings = unserialize(base64_decode($my2CO->ipnData['custom']));
         if ($settings['type'] == 'reg') {
             $this->_newUserPayment($settings['user_id'], $my2CO->ipnData['total']);
             redirect('/user/pay_complete');
         }
         redirect('/user/pay_cancel');
     } else {
         $this->_logError($my2CO->ipnData);
         redirect('/user/pay_cancel');
     }
 }