sfraise
03-20-2009, 04:13 AM
I'm trying to integrate ccbill with osdate, everything works, form gets prefilled with correct variables, and payments can be successfully made. I just can't get the membership level to get upgraded using the post back system. But here's the weird thing, it worked once, but then never again. I didn't change a thing in the post back form so I'm going crazy trying to figure this thing out.
Here is the ccbill_notify.php code that the variables from ccbill get posted back to:
<?php
if ( !defined( 'SMARTY_DIR' ) ) {
include_once( 'init.php' );
}
//already processed subscription_id, exit
$trnrec=$osDB->getRow('select * from ! where txn_id = ? ', array(TRANSACTIONS_TABLE, $_POST['subscription_id'] ));
if( $trnrec['id'] )
exit;
// amount paid is less than amount expected
$trnrec=$osDB->getRow('select * from ! where invoice_no = ? ', array(TRANSACTIONS_TABLE, $_POST['invoiceid'] ));
if( $_POST['initialPrice'] < $trnrec['amount_paid'] )
{
$params['payment_status'] = 'Error';
}
else {
// deals with both Approval and Denial URLs
if ( isset($_POST['subscription_id']) && strlen($_POST['subscription_id']) > 3 ) {
$params['payment_status'] = 'Completed';
} elseif ( isset($_POST['reasonForDecline']) ) {
$params['payment_status'] = 'Declined';
} else {$params['payment_status'] = 'Error'; }
}
$params['txn_id'] = $_POST['subscription_id'];
$params['valid'] = true;
$params['pay_txn_id'] = $pay_txn_id = $_POST['invoiceid'];
$params['paid_thru'] = 'ccbill';
$params['amount'] = $_POST['initialPrice'];
$params['email'] = $_POST['email'];
$params['vars'] = serialize($_POST);
$level_name = process_payment_info($params);
$levels =$osDB->getRow('select mem.name, trn.payment_status from ! as trn, ! as mem where trn.invoice_no = ? and mem.roleid = trn.to_membership', array(TRANSACTIONS_TABLE, MEMBERSHIP_TABLE, $pay_txn_id) );
$t->assign ( 'level', $levels['name'] .' - Status: '.$levels['payment_status']);
$_SESSION['security'] = '';
hasRight('');
$t->assign('rendered_page', $t->fetch('checkout_process.tpl') );
$t->display( 'index.tpl' );
exit;
Is there anything in here that anyone can see that would prevent the process from working at all? It's writing new lines to the transaction database but it never completes outside of the one single time that it actually worked. Please help.
Here is the ccbill_notify.php code that the variables from ccbill get posted back to:
<?php
if ( !defined( 'SMARTY_DIR' ) ) {
include_once( 'init.php' );
}
//already processed subscription_id, exit
$trnrec=$osDB->getRow('select * from ! where txn_id = ? ', array(TRANSACTIONS_TABLE, $_POST['subscription_id'] ));
if( $trnrec['id'] )
exit;
// amount paid is less than amount expected
$trnrec=$osDB->getRow('select * from ! where invoice_no = ? ', array(TRANSACTIONS_TABLE, $_POST['invoiceid'] ));
if( $_POST['initialPrice'] < $trnrec['amount_paid'] )
{
$params['payment_status'] = 'Error';
}
else {
// deals with both Approval and Denial URLs
if ( isset($_POST['subscription_id']) && strlen($_POST['subscription_id']) > 3 ) {
$params['payment_status'] = 'Completed';
} elseif ( isset($_POST['reasonForDecline']) ) {
$params['payment_status'] = 'Declined';
} else {$params['payment_status'] = 'Error'; }
}
$params['txn_id'] = $_POST['subscription_id'];
$params['valid'] = true;
$params['pay_txn_id'] = $pay_txn_id = $_POST['invoiceid'];
$params['paid_thru'] = 'ccbill';
$params['amount'] = $_POST['initialPrice'];
$params['email'] = $_POST['email'];
$params['vars'] = serialize($_POST);
$level_name = process_payment_info($params);
$levels =$osDB->getRow('select mem.name, trn.payment_status from ! as trn, ! as mem where trn.invoice_no = ? and mem.roleid = trn.to_membership', array(TRANSACTIONS_TABLE, MEMBERSHIP_TABLE, $pay_txn_id) );
$t->assign ( 'level', $levels['name'] .' - Status: '.$levels['payment_status']);
$_SESSION['security'] = '';
hasRight('');
$t->assign('rendered_page', $t->fetch('checkout_process.tpl') );
$t->display( 'index.tpl' );
exit;
Is there anything in here that anyone can see that would prevent the process from working at all? It's writing new lines to the transaction database but it never completes outside of the one single time that it actually worked. Please help.