本文整理汇总了PHP中Magento\Sales\Model\Order::getPayment方法的典型用法代码示例。如果您正苦于以下问题:PHP Order::getPayment方法的具体用法?PHP Order::getPayment怎么用?PHP Order::getPayment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Sales\Model\Order
的用法示例。
在下文中一共展示了Order::getPayment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRedirectActionIsContentGenerated
/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testRedirectActionIsContentGenerated()
{
$this->_order->load('100000001', 'increment_id');
$this->_order->getPayment()->setMethod(\Magento\Paypal\Model\Config::METHOD_WPS);
$this->_order->save();
$this->_order->load('100000001', 'increment_id');
$this->_session->setLastRealOrderId($this->_order->getRealOrderId())->setLastQuoteId($this->_order->getQuoteId());
$this->dispatch('paypal/standard/redirect');
$this->assertContains('<form action="https://www.paypal.com/cgi-bin/webscr" id="paypal_standard_checkout"' . ' name="paypal_standard_checkout" method="POST">', $this->getResponse()->getBody());
}
示例2: setOpenInvoiceData
/**
* @param $formFields
* @return mixed
*/
protected function setOpenInvoiceData($formFields)
{
$count = 0;
$currency = $this->_order->getOrderCurrencyCode();
foreach ($this->_order->getAllVisibleItems() as $item) {
++$count;
$linename = "line" . $count;
$formFields['openinvoicedata.' . $linename . '.currencyCode'] = $currency;
$formFields['openinvoicedata.' . $linename . '.description'] = str_replace("\n", '', trim($item->getName()));
$formFields['openinvoicedata.' . $linename . '.itemAmount'] = $this->_adyenHelper->formatAmount($item->getPrice(), $currency);
$formFields['openinvoicedata.' . $linename . '.itemVatAmount'] = $item->getTaxAmount() > 0 && $item->getPriceInclTax() > 0 ? $this->_adyenHelper->formatAmount($item->getPriceInclTax(), $currency) - $this->_adyenHelper->formatAmount($item->getPrice(), $currency) : $this->_adyenHelper->formatAmount($item->getTaxAmount(), $currency);
// $product = $item->getProduct();
// Calculate vat percentage
$percentageMinorUnits = $this->_adyenHelper->getMinorUnitTaxPercent($item->getTaxPercent());
$formFields['openinvoicedata.' . $linename . '.itemVatPercentage'] = $percentageMinorUnits;
$formFields['openinvoicedata.' . $linename . '.numberOfItems'] = (int) $item->getQtyOrdered();
if ($this->_order->getPayment()->getAdditionalInformation(\Adyen\Payment\Observer\AdyenHppDataAssignObserver::BRAND_CODE) == "klarna") {
$formFields['openinvoicedata.' . $linename . '.vatCategory'] = "High";
} else {
$formFields['openinvoicedata.' . $linename . '.vatCategory'] = "None";
}
}
$formFields['openinvoicedata.refundDescription'] = "Refund / Correction for " . $formFields['merchantReference'];
$formFields['openinvoicedata.numberOfLines'] = $count;
return $formFields;
}
示例3: addNewOrderTransaction
/**
* Saves new order transaction incrementing "try".
*
* @param \Magento\Sales\Model\Order $order
* @param string $payuplOrderId
* @param string $payuplExternalOrderId
* @param string $status
*/
public function addNewOrderTransaction(\Magento\Sales\Model\Order $order, $payuplOrderId, $payuplExternalOrderId, $status)
{
$orderId = $order->getId();
$payment = $order->getPayment();
$payment->setTransactionId($payuplOrderId);
$payment->setTransactionAdditionalInfo(\Magento\Sales\Model\Order\Payment\Transaction::RAW_DETAILS, ['order_id' => $payuplExternalOrderId, 'try' => $this->transactionResource->getLastTryByOrderId($orderId) + 1, 'status' => $status]);
$payment->setIsTransactionClosed(0);
$transaction = $payment->addTransaction('order');
$transaction->save();
$payment->save();
}
示例4: _importPaymentInformation
/**
* Map payment information from IPN to payment object
* Returns true if there were changes in information
*
* @return bool
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _importPaymentInformation()
{
$payment = $this->_order->getPayment();
$was = $payment->getAdditionalInformation();
// collect basic information
$from = [];
foreach ([Info::PAYER_ID, 'payer_email' => Info::PAYER_EMAIL, Info::PAYER_STATUS, Info::ADDRESS_STATUS, Info::PROTECTION_EL, Info::PAYMENT_STATUS, Info::PENDING_REASON] as $privateKey => $publicKey) {
if (is_int($privateKey)) {
$privateKey = $publicKey;
}
$value = $this->getRequestData($privateKey);
if ($value) {
$from[$publicKey] = $value;
}
}
if (isset($from['payment_status'])) {
$from['payment_status'] = $this->_filterPaymentStatus($this->getRequestData('payment_status'));
}
// collect fraud filters
$fraudFilters = [];
for ($i = 1; $value = $this->getRequestData("fraud_management_pending_filters_{$i}"); $i++) {
$fraudFilters[] = $value;
}
if ($fraudFilters) {
$from[Info::FRAUD_FILTERS] = $fraudFilters;
}
$this->_paypalInfo->importToPayment($from, $payment);
/**
* Detect pending payment, frauds
* TODO: implement logic in one place
* @see \Magento\Paypal\Model\Pro::importPaymentInfo()
*/
if ($this->_paypalInfo->isPaymentReviewRequired($payment)) {
$payment->setIsTransactionPending(true);
if ($fraudFilters) {
$payment->setIsFraudDetected(true);
}
}
if ($this->_paypalInfo->isPaymentSuccessful($payment)) {
$payment->setIsTransactionApproved(true);
} elseif ($this->_paypalInfo->isPaymentFailed($payment)) {
$payment->setIsTransactionDenied(true);
}
return $was != $payment->getAdditionalInformation();
}
示例5: setDataFromOrder
/**
* Set entity data to request
*
* @param \Magento\Sales\Model\Order $order
* @param \Magento\Authorizenet\Model\Directpost $paymentMethod
* @return $this
*/
public function setDataFromOrder(\Magento\Sales\Model\Order $order, \Magento\Authorizenet\Model\Directpost $paymentMethod)
{
$payment = $order->getPayment();
$this->setXType($payment->getAnetTransType());
$this->setXFpSequence($order->getQuoteId());
$this->setXInvoiceNum($order->getIncrementId());
$this->setXAmount($payment->getBaseAmountAuthorized());
$this->setXCurrencyCode($order->getBaseCurrencyCode());
$this->setXTax(sprintf('%.2F', $order->getBaseTaxAmount()))->setXFreight(sprintf('%.2F', $order->getBaseShippingAmount()));
//need to use strval() because NULL values IE6-8 decodes as "null" in JSON in JavaScript,
//but we need "" for null values.
$billing = $order->getBillingAddress();
if (!empty($billing)) {
$this->setXFirstName(strval($billing->getFirstname()))->setXLastName(strval($billing->getLastname()))->setXCompany(strval($billing->getCompany()))->setXAddress(strval($billing->getStreetLine(1)))->setXCity(strval($billing->getCity()))->setXState(strval($billing->getRegion()))->setXZip(strval($billing->getPostcode()))->setXCountry(strval($billing->getCountry()))->setXPhone(strval($billing->getTelephone()))->setXFax(strval($billing->getFax()))->setXCustId(strval($billing->getCustomerId()))->setXCustomerIp(strval($order->getRemoteIp()))->setXCustomerTaxId(strval($billing->getTaxId()))->setXEmail(strval($order->getCustomerEmail()))->setXEmailCustomer(strval($paymentMethod->getConfigData('email_customer')))->setXMerchantEmail(strval($paymentMethod->getConfigData('merchant_email')));
}
$shipping = $order->getShippingAddress();
if (!empty($shipping)) {
$this->setXShipToFirstName(strval($shipping->getFirstname()))->setXShipToLastName(strval($shipping->getLastname()))->setXShipToCompany(strval($shipping->getCompany()))->setXShipToAddress(strval($shipping->getStreetLine(1)))->setXShipToCity(strval($shipping->getCity()))->setXShipToState(strval($shipping->getRegion()))->setXShipToZip(strval($shipping->getPostcode()))->setXShipToCountry(strval($shipping->getCountry()));
}
$this->setXPoNum(strval($payment->getPoNumber()));
return $this;
}
示例6: _createShipment
/**
*
*/
protected function _createShipment()
{
$this->_debugData['_createShipment'] = 'Creating shipment for order';
// create shipment for cash payment
$payment = $this->_order->getPayment()->getMethodInstance();
if ($this->_order->canShip()) {
$itemQty = array();
$shipment = $this->_order->prepareShipment($itemQty);
if ($shipment) {
$shipment->register();
$shipment->getOrder()->setIsInProcess(true);
$comment = __('Shipment created by Adyen');
$shipment->addComment($comment);
/** @var \Magento\Framework\DB\Transaction $transaction */
$transaction = $this->_transactionFactory->create();
$transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
$this->_debugData['_createShipment done'] = 'Order is shipped';
}
} else {
$this->_debugData['_createShipment error'] = 'Order can\'t be shipped';
}
}
示例7: _createShipment
/**
* Create shipment
*
* @throws bool
*/
protected function _createShipment()
{
$this->_adyenLogger->addAdyenNotificationCronjob('Creating shipment for order');
// create shipment for cash payment
$payment = $this->_order->getPayment()->getMethodInstance();
if ($this->_order->canShip()) {
$itemQty = [];
$shipment = $this->_order->prepareShipment($itemQty);
if ($shipment) {
$shipment->register();
$shipment->getOrder()->setIsInProcess(true);
$comment = __('Shipment created by Adyen');
$shipment->addComment($comment);
/** @var \Magento\Framework\DB\Transaction $transaction */
$transaction = $this->_transactionFactory->create();
$transaction->addObject($shipment)->addObject($shipment->getOrder())->save();
$this->_adyenLogger->addAdyenNotificationCronjob('Order is shipped');
}
} else {
$this->_adyenLogger->addAdyenNotificationCronjob('Order can\'t be shipped');
}
}
示例8: _createInvoice
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()));
}
}
示例9: _processOrder
protected function _processOrder(\Magento\Sales\Model\Order $order, $response)
{
//$response = $this->getResponse();
$payment = $order->getPayment();
//$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
//TODO: add validation for request data
try {
$errors = array();
//$this->readConfig();
//$order = Mage::getModel("sales/order")->load($this->getOrderId($answer));
//$order = Mage::getModel("sales/order")->loadByIncrementId($this->getOrderId($answer));
$hashArray = array($response["OutSum"], $response["InvId"], $this->getConfigData('pass_word_2'));
$hashCurrent = strtoupper(md5(implode(":", $hashArray)));
$correctHash = strcmp($hashCurrent, strtoupper($response['SignatureValue'])) == 0;
if (!$correctHash) {
$errors[] = "Incorrect HASH (need:" . $hashCurrent . ", got:" . strtoupper($response['SignatureValue']) . ") - fraud data or wrong secret Key";
$errors[] = "Maybe success payment";
}
/**
* @var $order Mage_Sales_Model_Order
*/
// if ($this->_transferCurrency != $order->getOrderCurrencyCode()) {
// $outSum = round(
// $order->getBaseCurrency()->convert($order->getBaseGrandTotal(), $this->_transferCurrency),
// 2
// );
// } else {
$outSum = round($order->getGrandTotal(), 2);
// }
if ($outSum != $response["OutSum"]) {
$errors[] = "Incorrect Amount: " . $response["OutSum"] . " (need: " . $outSum . ")";
}
// if (count($errors) > 0) {
// return $errors;
// }
//return (bool)$correctHash;
//$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
if (!$correctHash) {
$payment->setTransactionId($response["InvId"])->setIsTransactionClosed(0);
$order->setStatus(Order::STATE_PAYMENT_REVIEW);
$order->save();
return "Ok" . $response["InvId"];
}
//
} catch (Exception $e) {
return array("Internal error:" . $e->getMessage());
}
}
示例10: makeCardInfo
/**
* @param $order Order
* @return Card|null
*/
protected function makeCardInfo(Order $order)
{
$payment = $order->getPayment();
$this->_logger->debug($payment->convertToJson());
if (!is_subclass_of($payment->getMethodInstance(), '\\Magento\\Payment\\Model\\Method\\Cc')) {
return null;
}
$card = SignifydModel::Make("\\Signifyd\\Models\\Card");
$card->cardHolderName = $payment->getCcOwner();
$card->last4 = $payment->getCcLast4();
$card->expiryMonth = $payment->getCcExpMonth();
$card->expiryYear = $payment->getCcExpYear();
$card->hash = $payment->getCcNumberEnc();
$ccNum = $payment->getData('cc_number');
if ($ccNum && is_numeric($ccNum) && strlen((string) $ccNum) > 6) {
$card->bin = substr((string) $ccNum, 0, 6);
}
$card->billingAddress = $this->formatSignifydAddress($order->getBillingAddress());
return $card;
}
示例11: build
/**
* Loads the order info from a Magento order model.
*
* @param Order $order the order model.
* @return \NostoOrder
*/
public function build(Order $order)
{
$nostoOrder = new \NostoOrder();
try {
$nostoCurrency = new NostoCurrencyCode($order->getOrderCurrencyCode());
$nostoOrder->setOrderNumber($order->getId());
$nostoOrder->setExternalRef($order->getRealOrderId());
$nostoOrder->setCreatedDate(new NostoDate(strtotime($order->getCreatedAt())));
$nostoOrder->setPaymentProvider(new NostoOrderPaymentProvider($order->getPayment()->getMethod()));
if ($order->getStatus()) {
$nostoStatus = new NostoOrderStatus();
$nostoStatus->setCode($order->getStatus());
$nostoStatus->setLabel($order->getStatusLabel());
$nostoOrder->setStatus($nostoStatus);
}
foreach ($order->getAllStatusHistory() as $item) {
if ($item->getStatus()) {
$nostoStatus = new NostoOrderStatus();
$nostoStatus->setCode($item->getStatus());
$nostoStatus->setLabel($item->getStatusLabel());
$nostoStatus->setCreatedAt(new NostoDate(strtotime($item->getCreatedAt())));
$nostoOrder->addHistoryStatus($nostoStatus);
}
}
// Set the buyer information
$nostoBuyer = new NostoOrderBuyer();
$nostoBuyer->setFirstName($order->getCustomerFirstname());
$nostoBuyer->setLastName($order->getCustomerLastname());
$nostoBuyer->setEmail($order->getCustomerEmail());
$nostoOrder->setBuyer($nostoBuyer);
// Add each ordered item as a line item
/** @var Item $item */
foreach ($order->getAllVisibleItems() as $item) {
$nostoItem = new NostoOrderItem();
$nostoItem->setItemId((int) $this->buildItemProductId($item));
$nostoItem->setQuantity((int) $item->getQtyOrdered());
$nostoItem->setName($this->buildItemName($item));
try {
$nostoItem->setUnitPrice(new NostoPrice($this->_priceHelper->getItemFinalPriceInclTax($item)));
} catch (\NostoInvalidArgumentException $E) {
$nostoItem->setUnitPrice(new NostoPrice(0));
}
$nostoItem->setCurrency($nostoCurrency);
$nostoOrder->addItem($nostoItem);
}
// Add discounts as a pseudo line item
if (($discount = $order->getDiscountAmount()) < 0) {
$nostoItem = new NostoOrderItem();
$nostoItem->setItemId(-1);
$nostoItem->setQuantity(1);
$nostoItem->setName($this->buildDiscountRuleDescription($order));
$nostoItem->setUnitPrice(new NostoPrice($discount));
$nostoItem->setCurrency($nostoCurrency);
$nostoOrder->addItem($nostoItem);
}
// Add shipping and handling as a pseudo line item
if (($shippingInclTax = $order->getShippingInclTax()) > 0) {
$nostoItem = new NostoOrderItem();
$nostoItem->setItemId(-1);
$nostoItem->setQuantity(1);
$nostoItem->setName('Shipping and handling');
$nostoItem->setUnitPrice(new NostoPrice($shippingInclTax));
$nostoItem->setCurrency($nostoCurrency);
$nostoOrder->addItem($nostoItem);
}
} catch (Exception $e) {
$this->_logger->error($e, ['exception' => $e]);
}
return $nostoOrder;
}
示例12: _checkIpnRequest
protected function _checkIpnRequest()
{
$request = $this->getRequest()->getPost();
$this->_order = $this->_getOrder($request['ordernumber']);
// check order ID
$orderId = $this->_order->getRealOrderId();
if ($orderId != $request['ordernumber']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Order not found'));
}
$this->_paymentInst = $this->_order->getPayment()->getMethodInstance();
// check merchant ID
if ($this->_paymentInst->getConfigData('merchant') != $request['merchant_id']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid merchant ID: ' . $request['merchant_id']));
}
// failed operation
if ('AS000' != $request['responsecode']) {
throw new \Magento\Framework\Exception\LocalizedException($this->_paymentInst->getAssistErrors($request['responsecode']));
}
// wrong test mode
if ($this->_paymentInst->getConfigData('mode') != $request['testmode']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Test Mode.'));
}
// accept only Approve operations, cancel and capture are processed real time
if ('100' != $request['operationtype']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Operation Type. Only Approve is supported by IPN.'));
}
// check currency
if ($this->_order->getBaseCurrencyCode() != $request['ordercurrency']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid currency: ' . $request['ordercurrency']));
}
// check amount
$orderAmount = number_format($this->_order->getGrandTotal(), 2, '.', '');
if ($orderAmount != $request['orderamount']) {
throw new \Magento\Framework\Exception\LocalizedException(__('Invalid amount: ' . $request['orderamount']));
}
/*
if (Mage::helper('assist')->isResponseSecuredMd5()) {
$x = array(
$this->_paymentInst->getConfigData('merchant'),
$request['ordernumber'],
$request['amount'],
$request['currency'],
$request['orderstate']
);
if ($this->_paymentInst->secreyKey(implode("", $x)) != $request['checkvalue']) {
Mage::throwException('Incorrect Checkvalue: ' . $request['checkvalue']);
}
}
if (Mage::helper('assist')->isResponseSecuredPgp()) {
$y = implode("", array(
$this->_paymentInst->getConfigData('merchant'),
$request['ordernumber'],
$request['amount'],
$request['currency'],
$request['orderstate']
));
$keyFile = Mage::getBaseDir('var') . DS . 'assist' . DS . $this->_paymentInst->getConfigData('assist_key');
if ($this->_paymentInst->sign($y, $keyFile) != $request['signature']) {
Mage::throwException('Incorrect Signature.');
}
}
*/
return $request;
}
示例13: checkPaymentMethod
/**
* Check requested payment method
*
* @param Order $order
* @return bool
*/
protected function checkPaymentMethod(Order $order)
{
$payment = $order->getPayment();
return in_array($payment->getMethod(), $this->allowedPaymentMethodCodes);
}
示例14: _processOrder
/**
* Operate with order using information from silent post
*
* @param \Magento\Sales\Model\Order $order
* @return void
* @throws \Magento\Framework\Exception\LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
protected function _processOrder(\Magento\Sales\Model\Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$payment->setIsTransactionPending(true)->setIsFraudDetected(true);
$fraudMessage = $response->getData('respmsg');
if ($response->getData('fps_prexmldata')) {
$xml = new \SimpleXMLElement($response->getData('fps_prexmldata'));
$fraudMessage = (string) $xml->rule->triggeredMessage;
}
$payment->setAdditionalInformation(Info::PAYPAL_FRAUD_FILTERS, $fraudMessage);
}
if ($response->getData('avsdata') && strstr(substr($response->getData('avsdata'), 0, 2), 'N')) {
$payment->setAdditionalInformation(Info::PAYPAL_AVS_CODE, substr($response->getData('avsdata'), 0, 2));
}
if ($response->getData('cvv2match') && $response->getData('cvv2match') != 'Y') {
$payment->setAdditionalInformation(Info::PAYPAL_CVV_2_MATCH, $response->getData('cvv2match'));
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
default:
break;
}
$order->save();
try {
if ($canSendNewOrderEmail) {
$this->orderSender->send($order);
}
$quote = $this->quoteRepository->get($order->getQuoteId())->setIsActive(false);
$this->quoteRepository->save($quote);
} catch (\Exception $e) {
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot send the new order email.'));
}
}
示例15: _processOrder
/**
* Operate with order using information from silent post
*
* @param \Magento\Sales\Model\Order $order
* @return void
* @throws \Magento\Framework\Model\Exception
*/
protected function _processOrder(\Magento\Sales\Model\Order $order)
{
$response = $this->getResponse();
$payment = $order->getPayment();
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
$canSendNewOrderEmail = true;
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER || $response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER) {
$canSendNewOrderEmail = false;
$fraudMessage = $this->_getFraudMessage() ? $response->getFraudMessage() : $response->getRespmsg();
$payment->setIsTransactionPending(true)->setIsFraudDetected(true)->setAdditionalInformation('paypal_fraud_filters', $fraudMessage);
}
if ($response->getAvsdata() && strstr(substr($response->getAvsdata(), 0, 2), 'N')) {
$payment->setAdditionalInformation('paypal_avs_code', substr($response->getAvsdata(), 0, 2));
}
if ($response->getCvv2match() && $response->getCvv2match() != 'Y') {
$payment->setAdditionalInformation('paypal_cvv2_match', $response->getCvv2match());
}
switch ($response->getType()) {
case self::TRXTYPE_AUTH_ONLY:
$payment->registerAuthorizationNotification($payment->getBaseAmountAuthorized());
break;
case self::TRXTYPE_SALE:
$payment->registerCaptureNotification($payment->getBaseAmountAuthorized());
break;
default:
break;
}
$order->save();
try {
if ($canSendNewOrderEmail) {
$this->orderSender->send($order);
}
$this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save();
} catch (\Exception $e) {
throw new \Magento\Framework\Model\Exception(__('We cannot send the new order email.'));
}
}