/** * Register authorized payment * * @return void */ protected function _registerPaymentAuthorization() { /** @var $payment \Magento\Sales\Model\Order\Payment */ $payment = $this->_order->getPayment(); if ($this->_order->canFetchPaymentReviewUpdate()) { $payment->update(true); } else { $this->_importPaymentInformation(); $payment->setPreparedMessage($this->_createIpnComment(''))->setTransactionId($this->getRequestData('txn_id'))->setParentTransactionId($this->getRequestData('parent_txn_id'))->setCurrencyCode($this->getRequestData('mc_currency'))->setIsTransactionClosed(0)->registerAuthorizationNotification($this->getRequestData('mc_gross')); } if (!$this->_order->getEmailSent()) { $this->orderSender->send($this->_order); } $this->_order->save(); }
protected function _createInvoice($params) { try { if ($this->_order->canInvoice()) { $payment = $this->_order->getPayment(); $payment->setTransactionId($params['invoice_id']); $payment->setCurrencyCode($params['list_currency']); $payment->setParentTransactionId($params['sale_id']); $payment->setShouldCloseParentTransaction(true); $payment->setIsTransactionClosed(0); $payment->registerCaptureNotification($params['invoice_list_amount'], true); $this->_order->save(); // notify customer $invoice = $payment->getCreatedInvoice(); if ($invoice && !$this->_order->getEmailSent()) { $this->orderSender->send($this->_order); $this->_order->addStatusHistoryComment(__('You notified customer about invoice #%1.', $invoice->getIncrementId()))->setIsCustomerNotified(true)->save(); } } } catch (Exception $e) { throw new Exception(sprintf('Error Creating Invoice: "%s"', $e->getMessage())); } }
/** * authorize payment */ protected function _authorizePayment() { $this->_adyenLogger->addAdyenNotificationCronjob('Authorisation of the order'); $fraudManualReviewStatus = $this->_getFraudManualReviewStatus(); // If manual review is active and a seperate status is used then ignore the pre authorized status if ($this->_fraudManualReview != true || $fraudManualReviewStatus == "") { $this->_setPrePaymentAuthorized(); } else { $this->_adyenLogger->addAdyenNotificationCronjob('Ignore the pre authorized status because the order is ' . 'under manual review and use the Manual review status'); } $this->_prepareInvoice(); $_paymentCode = $this->_paymentMethodCode(); // for boleto confirmation mail is send on order creation if ($this->_paymentMethod != "adyen_boleto") { // send order confirmation mail after invoice creation so merchant can add invoicePDF to this mail if (!$this->_order->getEmailSent()) { $this->_orderSender->send($this->_order); $this->_adyenLogger->addAdyenNotificationCronjob('Send orderconfirmation email to shopper'); } } if ($this->_paymentMethod == "c_cash" && $this->_getConfigData('create_shipment', 'adyen_cash', $this->_order->getStoreId()) || $this->_getConfigData('create_shipment', 'adyen_pos', $this->_order->getStoreId()) && $_paymentCode == "adyen_pos") { $this->_createShipment(); } }