本文整理汇总了PHP中Invoice::addPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::addPayment方法的具体用法?PHP Invoice::addPayment怎么用?PHP Invoice::addPayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::addPayment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Table
}
} else {
if ($item_id > 0) {
$invoice_table = new Table('cc_invoice', 'reference');
$invoice_clause = "id = " . $item_id;
$result_invoice = $invoice_table->Get_list($DBHandle, $invoice_clause);
if (is_array($result_invoice) && sizeof($result_invoice) == 1) {
$reference = $result_invoice[0][0];
$field_insert = "date, payment, card_id, description";
$value_insert = "'{$nowDate}', '" . $amount_paid . "', '{$id}', '(" . $transaction_data[0][4] . ") " . gettext('Invoice Payment Ref: ') . "{$reference} '";
$instance_sub_table = new Table("cc_logpayment", $field_insert);
$id_payment = $instance_sub_table->Add_table($DBHandle, $value_insert, null, null, "id");
write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "-transactionID={$transactionID}" . " Add_table cc_logpayment : {$field_insert} - VALUES {$value_insert}");
//update invoice to paid
$invoice = new Invoice($item_id);
$invoice->addPayment($id_payment);
$invoice->changeStatus(1);
$items = $invoice->loadItems();
foreach ($items as $item) {
if ($item->getExtType() == 'DID') {
$QUERY = "UPDATE cc_did_use set month_payed = month_payed+1 , reminded = 0 WHERE id_did = '" . $item->getExtId() . "' AND activated = 1 AND ( releasedate IS NULL OR releasedate < '1984-01-01 00:00:00') ";
$instance_table->SQLExec($DBHandle, $QUERY, 0);
}
if ($item->getExtType() == 'SUBSCR') {
//Load subscription
write_log(LOGFILE_EPAYMENT, basename(__FILE__) . ' line:' . __LINE__ . "- Type SUBSCR");
$table_subsc = new Table('cc_card_subscription', 'paid_status');
$subscr_clause = "id = " . $item->getExtId();
$result_subscr = $table_subsc->Get_list($DBHandle, $subscr_clause);
if (is_array($result_subscr)) {
$subscription = $result_subscr[0];
示例2: doUpgrade
function doUpgrade(Invoice $invoice, InvoiceItem $item, Invoice $newInvoice, ProductUpgrade $upgrade)
{
if (!$this->getConfig('datalink_user') || !$this->getConfig('datalink_pass')) {
$this->getDi()->errorLogTable->log("ccBill plugin error: Datalink is not configured!");
return;
}
$payments = $invoice->getPaymentRecords();
$subscriptionId = $payments[0]->transaction_id;
$vars = array('clientAccnum' => $this->getConfig('account'), 'usingSubacc' => $this->getConfig('subaccount_id'), 'subscriptionId' => $subscriptionId, 'newClientAccnum' => $this->getConfig('account'), 'newClientSubacc' => $this->getConfig('subaccount_id'), 'sharedAuthentication' => 1, 'action' => 'chargeByPreviousTransactionId', 'currencyCode' => $this->currency_codes[$invoice->currency], 'initialPrice' => $newInvoice->first_total, 'initialPeriod' => $this->getDays($newInvoice->first_period), 'returnXML' => 1, 'username' => $this->getConfig('datalink_user'), 'password' => $this->getConfig('datalink_pass'));
if ($newInvoice->rebill_times) {
$vars['recurringPrice'] = $newInvoice->second_total;
$vars['recurringPeriod'] = $this->getDays($newInvoice->second_period);
$vars['rebills'] = $newInvoice->rebill_times == IProduct::RECURRING_REBILLS ? 99 : $newInvoice->rebill_times;
} else {
$vars['recurringPrice'] = 0;
$vars['recurringPeriod'] = 0;
$vars['rebills'] = 0;
}
$r = new Am_HttpRequest($requestString = "https://bill.ccbill.com/jpost/billingApi.cgi?" . http_build_query($vars, '', '&'));
$response = $r->send();
if (!$response) {
$this->getDi()->errorLogTable->log('ccBill Billing API error: Unable to contact datalink server');
throw new Am_Exception_InternalError('ccBill Billing API error: Unable to contact datalink server');
}
$resp = $response->getBody();
// Log datalink requests;
$this->getDi()->errorLogTable->log(sprintf("ccBill billing API debug:\n%s\n%s", $requestString, $resp));
$xml = simplexml_load_string($resp);
if ((string) $xml->approved != "1") {
throw new Am_Exception_InternalError('ccBill Subscription Management error: Incorrect response received while attempting to upgrade subscription!');
}
$tr = new Am_Paysystem_Transaction_Ccbill_Upgrade($this, $xml);
// Add payment to new invocie;
$newInvoice->addPayment($tr);
// Cancel old one
$invoice->setCancelled(true);
}
示例3: _addPendingInvoiceAndPayment
protected function _addPendingInvoiceAndPayment(Invoice $invoice, Am_Form $form, $vars)
{
if (!$vars['paysys_id']) {
$form->getElementById('add-invoice-paysys_id')->setError(___('This field is required for choosen action'));
}
if (!$vars['receipt']) {
$form->getElementById('add-invoice-receipt')->setError(___('This field is required for choosen action'));
}
if (!$vars['paysys_id'] || !$vars['receipt']) {
return false;
}
try {
$invoice->setPaysystem($vars['paysys_id'], false);
} catch (Am_Exception_InputError $e) {
$form->setError($e->getMessage());
return false;
}
$errors = $invoice->validate();
if ($errors) {
$form->setError(current($errors));
return false;
}
$invoice->data()->set('added-by-admin', $this->getDi()->authAdmin->getUserId());
$invoice->save();
if ($invoice->first_total <= 0) {
$invoice->addAccessPeriod(new Am_Paysystem_Transaction_Free($this->getDi()->plugins_payment->get($vars['paysys_id'])));
} else {
$transaction = new Am_Paysystem_Transaction_Manual($this->getDi()->plugins_payment->get($vars['paysys_id']));
$transaction->setAmount($invoice->first_total)->setReceiptId($vars['receipt'])->setTime(new DateTime($vars['tm_added']));
$invoice->addPayment($transaction);
}
return true;
}
示例4: processValidated
/**
* Once the process of IPN validation is completed, we can do
* actions in this method. Use @link Invoice::startAccessNow(),
* @link Invoice::stopAccessNow(), @link Invoice::addPaymentAndAccess()
* @link Invoice::stopAccessAfterPaidPeriodOver()
*/
public function processValidated()
{
$this->invoice->addPayment($this);
}