Esempio n. 1
0
 /**
  * @test
  */
 public function shouldAllowIterateOverSetFields()
 {
     $paymentDetails = new PaymentDetails();
     $paymentDetails['messages'] = 'foo';
     $paymentDetails->setAmount('baz');
     $this->assertEquals(array('messages' => 'foo', 'amount' => 'baz'), iterator_to_array($paymentDetails));
 }
Esempio n. 2
0
 /**
  * @test
  */
 public function checkErrorResponse()
 {
     $payment = $this->getPayment();
     $request = new MakePaymentRequest();
     $request->setIncludeReceiptInResponse(false);
     $request->getCredential();
     $paymentDetails = new PaymentDetails();
     $paymentDetails->setRequest($request);
     $captureRequest = new CaptureRequest($paymentDetails);
     $payment->execute($captureRequest);
     $statusRequest = new BinaryMaskStatusRequest($captureRequest->getModel());
     $payment->execute($statusRequest);
     $model = $statusRequest->getModel();
     $this->assertFalse($statusRequest->isSuccess());
     $this->assertEmpty($model['transactionId']);
     $this->assertNotEmpty($model['messages']);
     $this->assertTrue(is_string($model['messages']));
 }
Esempio n. 3
0
 /**
  * @test
  */
 public function shouldAllowRegisterTokenToAdditionalMerchant()
 {
     $payment = $this->getPayment();
     $request = new RegisterTokenToAdditionalMerchantRequest();
     $request->setToken(static::$token);
     $request->getRegisterToMerchantCredential()->setMerchantName($GLOBALS['__PAYUM_HEARTLAND_SECOND_MERCHANT_NAME']);
     $paymentDetails = new PaymentDetails();
     $paymentDetails->setMerchantName($GLOBALS['__PAYUM_HEARTLAND_MERCHANT_NAME']);
     $paymentDetails->setRequest($request);
     $captureRequest = new CaptureRequest($paymentDetails);
     $payment->execute($captureRequest);
     $statusRequest = new BinaryMaskStatusRequest($captureRequest->getModel());
     $payment->execute($statusRequest);
     /** @var RegisterTokenToAdditionalMerchantResponse $response */
     $response = $statusRequest->getModel()->getResponse();
     $this->assertTrue($statusRequest->isSuccess(), $paymentDetails->getMessages());
 }