Exemplo n.º 1
0
     $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";
     $payment_type->domain_id = '1';
     $payment->ac_payment_type = $payment_type->select_or_insert_where();
     $logger->log('ACH - payment_type=' . $payment->ac_payment_type, Zend_Log::INFO);
     $payment->insert();
     $invoiceobj = new invoice();
     $invoice = $invoiceobj->select($_POST['pg_consumerorderid']);
     $biller = getBiller($invoice['biller_id']);
     //send email
     $body = "A PaymentsGateway.com payment of " . $_POST['pg_total_amount'] . " was successfully received into Simple Invoices\n";
     $body .= "for invoice: " . $_POST['pg_consumerorderid'];
     $body .= " from " . $_POST['pg_billto_postal_name_company'] . " on " . date('m/d/Y');
     $body .= " at " . date('g:i A') . "\n\nDetails:\n";
     $body .= $paypal_data;
     $email = new email();
     $email->notes = $body;
     $email->to = $biller['email'];
     $email->from = "*****@*****.**";
     $email->subject = 'PaymentsGateway.com -Instant Payment Notification - Recieved Payment';
     $email->send();
Exemplo n.º 2
0
<?php

//stop the direct browsing to this file - let index.php handle which files get displayed
checkLogin();
# Deal with op and add some basic sanity checking
#insert - process payment
#op=pay_selected_invoice means the user came from the print_view or manage_invoces
#op=pay_invoice means the user came from the process_paymen page
global $db_server;
global $auth_session;
if (isset($_POST['process_payment'])) {
    $payment = new payment();
    $payment->ac_inv_id = $_POST['invoice_id'];
    $payment->ac_amount = $_POST['ac_amount'];
    $payment->ac_notes = $_POST['ac_notes'];
    $payment->ac_date = SqlDateWithTime($_POST['ac_date']);
    $payment->ac_payment_type = $_POST['ac_payment_type'];
    $result = $payment->insert();
    $saved = !empty($result) ? "true" : "false";
    if ($saved == 'true') {
        $display_block = $LANG['save_payment_success'];
    } else {
        $display_block = $LANG['save_payment_failure'] . "<br />" . $sql;
    }
    $refresh_total = "<meta http-equiv='refresh' content='27;url=index.php?module=payments&view=manage' />";
}
$smarty->assign('display_block', $display_block);
$smarty->assign('pageActive', 'payment');
$smarty->assign('active_tab', '#money');
Exemplo n.º 3
0
 public function payment()
 {
     global $config;
     global $logger;
     //set customer,biller and preference if not defined
     if (empty($this->customer)) {
         $this->customer = getCustomer($this->invoice['customer_id'], $this->domain_id);
     }
     if (empty($this->biller)) {
         $this->biller = getBiller($this->invoice['biller_id'], $this->domain_id);
     }
     if (empty($this->preference)) {
         $this->preference = getPreference($this->invoice['preference_id'], $this->domain_id);
     }
     $eway = new ewaylib($this->biller['eway_customer_id'], 'REAL_TIME', false);
     //Eway only accepts amount in cents - so times 100
     $value = $this->invoice['total'] * 100;
     $eway_invoice_total = htmlsafe(trim($value));
     $logger->log("eway total: " . $eway_invoice_total, Zend_Log::INFO);
     $enc = new encryption();
     $key = $config->encryption->default->key;
     $credit_card_number = $enc->decrypt($key, $this->customer['credit_card_number']);
     $eway->setTransactionData("TotalAmount", $eway_invoice_total);
     //mandatory field
     $eway->setTransactionData("CustomerFirstName", $this->customer['name']);
     $eway->setTransactionData("CustomerLastName", "");
     $eway->setTransactionData("CustomerAddress", "");
     $eway->setTransactionData("CustomerPostcode", "");
     $eway->setTransactionData("CustomerInvoiceDescription", "");
     $eway->setTransactionData("CustomerEmail", $this->customer['email']);
     $eway->setTransactionData("CustomerInvoiceRef", $this->invoice['index_name']);
     $eway->setTransactionData("CardHoldersName", $this->customer['credit_card_holder_name']);
     //mandatory field
     $eway->setTransactionData("CardNumber", $credit_card_number);
     //mandatory field
     $eway->setTransactionData("CardExpiryMonth", $this->customer['credit_card_expiry_month']);
     //mandatory field
     $eway->setTransactionData("CardExpiryYear", $this->customer['credit_card_expiry_year']);
     //mandatory field
     $eway->setTransactionData("Option1", "");
     $eway->setTransactionData("Option2", "");
     $eway->setTransactionData("Option3", "");
     $eway->setTransactionData("TrxnNumber", $this->invoice['id']);
     //special preferences for php Curl
     //pass a long set to zero value stops curl from verifying peer's certificate
     $eway->setCurlPreferences(CURLOPT_SSL_VERIFYPEER, 0);
     $ewayResponseFields = $eway->doPayment();
     $this->message = $ewayResponseFields;
     $message = "";
     if ($ewayResponseFields["EWAYTRXNSTATUS"] == "False") {
         $logger->log("Transaction Error: " . $ewayResponseFields["EWAYTRXNERROR"] . "<br>\n", Zend_Log::INFO);
         foreach ($ewayResponseFields as $key => $value) {
             $message .= "\n<br>\$ewayResponseFields[\"{$key}\"] = {$value}";
         }
         $logger->log("Eway message: " . $message . "<br>\n", Zend_Log::INFO);
         //header("Location: trasnactionerrorpage.php");
         //exit();
         $return = 'false';
     } else {
         if ($ewayResponseFields["EWAYTRXNSTATUS"] == "True") {
             $logger->log("Transaction Success: " . $ewayResponseFields["EWAYTRXNERROR"] . "<br>\n", Zend_Log::INFO);
             foreach ($ewayResponseFields as $key => $value) {
                 $message .= "\n<br>\$ewayResponseFields[\"{$key}\"] = {$value}";
             }
             $logger->log("Eway message: " . $message . "<br>\n", Zend_Log::INFO);
             //header("Location: trasnactionsuccess.php");
             //exit();
             $payment = new payment();
             $payment->ac_inv_id = $this->invoice['id'];
             #$payment->ac_inv_id = $_POST['invoice'];
             $payment->ac_amount = $this->invoice['total'];
             #$payment->ac_amount = $ewayResponseFields['EWAYRETURNAMOUNT']/100;
             #$payment->ac_amount = $_POST['mc_gross'];
             $payment->ac_notes = $message;
             $payment->ac_date = date('Y-m-d');
             $payment->online_payment_id = $ewayResponseFields['EWAYTRXNNUMBER'];
             $payment->domain_id = $this->domain_id;
             $payment_type = new payment_type();
             $payment_type->type = "Eway";
             $payment_type->domain_id = $this->domain_id;
             $payment->ac_payment_type = $payment_type->select_or_insert_where();
             $logger->log('Paypal - payment_type=' . $payment->ac_payment_type, Zend_Log::INFO);
             $payment->insert();
             #echo $db->lastInsertID();
             $return = 'true';
         }
     }
     return $return;
 }