当前位置: 首页>>代码示例>>PHP>>正文


PHP Transaction::addPayment方法代码示例

本文整理汇总了PHP中Transaction::addPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Transaction::addPayment方法的具体用法?PHP Transaction::addPayment怎么用?PHP Transaction::addPayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


在下文中一共展示了Transaction::addPayment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: confirm

 public function confirm()
 {
     $this->log->write('Starting');
     if (!isset($this->request->request['invoiceId'])) {
         $json['error'] = "Unexpected error";
     } else {
         Transaction::addPayment($this->customer->getId(), $this->request->request['invoiceId'], $this->registry);
         $invoice = InvoiceDAO::getInstance()->getInvoice($this->request->request['invoiceId']);
         $json['newStatus'] = $this->load->model('localisation/invoice')->getInvoiceStatus($invoice->getStatusId(), $this->session->data['language_id']);
     }
     //        $this->log->write(print_r($json, true));
     $this->getResponse()->setOutput(json_encode($json));
 }
开发者ID:ralfeus,项目名称:moomi-daeri.com,代码行数:13,代码来源:invoice.php

示例2: addCredit

 public static function addCredit($customerId, $amount, $currency, $registry, $description = "")
 {
     //        Transaction::$instance->log->write("Starting");
     //        $customer = CustomerDAO::getInstance()->getCustomer($customerId);
     //        Transaction::$instance->log->write("Adding transaction");
     Transaction::addTransaction(0, $customerId, -$amount, $currency, $description);
     /// Try to pay all payment awaiting invoices
     $invoices = InvoiceDAO::getInstance()->getInvoices(array("filterCustomerId" => array((int) $customerId), "filterInvoiceStatusId" => array(IS_AWAITING_PAYMENT)));
     if ($invoices) {
         foreach ($invoices as $invoice) {
             Transaction::addPayment($customerId, $invoice['invoice_id'], $registry);
         }
     }
 }
开发者ID:ralfeus,项目名称:moomi-daeri.com,代码行数:14,代码来源:Transaction.php

示例3: jsonp

include '../lib/txn.php';
include '../lib/eps-express.php';
$id = (int) $_REQUEST['id'];
$amount = $_REQUEST['amount'];
if (!$id || !$amount) {
    die_jsonp("Either transaction or amount was not specified.");
}
$person_id = (int) $_REQUEST['person'];
$person = $person_id ? person_load($db, $person_id) : false;
$account = $person['payment_account_id'];
if (!$person_id || !$person || !$account) {
    die_jsonp("No person specified or no card stored for person.");
}
$eps = new EPS_Express();
$response = $eps->CreditCardSalePaymentAccount($id, $amount, $account);
$xml = new SimpleXMLElement($response);
if ($xml->Response->ExpressResponseCode != 0) {
    die_jsonp((string) $xml->Response->ExpressResponseMessage);
}
$method = 'credit';
$cc = array();
$cc['cc_txn'] = $xml->Response->Transaction->TransactionID;
$cc['cc_approval'] = $xml->Response->Transaction->ApprovalNumber;
$cc['cc_type'] = $xml->Response->Card->CardLogo;
$txn = new Transaction($db, $id);
try {
    $payment = $txn->addPayment($method, $amount, $cc);
} catch (Exception $e) {
    die_jsonp($e->getMessage());
}
echo jsonp(array('payment' => $payment, 'txn' => txn_load($db, $id), 'payments' => txn_load_payments($db, $id)));
开发者ID:jacques,项目名称:scat,代码行数:31,代码来源:cc-stored.php

示例4: jsonp

include '../scat.php';
include '../lib/txn.php';
include '../lib/eps-express.php';
$id = (int) $_REQUEST['txn'];
$payment = (int) $_REQUEST['payment'];
if (!$id) {
    die_jsonp("Transaction not specified.");
}
if (!$payment) {
    die_jsonp("Payment to reverse from not specified.");
}
$q = "SELECT cc_txn, amount FROM payment WHERE id = {$payment}";
list($cc_txn, $cc_amount) = $db->get_one_row($q) or die_jsonp("Unable to find transaction information.");
$eps = new EPS_Express();
$response = $eps->CreditCardVoid($id, $cc_txn);
$xml = new SimpleXMLElement($response);
if ($xml->Response->ExpressResponseCode != 0) {
    die_jsonp((string) $xml->Response->ExpressResponseMessage);
}
$method = 'credit';
$cc = array();
$cc['cc_txn'] = $xml->Response->Transaction->TransactionID;
$cc['cc_approval'] = $xml->Response->Transaction->ApprovalNumber;
$cc['cc_type'] = $xml->Response->Card->CardLogo;
$txn = new Transaction($db, $id);
try {
    $payment = $txn->addPayment($method, bcmul($cc_amount, -1), $cc);
} catch (Exception $e) {
    die_jsonp($e->getMessage());
}
echo jsonp(array('payment' => $payment, 'txn' => txn_load($db, $id), 'payments' => txn_load_payments($db, $id)));
开发者ID:jacques,项目名称:scat,代码行数:31,代码来源:cc-void.php

示例5: jsonp

}
$method = $_REQUEST['method'];
$amount = $_REQUEST['amount'];
// validate method
if (!in_array($method, array('cash', 'credit', 'square', 'stripe', 'dwolla', 'gift', 'check', 'discount', 'bad', 'donation', 'internal'))) {
    die_jsonp("Invalid method specified.");
}
$txn = new Transaction($db, $id);
$extra = array();
// extra payment info
// handle % discounts
if ($method == 'discount') {
    if (preg_match('!^(/)?\\s*(\\d+)(%|/)?\\s*$!', $amount, $m)) {
        if ($m[1] || $m[3]) {
            $amount = round($txn->total * $m[2] / 100, 2, PHP_ROUND_HALF_EVEN);
            $extra['discount'] = $m[2];
        }
    }
}
if ($method == 'credit') {
    $cc = array();
    foreach (array('cc_txn', 'cc_approval', 'cc_lastfour', 'cc_expire', 'cc_type') as $field) {
        $extra[$field] = $_REQUEST[$field];
    }
}
try {
    $payment = $txn->addPayment($method, $amount, $extra);
} catch (Exception $e) {
    die_jsonp($e->getMessage());
}
echo jsonp(array('payment' => $payment, 'txn' => txn_load($db, $id), 'payments' => txn_load_payments($db, $id)));
开发者ID:jacques,项目名称:scat,代码行数:31,代码来源:txn-add-payment.php

示例6: handleCredit

 private function handleCredit($invoiceId)
 {
     //        $modelTransaction = $this->getLoader()->model('sale/transaction');
     $invoice = InvoiceDAO::getInstance()->getInvoice($invoiceId);
     //        $customer = CustomerDAO::getInstance()->getCustomer($invoice['customer_id']);
     $temp = $invoice->getCustomer();
     if ($temp['await_invoice_confirmation']) {
         InvoiceDAO::getInstance()->setInvoiceStatus($invoiceId, IS_AWAITING_CUSTOMER_CONFIRMATION);
     } else {
         $totalToPay = $this->getCurrency()->convert($invoice->getTotalCustomerCurrency(), $invoice->getCurrencyCode(), $temp['base_currency_code']);
         if ($temp['balance'] < $totalToPay) {
             if ($temp['allow_overdraft']) {
                 Transaction::addPayment($temp['customer_id'], $invoiceId, $this->registry);
                 InvoiceDAO::getInstance()->setInvoiceStatus($invoiceId, IS_PAID);
             } else {
                 InvoiceDAO::getInstance()->setInvoiceStatus($invoiceId, IS_AWAITING_PAYMENT);
             }
         } else {
             Transaction::addPayment($temp['customer_id'], $invoiceId, $this->registry);
             InvoiceDAO::getInstance()->setInvoiceStatus($invoiceId, IS_PAID);
         }
     }
     $this->getLoader()->model('tool/communication')->sendMessage($temp['customer_id'], sprintf($this->getLanguage()->get('INVOICE_STATUS_NOTIFICATION'), $this->getLoader()->model('localisation/invoice')->getInvoiceStatus($invoiceId), $this->getCurrency()->format($invoice->getTotalCustomerCurrency(), $invoice->getCurrencyCode(), 1), $this->getCurrency()->format(CustomerDAO::getInstance()->getCustomerBalance($temp['customer_id']), $temp['base_currency_code'], 1)), SYS_MSG_INVOICE_CREATED);
 }
开发者ID:ralfeus,项目名称:moomi-daeri.com,代码行数:24,代码来源:invoice.php


注:本文中的Transaction::addPayment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。