Exemple #1
0
$logger->log('ACH API page called', Zend_Log::INFO);
if ($_POST['pg_response_code'] == 'A01') {
    $logger->log('ACH validate success', Zend_Log::INFO);
    //insert into payments
    $paypal_data = "";
    foreach ($_POST as $key => $value) {
        $paypal_data .= "\n{$key}: {$value}";
    }
    $logger->log('ACH Data:', Zend_Log::INFO);
    $logger->log($paypal_data, Zend_Log::INFO);
    $check_payment = new payment();
    $check_payment->filter = 'online_payment_id';
    $check_payment->online_payment_id = $_POST['pg_consumerorderid'];
    $check_payment->domain_id = '1';
    $number_of_payments = $check_payment->count();
    $logger->log('ACH - number of times this payment is in the db: ' . $number_of_payments, Zend_Log::INFO);
    if ($number_of_payments > 0) {
        $xml_message = 'Online payment for invoices: ' . $_POST['pg_consumerorderid'] . ' has already been entered into Simple Invoices';
        $logger->log($xml_message, Zend_Log::INFO);
    }
    if ($number_of_payments == '0') {
        $payment = new payment();
        $payment->ac_inv_id = $_POST['pg_consumerorderid'];
        $payment->ac_amount = $_POST['pg_total_amount'];
        $payment->ac_notes = $paypal_data;
        $payment->ac_date = date('Y-m-d');
        $payment->online_payment_id = $_POST['pg_consumerorderid'];
        $payment->domain_id = '1';
        $payment_type = new payment_type();
        $payment_type->type = "ACH";