示例#1
0
 /**
  * @see PaymentApi::refund()
  * @dataProvider providerMockTransaction
  *
  * @param \PayU\Entity\Transaction\TransactionEntity $transaction
  */
 public function testRefund($transaction)
 {
     $this->markTestSkipped("PayU Latam doesn't implement REFUND in test environment");
     $mock = $this->object->authorizeAndCapture($transaction);
     $rs = $this->object->refund($mock->transactionResponse->orderId, $mock->transactionResponse->transactionId);
     $this->_testTransactionResponse($rs);
 }
 /**
  * @see PaymentApi::cashCollection()
  * @dataProvider providerMockTransaction
  *
  * @param \PayU\Entity\Transaction\TransactionEntity $transaction
  */
 public function testCashCollection($transaction)
 {
     $rs = $this->object->cashCollection($transaction, rand(1, 10));
     $this->assertInstanceOf('\\stdClass', $rs);
     $this->assertEquals('SUCCESS', $rs->code);
     $this->assertEquals(0, strlen($rs->error));
     $this->assertTrue(isset($rs->transactionResponse));
     $this->assertInstanceOf('\\stdClass', $rs->transactionResponse);
     $transaction = $rs->transactionResponse;
     $this->assertTrue(isset($transaction->orderId));
     $this->assertGreaterThan(0, strlen($transaction->orderId));
     $this->assertTrue(isset($transaction->transactionId));
     $this->assertGreaterThan(0, strlen($transaction->transactionId));
     $this->assertTrue(isset($transaction->state));
     $this->assertEquals('PENDING', $transaction->state);
     $this->assertEquals(0, strlen($transaction->paymentNetworkResponseCode));
     $this->assertEquals(0, strlen($transaction->paymentNetworkResponseErrorMessage));
     $this->assertTrue(isset($transaction->trazabilityCode));
     $this->assertGreaterThan(0, strlen($transaction->trazabilityCode));
     $this->assertTrue(isset($transaction->authorizationCode));
     $this->assertGreaterThan(0, strlen($transaction->authorizationCode));
     $this->assertTrue(isset($transaction->pendingReason));
     $this->assertEquals('AWAITING_NOTIFICATION', $transaction->pendingReason);
     $this->assertTrue(isset($transaction->responseCode));
     $this->assertEquals('PENDING_TRANSACTION_CONFIRMATION', $transaction->responseCode);
     $this->assertEquals(0, strlen($transaction->errorCode));
     $this->assertEquals(0, strlen($transaction->responseMessage));
     $this->assertEquals(0, strlen($transaction->transactionDate));
     $this->assertEquals(0, strlen($transaction->transactionTime));
     $this->assertEquals(0, strlen($transaction->operationDate));
     $this->assertTrue(isset($transaction->extraParameters));
     $this->assertInstanceOf('\\stdClass', $transaction->extraParameters);
     $extraParameters = $transaction->extraParameters;
     $this->assertTrue(isset($extraParameters->URL_PAYMENT_RECEIPT_HTML));
     $regex = '/https:\\/\\/stg.gateway.payulatam.com\\/ppp-web-gateway\\/voucher.zul\\?vid=[a-z0-9]{39}/i';
     $this->assertRegExp($regex, $extraParameters->URL_PAYMENT_RECEIPT_HTML);
     $this->assertTrue(isset($extraParameters->BAR_CODE));
     $this->assertGreaterThan(0, strlen($extraParameters->BAR_CODE));
     $this->assertTrue(isset($extraParameters->REFERENCE));
     $this->assertEquals($transaction->orderId, $extraParameters->REFERENCE);
 }