/** * @magentoDataFixture Magento/Paypal/_files/quote_payment_standard.php * @magentoConfigFixture current_store payment/paypal_standard/active 1 * @magentoConfigFixture current_store paypal/general/business_account merchant_2012050718_biz@example.com */ public function testCancelAction() { $quote = $this->_objectManager->create('Magento\\Sales\\Model\\Quote'); $quote->load('test01', 'reserved_order_id'); $this->_session->setQuoteId($quote->getId()); $this->_session->setPaypalStandardQuoteId($quote->getId())->setLastRealOrderId('100000002'); $this->dispatch('paypal/standard/cancel'); $this->_order->load('100000002', 'increment_id'); $this->assertEquals('canceled', $this->_order->getState()); $this->assertEquals($this->_session->getQuote()->getGrandTotal(), $quote->getGrandTotal()); $this->assertEquals($this->_session->getQuote()->getItemsCount(), $quote->getItemsCount()); }
/** * Retrieve order model object * * @return \Magento\Sales\Model\Order */ public function getOrder() { if ($this->_order === null) { $this->_order = $this->_orderFactory->create(); if ($this->getOrderId()) { $this->_order->load($this->getOrderId()); } } return $this->_order; }
/** * Get all transactions and orders and return builded data * * @return array */ public function request() { //load payments by date $this->getPagSeguroAbandoned(); if ($this->_PagSeguroPaymentList->getTransactions()) { foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) { date_default_timezone_set('UTC'); $order = \UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference()); $order = $this->_order->load($order); if ($this->getStoreReference() == \UOL\PagSeguro\Helper\Data::getReferenceDecrypt($payment->getReference())) { if (!is_null($this->_session->getData('store_id'))) { array_push($this->_arrayPayments, $this->build($payment, $order)); } if ($order) { array_push($this->_arrayPayments, $this->build($payment, $order)); } } } } date_default_timezone_set($this->_timezone->getConfigTimezone()); return $this->_arrayPayments; }
/** * Change the magento order status * * @param $id int of order id * @param $status string of payment status */ private function addStatusToOrder($id, $status) { $order = $this->_order->load($id); $order->addStatusToHistory($status, null, true); $order->save(); }
/** * Change the magento order status * * @param $id int of order id * @param $status string of payment status */ private function addStatusToOrder($id, $status) { $order = $this->_order->load($id); $order->addStatusToHistory($this->getStatusFromPaymentKey($status), null, true); $order->save(); }