本文整理汇总了PHP中Invoice::setCancelled方法的典型用法代码示例。如果您正苦于以下问题:PHP Invoice::setCancelled方法的具体用法?PHP Invoice::setCancelled怎么用?PHP Invoice::setCancelled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice::setCancelled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
$this->invoice = $invoice;
list($payment) = $invoice->getPaymentRecords();
$params = array('key' => $this->getConfig('key'), 'ref' => $payment->receipt_id, 'uid' => $payment->user_id, 'type' => 2);
$params['sign'] = $this->calculateSignature($params, $this->getConfig('secret'));
$requst = new Am_HttpRequest(self::URL_TICKET, Am_HttpRequest::METHOD_POST);
$requst->addPostParameter($params);
$log = $this->logRequest($requst);
$responce = $requst->send();
$log->add($responce);
if ($responce->getStatus() != 200) {
$result->setFailed('Incorrect HTTP response status: ' . $responce->getStatus());
return;
}
$res = Am_Controller::decodeJson($responce->getBody());
if ($res['result'] == 1) {
$invoice->setCancelled();
$result->setSuccess();
return;
}
$result->setFailed($res['errors']);
}
示例2: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
$invoice->setCancelled(true);
}
示例3: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
$payment = current($invoice->getPaymentRecords());
try {
$this->cancelInvoice($payment, $result);
$invoice->setCancelled(true);
} catch (Exception $e) {
$result->setFailed($e->getMessage());
}
}
示例4: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
if ($actionName == 'cancel-admin') {
$invoice->setCancelled(true);
} else {
parent::cancelAction($invoice, $actionName, $result);
}
}
示例5: 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);
}