예제 #1
0
 public function testPayHspRequest()
 {
     $paymentRequest = new HspPaymentRequest();
     $paymentRequest->setId(10);
     try {
         $paymentRequest->payHspRequest();
         $this->fail('Exception not thrown');
     } catch (HspPaymentRequestException $e) {
         $this->assertEquals(HspPaymentRequestException::ALREADY_PAID, $e->getCode(), 'Unexpected exception thrown');
     }
     $paymentRequest = new HspPaymentRequest();
     $paymentRequest->setId(11);
     $paymentRequest->setDatePaid(date('Y-m-d'));
     $paymentRequest->setCheckNumber('bsdfds-gfgbvbv-bfdtr');
     try {
         $paymentRequest->payHspRequest();
         $paymentRequest = HspPaymentRequest::getHspRequest(11);
         $this->assertNotNull($paymentRequest);
         $this->assertEquals(HspPaymentRequest::HSP_PAYMENT_REQUEST_STATUS_PAID, $paymentRequest->getStatus());
     } catch (HspPaymentRequestException $e) {
         $this->fail('Unexpected exception thrown');
     }
 }