Exemplo n.º 1
0
		'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
	);
	$cc_result = $cc_processor->process($params);
	if($cc_result === false){
		fatal_error('Error processing card: '.$cc_processor->getLastError());	
	}
	
	if($payment->add()){
		//TODO: Attach to oldest invoices
		if($payment->attachInvoices(array($_POST['invoice_id'] => $payment->amount)) === FALSE){
			$error_msg .= "Error applying payment to invoice!\n";
			debug_message($payment->getLastError());
		}

		// Add the company transaction
		$ct = new SI_CompanyTransaction();
		$ct->amount = -$payment->amount;
		$ct->company_id = $payment->company_id;
		$ct->description = "Credit card payment of ".$payment->amount." on ".date("n/j/y", $payment->timestamp);
		$ct->timestamp = time();
		if($ct->add() === FALSE){
			$error_msg .= "Error adding transaction to company account!\n";
			debug_message($ct->getLastError());
		}

		// Update the payment with the company transaction id and auth code
		$payment->trans_id = $ct->id;
Exemplo n.º 2
0
	$code = new SI_ItemCode();
	$output = $code->exportQB();
	if($output === FALSE){
		fatal_error("Error getting item code export data!\n".$code->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'account'){
	$account = new SI_Account();
	$output = $account->exportQB();
	if($output === FALSE){
		fatal_error("Error getting account export data!\n".$account->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'payment'){
	$payment = new SI_Payment();
	$output = $payment->exportQB();
	if($output === FALSE){
		fatal_error("Error getting payment export data!\n".$payment->getLastError());
	}
}elseif(strtolower($_REQUEST['mode']) == 'invoice'){
	$invoice = new SI_Invoice();
	$output = $invoice->exportQB();
	if($output === FALSE){
		fatal_error("Error getting invoice export data!\n".$invoice->getLastError());
	}
}else{
	fatal_error("Unknown export mode!");
}

ob_end_clean();
header('Content-type: application/iif');
header('Content-Disposition: attachment; filename="'.$_REQUEST[mode].'.iif"');
print($output);