/** * @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; }
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)); }