/**
  * @covers ::getResumeContextResponse
  *
  * @depends testGetPayment
  */
 public function testGetResumeContextResponse()
 {
     $response = $this->getMock(ResponseInterface::class);
     $payment = $this->getMock(PaymentInterface::class);
     $this->sut->setPayment($payment);
     $this->sut->expects($this->atLeastOnce())->method('doGetResumeContextResponse')->willReturn($response);
     $this->eventDispatcher->expects($this->once())->method('preResumeContext')->with($payment);
     $this->assertSame($response, $this->sut->getResumeContextResponse());
 }
 /**
  * {@inheritdoc}
  */
 public function refundPayment()
 {
     if (!$this->getPayment()) {
         throw new \LogicException('Trying to refund a non-existing payment. A payment must be set trough self::setPayment() first.');
     }
     $this->eventDispatcher->preRefundPayment($this->getPayment());
     $this->doRefundPayment();
     return $this->getPaymentRefundResult();
 }
 /**
  * {@inheritdoc}
  */
 function loadPaymentIds($category_id, $owner_id)
 {
     $allowed_payment_status_ids = [];
     foreach ($this->getAllowedPaymentStatusIds() as $payment_status_id) {
         $allowed_payment_status_ids = array_merge($allowed_payment_status_ids, array($payment_status_id), $this->paymentStatusManager->getDescendants($payment_status_id));
     }
     if (empty($allowed_payment_status_ids)) {
         throw new \RuntimeException('There are no allowed payment statuses. Use self::setAllowedPaymentStatusIds() to set the allowed payment statuses.');
     }
     $query = $this->database->select('payment_queue', 'pq');
     $query->addJoin('INNER', 'payment', 'p', 'p.id = pq.payment_id');
     $query->addJoin('INNER', 'payment__payment_statuses', 'p_ps', 'p.id = p_ps.entity_id AND p.current_payment_status_delta = p_ps.delta');
     $query->fields('pq', array('payment_id'))->condition('pq.category_id', $category_id)->condition('p_ps.payment_statuses_plugin_id', $allowed_payment_status_ids)->condition('p.owner', $owner_id)->condition('pq.queue_id', $this->queueId);
     $payment_ids = $query->execute()->fetchCol();
     return $this->eventDispatcher->alterQueueLoadedPaymentIds($this->queueId, $category_id, $owner_id, $payment_ids);
 }
 /**
  * {@inheritdoc}
  */
 function getResumeContextResponse()
 {
     $this->eventDispatcher->preResumeContext($this->getPayment());
     return $this->doGetResumeContextResponse();
 }