本文整理汇总了PHP中Mage_Sales_Model_Order::canInvoice方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order::canInvoice方法的具体用法?PHP Mage_Sales_Model_Order::canInvoice怎么用?PHP Mage_Sales_Model_Order::canInvoice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order::canInvoice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _processTransactionPaid
/**
* Creates invoice and sets order state for paid transactions.
*/
protected function _processTransactionPaid()
{
if (!$this->_order->canInvoice()) {
return;
}
$payment = $this->_order->getPayment();
$payment->setTransactionId($this->_receivedData['transaction_id'])->setCurrencyCode($this->_receivedData['currency'])->setPreparedMessage($this->_createIpnComment())->setIsTransactionClosed(1)->registerCaptureNotification($this->_receivedData['amount']);
}
示例2: _createInvoice
/**
* Builds invoice for order
*/
protected function _createInvoice()
{
if (!$this->_order->canInvoice()) {
return;
}
$invoice = $this->_order->prepareInvoice();
$invoice->register()->capture();
$this->_order->addRelatedObject($invoice);
}
示例3: createByOrder
/**
* @throws Payone_Core_Exception_OrderCannotInvoice|Payone_Core_Exception_OrderNotFound
* @param Mage_Sales_Model_Order $order
* @param array $itemsQty
* @param string $invoiceIncrementId
* @return Mage_Sales_Model_Order_Invoice
*/
public function createByOrder(Mage_Sales_Model_Order $order, array $itemsQty = array(), $invoiceIncrementId = null)
{
$orderIncrementId = $order->getIncrementId();
if (!$order->getId()) {
throw new Payone_Core_Exception_OrderNotFound($orderIncrementId);
}
if (!$order->canInvoice()) {
throw new Payone_Core_Exception_OrderCannotInvoice($orderIncrementId);
}
return $this->create($order, $itemsQty, $invoiceIncrementId);
}
示例4: _initInvoice
/**
* @param Mage_Sales_Model_Order $magentoOrder
* @return Mage_Sales_Model_Order_Invoice
* @throws Reverb_ReverbSync_Model_Exception_Data_Order_Update
*/
protected function _initInvoice(Mage_Sales_Model_Order $magentoOrder)
{
if (!$magentoOrder->canInvoice()) {
$this->_inspectWhyCanNotUpdateAndThrowException($magentoOrder);
}
$magentoInvoice = Mage::getModel('sales/service_order', $magentoOrder)->prepareInvoice(array());
if (!$magentoInvoice->getTotalQty()) {
$this->_throwCanNotUpdateException($magentoOrder, self::NO_PRODUCTS_INVOICED);
}
return $magentoInvoice;
}
示例5: _createInvoice
/**
* Create invoice
*/
protected function _createInvoice(Mage_Sales_Model_Order $order, $captureReferenceIds)
{
if ($order->canInvoice()) {
$transactionSave = Mage::getModel('core/resource_transaction');
// Create invoice
$invoice = $order->prepareInvoice()->register();
$invoice->setTransactionId(current($captureReferenceIds));
$transactionSave->addObject($invoice)->addObject($invoice->getOrder());
return $transactionSave->save();
}
return false;
}
示例6: createInvoiceForOrder
/**
* @param Mage_Sales_Model_Order $order
* @return bool|Mage_Sales_Model_Order_Invoice
*/
public function createInvoiceForOrder(Mage_Sales_Model_Order $order)
{
if (!Mage::getStoreConfig('payment/lliqpay_cc/create_invoice') || !$order->canInvoice()) {
return false;
}
$invoice = $order->prepareInvoice();
if (!$invoice) {
return false;
}
$invoice->register()->pay();
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
return $invoice;
}
示例7: canMakePayment
/**
* Check if can make payment for order
*
* @param Mage_Sales_Model_Order $order
* @return bool
*/
public function canMakePayment($order)
{
if ($order->getPayment() && $order->getPayment()->getMethod() == 'purchaseorder' && $order->canShip()) {
return false;
}
if ($order->getStatus() != 'purchaseorder_pending_payment') {
return false;
}
if (!$order->canInvoice()) {
return false;
}
return true;
}
示例8: _confirmOrder
/**
* Confirm the payment of an order
*
* @param array $data
*/
protected function _confirmOrder($data)
{
if (!$this->_succeeded($this->order)) {
if ($data['paymentState'] == 'PENDING') {
$this->order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, Mage::helper('wirecard_checkout_page')->__('The payment authorization is pending.'))->save();
} else {
$this->order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, Mage::helper('wirecard_checkout_page')->__('The amount has been authorized and captured by Wirecard Checkout Page.'))->save();
// invoice payment
if ($this->order->canInvoice()) {
$invoice = $this->order->prepareInvoice();
$invoice->register()->capture();
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
}
// send new order email to customer
$this->order->sendNewOrderEmail();
}
}
$payment = $this->order->getPayment();
$additionalInformation = array();
$additionalInformationString = '';
foreach ($data as $fieldName => $fieldValue) {
switch ($fieldName) {
case 'amount':
case 'currency':
case 'language':
case 'responseFingerprint':
case 'responseFingerprintOrder':
case 'form_key':
case 'paymentState':
case 'orderId':
break;
default:
$additionalInformation[htmlentities($fieldName)] = htmlentities($fieldValue);
$additionalInformationString .= ' | ' . $fieldName . ' - ' . $fieldValue;
}
}
if (count($additionalInformation) != 0) {
$payment->setAdditionalInformation($additionalInformation);
$payment->setAdditionalData(serialize($additionalInformation));
if ($payment->hasAdditionalInformation()) {
Mage::log('Added Additional Information to Order ' . $data['orderId'] . ' :' . $additionalInformationString);
}
}
$payment->save();
}
示例9: _saveInvoice
/**
* Saves an invoice and sets total-paid for the order
*
* @return bool
*/
protected function _saveInvoice()
{
if ($this->_order->canInvoice() && !$this->_order->hasInvoices()) {
$payment = $this->_order->getPayment();
$payment->registerCaptureNotification($this->_order->getBaseGrandTotal());
$this->_order->save();
$this->_debugEmail .= 'Invoice created and saved. \\n';
//sets the invoice's transaction ID as the Buckaroo TRX. This is to allow the order to be refunded using Buckaroo later on.
foreach ($this->_order->getInvoiceCollection() as $invoice) {
if (!isset($this->_postArray['brq_transactions'])) {
continue;
}
$invoice->setTransactionId($this->_postArray['brq_transactions'])->save();
}
return true;
}
return false;
}
示例10: _isEventPossible
/**
* Is event for this order allowed
*
* @param string $type
* @param Mage_Sales_Model_Order $order
* @return boolean
*/
private function _isEventPossible($type, $order)
{
if ($type == 'invoice') {
return $order->canInvoice();
} else {
if ($type == 'creditmemo') {
return $order->canCreditmemo();
} else {
if ($type == 'cancel') {
return $order->canCancel();
}
}
}
return false;
}
示例11: createInvoice
/**
* Create invoice for order
*/
protected function createInvoice(Mage_Sales_Model_Order $order)
{
if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
try {
if (!$order->canInvoice()) {
$order->addStatusHistoryComment('MultiSafepay: Order cannot be invoiced.', false);
$order->save();
return false;
}
//START Handle Invoice
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
$invoice->register();
$invoice->getOrder()->setCustomerNoteNotify(false);
$invoice->getOrder()->setIsInProcess(true);
$order->addStatusHistoryComment('Automatically invoiced by MultiSafepay invoicer.', false);
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
$transactionSave->save();
//END Handle Invoice
//Send Invoice emails
$mail_invoice = $this->getConfigData("mail_invoice");
$send_bno_invoice = $this->getConfigData("bno_no_invoice");
$gateway = $order->getPayment()->getMethodInstance()->_gateway;
if ($mail_invoice && $gateway != 'PAYAFTER') {
$invoice->setEmailSent(true);
$invoice->sendEmail();
$invoice->save();
} elseif ($gateway == 'PAYAFTER' && !$send_bno_invoice && $mail_invoice) {
$invoice->setEmailSent(true);
$invoice->sendEmail();
$invoice->save();
}
$order->setTotalPaid($order->getGrandTotal());
} catch (Exception $e) {
$order->addStatusHistoryComment('MultiSafepay invoicer: Exception occurred during the creation of the invoice. Exception message: ' . $e->getMessage(), false);
$order->save();
}
}
return false;
}
示例12: invoice
public function invoice(Mage_Sales_Model_Order $order, $transactionId, $mail)
{
if ($order->canInvoice()) {
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
$invoice->register();
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
$invoice->setTransactionId($transactionId);
$invoice->pay();
$invoice->save();
$invoice->sendEmail($mail, '');
} else {
foreach ($order->getInvoiceCollection() as $invoice) {
$invoice->pay()->save();
}
}
}
示例13: createInvoice
/**
* @param Mage_Sales_Model_Order $order
*
* @return bool
*/
public function createInvoice($order)
{
if (!$order->getId()) {
return false;
}
$this->log(sprintf('Gerando fatura para o pedido: %s.', $order->getId()));
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'O pagamento foi confirmado e o pedido está sendo processado.', true);
if (!$order->canInvoice()) {
$this->log(sprintf('Impossível gerar fatura para o pedido %s.', $order->getId()), 4);
// TODO define how to handle this
return false;
}
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
$invoice->register();
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
$invoice->sendEmail(true);
$this->log('Fatura gerada com sucesso.');
return true;
}
示例14: saveInvoice
/**
* Save invoice for order
*
* @param Mage_Sales_Model_Order $order
* @return boolean Can save invoice or not
*/
protected function saveInvoice(Mage_Sales_Model_Order $order)
{
if ($order->canInvoice()) {
$invoice = $order->prepareInvoice();
$invoice->register()->capture();
Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder())->save();
return true;
}
return false;
}
示例15: createInvoice
/**
* Create invoice for order
*/
protected function createInvoice(Mage_Sales_Model_Order $order)
{
if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
try {
if (!$order->canInvoice()) {
$order->addStatusHistoryComment('MultiSafepay: Order cannot be invoiced.', false);
$order->save();
return false;
}
//START Handle Invoice
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
$invoice->register();
$invoice->getOrder()->setCustomerNoteNotify(false);
$invoice->getOrder()->setIsInProcess(true);
$order->addStatusHistoryComment('Automatically invoiced by MultiSafepay invoicer.', false);
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
$transactionSave->save();
$payment = $order->getPayment();
$transaction = $payment->getTransaction($this->mspDetails['ewallet']['id']);
if (is_object($transaction)) {
$transaction->setAdditionalInformation(Mage_Sales_Model_Order_Payment_Transaction::RAW_DETAILS, $this->transdetails);
$transaction->save();
}
if ($this->_config["updatetransaction"]) {
$invoiceId = $invoice->getIncrementId();
$msp = new MultiSafepay();
$msp->test = $this->_config["test_api"] == 'test';
$msp->merchant['account_id'] = $this->_config["account_id"];
$msp->merchant['site_id'] = $this->_config["site_id"];
$msp->merchant['site_code'] = $this->_config["secure_code"];
$msp->transaction['id'] = $_GET['transactionid'];
$msp->transaction['invoice_id'] = $invoiceId;
$msp->updateInvoice();
if ($msp->error) {
echo 'update trans error';
}
}
//END Handle Invoice
//Send Invoice emails
$mail_invoice = $this->getConfigData("mail_invoice");
$send_bno_invoice = $this->getConfigData("bno_no_invoice");
$gateway = $order->getPayment()->getMethodInstance()->_gateway;
if ($mail_invoice && $gateway != 'PAYAFTER' && $gateway != 'KLARNA') {
$invoice->setEmailSent(true);
$invoice->sendEmail();
$invoice->save();
} elseif (($gateway == 'PAYAFTER' || $gateway == 'KLARNA') && $send_bno_invoice && $mail_invoice) {
$invoice->setEmailSent(true);
$invoice->sendEmail();
$invoice->save();
}
$order->setTotalPaid($order->getGrandTotal());
} catch (Exception $e) {
$order->addStatusHistoryComment('MultiSafepay invoicer: Exception occurred during the creation of the invoice. Exception message: ' . $e->getMessage(), false);
$order->save();
}
}
return false;
}