• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Model\OrderFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Sales\Model\OrderFactory的典型用法代码示例。如果您正苦于以下问题:PHP OrderFactory类的具体用法?PHP OrderFactory怎么用?PHP OrderFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了OrderFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _getOrder

 /**
  * Return order instance loaded by increment id
  *
  * @return Order
  */
 protected function _getOrder()
 {
     if (empty($this->_order)) {
         $orderId = $this->getRequest()->getParam('orderID');
         $this->_order = $this->_salesOrderFactory->create()->loadByIncrementId($orderId);
     }
     return $this->_order;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:13,代码来源:Api.php


示例2: _getOrder

 /**
  * Get order object
  *
  * @return \Magento\Sales\Model\Order
  */
 protected function _getOrder()
 {
     if (!$this->_order) {
         $incrementId = $this->_getCheckout()->getLastRealOrderId();
         $this->_orderFactory = $this->_objectManager->get('Magento\\Sales\\Model\\OrderFactory');
         $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
     }
     return $this->_order;
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:14,代码来源:Redirect.php


示例3: _getOrder

 /**
  * Return order instance with loaded information by increment id
  *
  * @return \Magento\Sales\Model\Order
  */
 protected function _getOrder()
 {
     if ($this->getOrder()) {
         $order = $this->getOrder();
     } elseif ($this->_checkoutSession->getLastRealOrderId()) {
         $order = $this->_salesOrderFactory->create()->loadByIncrementId($this->_checkoutSession->getLastRealOrderId());
     } else {
         return null;
     }
     return $order;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Placeform.php


示例4: __construct

 /**
  * Redirect constructor.
  *
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param array $data
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param \Adyen\Payment\Helper\Data $adyenHelper
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, array $data = [], \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession, \Adyen\Payment\Helper\Data $adyenHelper, \Magento\Framework\Locale\ResolverInterface $resolver, \Adyen\Payment\Logger\AdyenLogger $adyenLogger)
 {
     $this->_orderFactory = $orderFactory;
     $this->_checkoutSession = $checkoutSession;
     parent::__construct($context, $data);
     $this->_adyenHelper = $adyenHelper;
     $this->_resolver = $resolver;
     $this->_adyenLogger = $adyenLogger;
     if (!$this->_order) {
         $incrementId = $this->_getCheckout()->getLastRealOrderId();
         $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
     }
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:22,代码来源:Redirect.php


示例5: afterGetOrders

 public function afterGetOrders(\Magento\Sales\Block\Order\History $subject, $result)
 {
     $old = $this->_oldCollectionFactory->create();
     $blank = $this->_blankCollectionFactory->create();
     //$this->_logger->debug(print_r($blank->getAllIds(), true));
     // add orders from new website to blank collection , first
     foreach ($result as $new) {
         $blank->addItem($new);
     }
     // add orders from old website to blank collection
     foreach ($old as $o) {
         //$this->_logger->debug(print_r($o->getData(), true));
         $clone = $this->orderFactory->create();
         $clone->setId($o->getOrderId());
         $clone->setStatus(trim($o->getStatus()));
         $clone->setState(trim($o->getState()));
         $clone->setOrderId($o->getOrderId());
         $clone->setRealOrderId($o->getIncrementId());
         $clone->setCustomerId($o->getCustomerId());
         $clone->setIsFromImport(1);
         $blank->addItem($clone);
     }
     foreach ($blank as $b) {
         //$this->_logger->debug(print_r($b->getData(), true));
     }
     //$this->_logger->debug(print_r($blank->getAllIds(), true));
     return $blank;
 }
开发者ID:vuleticd,项目名称:OrderHistory,代码行数:28,代码来源:HistoryPlugin.php


示例6: save

 /**
  * {@inheritDoc}
  */
 public function save($orderId, \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage)
 {
     /** @var \Magento\Sales\Api\Data\OrderInterface $order */
     $order = $this->orderFactory->create()->load($orderId);
     if (!$order->getEntityId()) {
         throw new NoSuchEntityException(__('There is no order with provided id'));
     }
     if (0 == $order->getTotalItemCount()) {
         throw new InputException(__('Gift Messages is not applicable for empty order'));
     }
     if ($order->getIsVirtual()) {
         throw new InvalidTransitionException(__('Gift Messages is not applicable for virtual products'));
     }
     if (!$this->helper->isMessagesAllowed('order', $order, $this->storeManager->getStore())) {
         throw new CouldNotSaveException(__('Gift Message is not available'));
     }
     $message = [];
     $message[$orderId] = ['type' => 'order', $giftMessage::CUSTOMER_ID => $giftMessage->getCustomerId(), $giftMessage::SENDER => $giftMessage->getSender(), $giftMessage::RECIPIENT => $giftMessage->getRecipient(), $giftMessage::MESSAGE => $giftMessage->getMessage()];
     $this->giftMessageSaveModel->setGiftmessages($message);
     try {
         $this->giftMessageSaveModel->saveAllInOrder();
     } catch (\Exception $e) {
         throw new CouldNotSaveException(__('Could not add gift message to order: "%1"', $e->getMessage()), $e);
     }
     return true;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:29,代码来源:OrderRepository.php


示例7: _reorder

 private function _reorder($orderId)
 {
     /** @var \Magento\Sales\Model\Order $order */
     $order = $this->_orderFactory->create()->loadByIncrementId($orderId);
     /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultRedirectFactory->create();
     /* @var $cart \Magento\Checkout\Model\Cart */
     $cart = $this->_objectManager->get('Magento\\Checkout\\Model\\Cart');
     $cart->truncate();
     $items = $order->getItemsCollection();
     foreach ($items as $item) {
         try {
             $cart->addOrderItem($item);
         } catch (\Magento\Framework\Exception\LocalizedException $e) {
             if ($this->_objectManager->get('Magento\\Checkout\\Model\\Session')->getUseNotice(true)) {
                 $this->messageManager->addNotice($e->getMessage());
             } else {
                 $this->messageManager->addError($e->getMessage());
             }
             return $resultRedirect->setPath('*/*/history');
         } catch (\Exception $e) {
             $this->messageManager->addException($e, __('We can\'t add this item to your shopping cart right now.'));
             return $resultRedirect->setPath('checkout/cart');
         }
     }
     $cart->save();
     return $resultRedirect->setPath('checkout/cart');
 }
开发者ID:vkerkhoff,项目名称:magento2-plugin,代码行数:28,代码来源:Index.php


示例8: _getOrder

 protected function _getOrder($incrementId = null)
 {
     if (!$this->_order) {
         $incrementId = $incrementId ? $incrementId : $this->_getCheckout()->getLastRealOrderId();
         $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
     }
     return $this->_order;
 }
开发者ID:vuleticd,项目名称:vuleticd_assist2,代码行数:8,代码来源:Cancel.php


示例9: execute

 /**
  * Record order shipping information after order is placed
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if ($this->shipperDataHelper->getConfigValue('carriers/shipper/active')) {
         $order = $this->orderFactory->create()->loadByIncrementId($this->checkoutSession->getLastRealOrderId());
         if ($order->getIncrementId()) {
             $this->recordOrder($order);
         }
     }
 }
开发者ID:shipperhq,项目名称:module-shipper,代码行数:15,代码来源:RecordOrder.php


示例10: testGetSuccessOrderUrl

 public function testGetSuccessOrderUrl()
 {
     $orderMock = $this->getMock('Magento\\Sales\\Model\\Order', ['loadByIncrementId', 'getId', '__wakeup'], [], '', false);
     $orderMock->expects($this->once())->method('loadByIncrementId')->with('invoice number')->willReturnSelf();
     $orderMock->expects($this->once())->method('getId')->willReturn('order id');
     $this->orderFactoryMock->expects($this->once())->method('create')->willReturn($orderMock);
     $this->urlBuilderMock->expects($this->once())->method('getUrl')->with('sales/order/view', ['order_id' => 'order id'])->willReturn('some value');
     $this->assertEquals('some value', $this->dataHelper->getSuccessOrderUrl(['x_invoice_num' => 'invoice number', 'some param']));
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:9,代码来源:DataTest.php


示例11: _getCustomerProductCollection

 /**
  * Get a collection of all products in the orders
  *
  * @param $ordersCollection
  * @return array
  */
 protected function _getCustomerProductCollection($ordersCollection)
 {
     $purchasedProducts = [];
     foreach ($ordersCollection as $order) {
         $order = $this->_orderFactory->create()->load($order['entity_id']);
         $itemCollection = $order->getItems();
         foreach ($itemCollection as $item) {
             $purchasedProducts[$order['customer_id']][] = $item->getProductId();
         }
     }
     $this->_productCollection = $purchasedProducts;
     return $purchasedProducts;
 }
开发者ID:richdynamix,项目名称:personalised-products,代码行数:19,代码来源:AbstractOrdersCommand.php


示例12: execute

 public function execute()
 {
     $skipFraudDetection = false;
     \Paynl\Config::setApiToken($this->_config->getApiToken());
     $params = $this->getRequest()->getParams();
     if (!isset($params['order_id'])) {
         $this->_logger->critical('Exchange: order_id is not set in the request', $params);
         return $this->_result->setContents('FALSE| order_id is not set in the request');
     }
     try {
         $transaction = \Paynl\Transaction::get($params['order_id']);
     } catch (\Exception $e) {
         $this->_logger->critical($e, $params);
         return $this->_result->setContents('FALSE| Error fetching transaction. ' . $e->getMessage());
     }
     if ($transaction->isPending()) {
         return $this->_result->setContents("TRUE| Ignoring pending");
     }
     $orderId = $transaction->getDescription();
     $order = $this->_orderFactory->create()->loadByIncrementId($orderId);
     if (empty($order)) {
         $this->_logger->critical('Cannot load order: ' . $orderId);
         return $this->_result->setContents('FALSE| Cannot load order');
     }
     if ($order->getTotalDue() <= 0) {
         $this->_logger->debug('Total due <= 0, so iam not touching the status of the order: ' . $orderId);
         return $this->_result->setContents('TRUE| Total due <= 0, so iam not touching the status of the order');
     }
     if ($transaction->isPaid()) {
         $payment = $order->getPayment();
         $payment->setTransactionId($transaction->getId());
         $payment->setCurrencyCode($transaction->getPaidCurrency());
         $payment->setIsTransactionClosed(0);
         $payment->registerCaptureNotification($transaction->getPaidCurrencyAmount(), $skipFraudDetection);
         $order->save();
         // notify customer
         $invoice = $payment->getCreatedInvoice();
         if ($invoice && !$order->getEmailSent()) {
             $this->_orderSender->send($order);
             $order->addStatusHistoryComment(__('New order email sent'))->setIsCustomerNotified(true)->save();
         }
         if ($invoice && !$invoice->getEmailSent()) {
             $this->_invoiceSender->send($invoice);
             $order->addStatusHistoryComment(__('You notified customer about invoice #%1.', $invoice->getIncrementId()))->setIsCustomerNotified(true)->save();
         }
         return $this->_result->setContents("TRUE| PAID");
     } elseif ($transaction->isCanceled()) {
         $order->cancel()->save();
         return $this->_result->setContents("TRUE| CANCELED");
     }
 }
开发者ID:paynl,项目名称:magento2-plugin,代码行数:51,代码来源:Exchange.php


示例13: execute

 /**
  * Record order shipping information after order is placed
  *
  * @param EventObserver $observer
  * @return void
  */
 public function execute(EventObserver $observer)
 {
     if ($this->shipperDataHelper->getConfigValue('carriers/shipper/active')) {
         $orderIds = $observer->getEvent()->getOrderIds();
         if (empty($orderIds) || !is_array($orderIds)) {
             return;
         }
         foreach ($orderIds as $orderId) {
             $order = $this->orderFactory->create()->loadByIncrementId($orderId);
             if ($order->getIncrementId()) {
                 $this->recordOrder($order);
             }
         }
     }
 }
开发者ID:shipperhq,项目名称:module-shipper,代码行数:21,代码来源:RecordMultiOrder.php


示例14: prepareBlockData

 /**
  * Prepares block data
  *
  * @return void
  */
 protected function prepareBlockData()
 {
     $s2p_transaction = $this->_s2pTransaction->create();
     $order = $this->_orderFactory->create();
     $module_settings = $this->_s2pModel->getFullConfigArray();
     $transaction_obj = false;
     $error_message = '';
     $merchant_transaction_id = 0;
     if (($status_code = $this->_helper->getParam('data', null)) === null) {
         $error_message = __('Transaction status not provided.');
     } elseif (!($merchant_transaction_id = $this->_helper->getParam('MerchantTransactionID', '')) or !($merchant_transaction_id = $this->_helper->convert_from_demo_merchant_transaction_id($merchant_transaction_id))) {
         $error_message = __('Couldn\'t extract transaction information.');
     } elseif (!$s2p_transaction->loadByMerchantTransactionId($merchant_transaction_id) or !$s2p_transaction->getID()) {
         $error_message = __('Transaction not found in database.');
     } elseif (!$order->loadByIncrementId($merchant_transaction_id) or !$order->getEntityId()) {
         $error_message = __('Order not found in database.');
     }
     $status_code = intval($status_code);
     if (empty($status_code)) {
         $status_code = Smart2Pay::S2P_STATUS_FAILED;
     }
     $transaction_extra_data = [];
     $transaction_details_titles = [];
     if (in_array($s2p_transaction->getMethodId(), [\Smart2Pay\GlobalPay\Model\Smart2Pay::PAYMENT_METHOD_BT, \Smart2Pay\GlobalPay\Model\Smart2Pay::PAYMENT_METHOD_SIBS])) {
         if ($transaction_details_titles = \Smart2Pay\GlobalPay\Helper\Smart2Pay::transaction_logger_params_to_title() and is_array($transaction_details_titles)) {
             if (!($all_params = $this->_helper->getParams())) {
                 $all_params = [];
             }
             foreach ($transaction_details_titles as $key => $title) {
                 if (!array_key_exists($key, $all_params)) {
                     continue;
                 }
                 $transaction_extra_data[$key] = $all_params[$key];
             }
         }
     }
     $result_message = __('Transaction status is unknown.');
     if (empty($error_message)) {
         //map all statuses to known Magento statuses (message_data_2, message_data_4, message_data_3 and message_data_7)
         $status_id_to_string = array(Smart2Pay::S2P_STATUS_OPEN => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_SUCCESS => Smart2Pay::S2P_STATUS_SUCCESS, Smart2Pay::S2P_STATUS_CANCELLED => Smart2Pay::S2P_STATUS_CANCELLED, Smart2Pay::S2P_STATUS_FAILED => Smart2Pay::S2P_STATUS_FAILED, Smart2Pay::S2P_STATUS_EXPIRED => Smart2Pay::S2P_STATUS_FAILED, Smart2Pay::S2P_STATUS_PENDING_CUSTOMER => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_PENDING_PROVIDER => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_SUBMITTED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_PROCESSING => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_AUTHORIZED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_APPROVED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_CAPTURED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_REJECTED => Smart2Pay::S2P_STATUS_FAILED, Smart2Pay::S2P_STATUS_PENDING_CAPTURE => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_EXCEPTION => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_PENDING_CANCEL => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_REVERSED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_COMPLETED => Smart2Pay::S2P_STATUS_SUCCESS, Smart2Pay::S2P_STATUS_PROCESSING => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_DISPUTED => Smart2Pay::S2P_STATUS_PENDING_PROVIDER, Smart2Pay::S2P_STATUS_CHARGEBACK => Smart2Pay::S2P_STATUS_PENDING_PROVIDER);
         if (isset($module_settings['message_data_' . $status_code])) {
             $result_message = $module_settings['message_data_' . $status_code];
         } elseif (!empty($status_id_to_string[$status_code]) and isset($module_settings['message_data_' . $status_id_to_string[$status_code]])) {
             $result_message = $module_settings['message_data_' . $status_id_to_string[$status_code]];
         }
     }
     $this->addData(['error_message' => $error_message, 'result_message' => $result_message, 'transaction_data' => $s2p_transaction->getData(), 'transaction_extra_data' => $transaction_extra_data, 'transaction_details_title' => $transaction_details_titles, 'is_order_visible' => $this->isVisible($order), 'view_order_url' => $this->getUrl('sales/order/view/', ['order_id' => $order->getEntityId()]), 'can_view_order' => $this->canViewOrder($order), 'order_id' => $order->getIncrementId()]);
 }
开发者ID:smart2pay,项目名称:magento20,代码行数:53,代码来源:Finish.php


示例15: _getOrder

 /**
  * @param $incrementId
  * @return \Magento\Sales\Model\Order
  */
 protected function _getOrder($incrementId)
 {
     if (!$this->_order) {
         $this->_order = $this->_orderFactory->create()->loadByIncrementId($incrementId);
     }
     return $this->_order;
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:11,代码来源:ResultPos.php


示例16: initOrderMock

 private function initOrderMock($orderId, $state)
 {
     $this->orderFactoryMock->expects($this->any())->method('create')->will($this->returnValue($this->orderMock));
     $this->orderMock->expects($this->once())->method('loadByIncrementId')->with($orderId)->will($this->returnSelf());
     $this->orderMock->expects($this->once())->method('getIncrementId')->will($this->returnValue($orderId));
     $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue($state));
 }
开发者ID:Zash22,项目名称:magento,代码行数:7,代码来源:ReturnUrlTest.php


示例17: _updateNewOrderDatafields

 /**
  * Update new order default datafields.
  */
 public function _updateNewOrderDatafields()
 {
     $website = $this->storeManager->getWebsite($this->websiteId);
     $orderModel = $this->orderFactory->create()->load($this->typeId);
     //data fields
     if ($lastOrderId = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_ID)) {
         $data[] = ['Key' => $lastOrderId, 'Value' => $orderModel->getId()];
     }
     if ($orderIncrementId = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_INCREMENT_ID)) {
         $data[] = ['Key' => $orderIncrementId, 'Value' => $orderModel->getIncrementId()];
     }
     if ($storeName = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_STORE_NAME)) {
         $data[] = ['Key' => $storeName, 'Value' => $this->storeName];
     }
     if ($websiteName = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_WEBSITE_NAME)) {
         $data[] = ['Key' => $websiteName, 'Value' => $website->getName()];
     }
     if ($lastOrderDate = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_LAST_ORDER_DATE)) {
         $data[] = ['Key' => $lastOrderDate, 'Value' => $orderModel->getCreatedAt()];
     }
     if (($customerId = $website->getConfig(\Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_CUSTOMER_ID)) && $orderModel->getCustomerId()) {
         $data[] = ['Key' => $customerId, 'Value' => $orderModel->getCustomerId()];
     }
     if (!empty($data)) {
         //update data fields
         $client = $this->helper->getWebsiteApiClient($website);
         $client->updateContactDatafieldsByEmail($orderModel->getCustomerEmail(), $data);
     }
 }
开发者ID:dotmailer,项目名称:dotmailer-magento2-extension,代码行数:32,代码来源:Automation.php


示例18: makePreference

 /**
  * Return array with data to send to MP api
  *
  * @return array
  */
 public function makePreference()
 {
     $orderIncrementId = $this->_checkoutSession->getLastRealOrderId();
     $order = $this->_orderFactory->create()->loadByIncrementId($orderIncrementId);
     $customer = $this->_customerSession->getCustomer();
     $payment = $order->getPayment();
     $paramsShipment = new \Magento\Framework\DataObject();
     $paramsShipment->setParams([]);
     $this->_eventManager->dispatch('mercadopago_standard_make_preference_before', ['params' => $paramsShipment, 'order' => $order]);
     $arr = [];
     $arr['external_reference'] = $orderIncrementId;
     $arr['items'] = $this->getItems($order);
     $this->_calculateDiscountAmount($arr['items'], $order);
     $this->_calculateBaseTaxAmount($arr['items'], $order);
     $total_item = $this->getTotalItems($arr['items']);
     $total_item += (double) $order->getBaseShippingAmount();
     $order_amount = (double) $order->getBaseGrandTotal();
     if (!$order_amount) {
         $order_amount = (double) $order->getBasePrice() + $order->getBaseShippingAmount();
     }
     if ($total_item > $order_amount || $total_item < $order_amount) {
         $diff_price = $order_amount - $total_item;
         $arr['items'][] = ["title" => "Difference amount of the items with a total", "description" => "Difference amount of the items with a total", "category_id" => $this->_scopeConfig->getValue('payment/mercadopago/category_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE), "quantity" => 1, "unit_price" => (double) $diff_price];
         $this->_helperData->log("Total itens: " . $total_item, 'mercadopago-standard.log');
         $this->_helperData->log("Total order: " . $order_amount, 'mercadopago-standard.log');
         $this->_helperData->log("Difference add itens: " . $diff_price, 'mercadopago-standard.log');
     }
     if ($order->canShip()) {
         $shippingAddress = $order->getShippingAddress();
         $shipping = $shippingAddress->getData();
         $arr['payer']['phone'] = ["area_code" => "-", "number" => $shipping['telephone']];
         $arr['shipments'] = $this->_getParamShipment($paramsShipment, $order, $shippingAddress);
     }
     $billing_address = $order->getBillingAddress()->getData();
     $arr['payer']['date_created'] = date('Y-m-d', $customer->getCreatedAtTimestamp()) . "T" . date('H:i:s', $customer->getCreatedAtTimestamp());
     $arr['payer']['email'] = htmlentities($customer->getEmail());
     $arr['payer']['first_name'] = htmlentities($customer->getFirstname());
     $arr['payer']['last_name'] = htmlentities($customer->getLastname());
     if (isset($payment['additional_information']['doc_number']) && $payment['additional_information']['doc_number'] != "") {
         $arr['payer']['identification'] = ["type" => "CPF", "number" => $payment['additional_information']['doc_number']];
     }
     $arr['payer']['address'] = ["zip_code" => $billing_address['postcode'], "street_name" => $billing_address['street'] . " - " . $billing_address['city'] . " - " . $billing_address['country_id'], "street_number" => ""];
     $url = $this->_helperData->getSuccessUrl();
     $arr['back_urls'] = ['success' => $this->_urlBuilder->getUrl($url), 'pending' => $this->_urlBuilder->getUrl($url), 'failure' => $this->_urlBuilder->getUrl('checkout/onepage/failure')];
     $arr['notification_url'] = $this->_urlBuilder->getUrl("mercadopago/notifications/standard");
     $arr['payment_methods']['excluded_payment_methods'] = $this->getExcludedPaymentsMethods();
     $installments = $this->getConfigData('installments');
     $arr['payment_methods']['installments'] = (int) $installments;
     $auto_return = $this->getConfigData('auto_return');
     if ($auto_return == 1) {
         $arr['auto_return'] = "approved";
     }
     $sponsor_id = $this->_scopeConfig->getValue('payment/mercadopago/sponsor_id', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
     $this->_helperData->log("Sponsor_id", 'mercadopago-standard.log', $sponsor_id);
     if (!empty($sponsor_id)) {
         $this->_helperData->log("Sponsor_id identificado", 'mercadopago-standard.log', $sponsor_id);
         $arr['sponsor_id'] = (int) $sponsor_id;
     }
     return $arr;
 }
开发者ID:SummaSolutions,项目名称:cart-magento2,代码行数:65,代码来源:Payment.php


示例19: getOrder

 /**
  * Get order
  *
  * @return \Magento\Sales\Model\Order
  */
 public function getOrder()
 {
     if (!$this->order) {
         $this->order = $this->orderFactory->create()->load($this->getParentId());
     }
     return $this->order;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:Address.php


示例20: getOrder

 /**
  * @return \Magento\Sales\Model\Order
  */
 protected function getOrder()
 {
     if ($this->order) {
         return $this->order;
     }
     $data = null;
     $json = base64_decode((string) $this->request->getParam('data'));
     if ($json) {
         $data = json_decode($json, true);
     }
     if (!is_array($data)) {
         return null;
     }
     if (!isset($data['order_id']) || !isset($data['increment_id']) || !isset($data['customer_id'])) {
         return null;
     }
     /** @var $order \Magento\Sales\Model\Order */
     $order = $this->orderFactory->create();
     $order->load($data['order_id']);
     if ($order->getIncrementId() != $data['increment_id'] || $order->getCustomerId() != $data['customer_id']) {
         $order = null;
     }
     $this->order = $order;
     return $this->order;
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:28,代码来源:OrderStatus.php



注:本文中的Magento\Sales\Model\OrderFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Order\Creditmemo类代码示例发布时间:2022-05-23
下一篇:
PHP Model\Order类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap