コード例 #1
0
ファイル: Payment.php プロジェクト: tozwierz/magento2_payupl
 /**
  * @param int $orderId
  * @return string|false
  */
 public function getRepeatPaymentUrl($orderId)
 {
     $order = $this->orderHelper->loadOrderById($orderId);
     if ($order && $this->orderHelper->canRepeatPayment($order)) {
         return $this->_urlBuilder->getUrl('orba_payupl/payment/repeat', ['id' => $this->transactionResource->getLastPayuplOrderIdByOrderId($orderId)]);
     }
     return false;
 }
コード例 #2
0
 public function testCanRepeatPaymentSuccess()
 {
     $order = $this->getOrderMock();
     $this->orderValidator->expects($this->once())->method('validateCustomer')->with($this->equalTo($order))->willReturn(true);
     $this->orderValidator->expects($this->once())->method('validatePaymentMethod')->with($this->equalTo($order))->willReturn(true);
     $this->orderValidator->expects($this->once())->method('validateState')->with($this->equalTo($order))->willReturn(true);
     $this->orderValidator->expects($this->once())->method('validateNotPaid')->with($this->equalTo($order))->willReturn(true);
     $this->orderValidator->expects($this->once())->method('validateNoTransactions')->with($this->equalTo($order))->willReturn(false);
     $this->assertTrue($this->model->canRepeatPayment($order));
 }