コード例 #1
0
 public function testSetHoldedOrderStatus()
 {
     $status = 'REJECTED';
     $orderStateOld = 'old_state';
     $orderStatusOld = 'old_status';
     $orderStateNew = Sales\Order::STATE_HOLDED;
     $orderStatusNew = 'new_status';
     $order = $this->getOrderMock();
     $config = $this->getMockBuilder(Sales\Order\Config::class)->disableOriginalConstructor()->getMock();
     $config->expects($this->once())->method('getStateDefaultStatus')->with($this->equalTo($orderStateNew))->willReturn($orderStatusNew);
     $order->expects($this->once())->method('getConfig')->willReturn($config);
     $order->expects($this->once())->method('getState')->willReturn($orderStateOld);
     $order->expects($this->once())->method('getStatus')->willReturn($orderStatusOld);
     $order->expects($this->once())->method('setHoldBeforeState')->with($this->equalTo($orderStateOld))->will($this->returnSelf());
     $order->expects($this->once())->method('setHoldBeforeStatus')->with($this->equalTo($orderStatusOld))->will($this->returnSelf());
     $order->expects($this->once())->method('setState')->with($this->equalTo($orderStateNew))->will($this->returnSelf());
     $order->expects($this->once())->method('setStatus')->with($this->equalTo($orderStatusNew))->will($this->returnSelf());
     $order->expects($this->once())->method('addStatusHistoryComment')->with($this->equalTo(__('Payu.pl status') . ': ' . $status));
     $order->expects($this->once())->method('save')->will($this->returnSelf());
     $this->model->setHoldedOrderStatus($order, $status);
 }
コード例 #2
0
ファイル: Processor.php プロジェクト: ORBA/magento2_payupl
 /**
  * @param string $payuplOrderId
  * @param string $status
  * @throws LocalizedException
  */
 public function processHolded($payuplOrderId, $status)
 {
     $order = $this->loadOrderByPayuplOrderId($payuplOrderId);
     $this->orderHelper->setHoldedOrderStatus($order, $status);
     $this->transactionService->updateStatus($payuplOrderId, $status, true);
 }