Example #1
0
}

$payment = new SI_Payment();
$payment->company_id = $company_id;
$title = "Add Payment";

if($_POST['save']){
	$payment->amount = preg_replace('/[^0-9\.]/','', $_POST['amount']);
	if($payment->amount > $invoice->getTotal()){
		fatal_error("Amount can not be more than amount due on the invoice!\n");	
	}
	$payment->timestamp = time();
	$payment->type = 'CC';
	
	// Process the card
	$cc_processor = SI_CCProcessor::getInstance();
	$params = array(
		'id' => $company_id,
		'first_name' => $_POST['card_first_name'],
		'last_name' => $_POST['card_last_name'],
		'address' => $_POST['card_address'],
		'city' => $_POST['card_city'],
		'state' => $_POST['card_state'],
		'zip' => $_POST['card_zip'],
		'cc_number' => $_POST['card_number'],
		'cc_expiration_month' => $_POST['card_exp_month'],
		'cc_expiration_year' => $_POST['card_exp_year'],
		'cc_type' => $_POST['card_type'],
		'cc_cvv' => $_POST['card_cvv'],
		'amount' => $payment->amount
	);