コード例 #1
0
 public function testRedirect()
 {
     $httpResponse = $this->getMockHttpResponse('PurchaseRedirect.txt');
     $request = m::mock('\\Omnipay\\Common\\Message\\AbstractRequest');
     $request->shouldReceive('getReturnUrl')->once()->andReturn('http://sanalmagaza.org/');
     $response = new Response($request, $httpResponse->getBody());
     $this->assertTrue($response->isRedirect());
     $this->assertSame('POST', $response->getRedirectMethod());
     $this->assertSame('http://sanalmagaza.org/', $response->getRedirectUrl());
     $expectedData = array('ReturnUrl' => 'http://sanalmagaza.org/', 'ReferanceId' => '130215141054377801316798');
     $this->assertEquals($expectedData, $response->getRedirectData());
 }
コード例 #2
0
 public function sendData($data)
 {
     // Post to Iyzico
     $headers = array('Content-Type' => 'application/x-www-form-urlencoded');
     if ($this->actionType === "CC.RF") {
         $httpResponse = $this->httpClient->post($this->endpoints['refund'], $headers, $data)->send();
         return $this->response = new Response($this, $httpResponse->getBody());
     } else {
         $httpResponse = $this->httpClient->post($this->endpoints['token'], $headers, $data)->send();
         $token = new Response($this, $httpResponse->getBody());
         $pay = array('card_number' => $this->getCard()->getNumber(), 'card_expiry_month' => $this->getCard()->getExpiryMonth(), 'card_expiry_year' => $this->getCard()->getExpiryYear(), 'card_verification' => $this->getCard()->getCvv(), 'card_holder_name' => '', 'card_brand' => $this->getCardProvider($this->getCard()->getNumber()), 'pay' => 'Ödeme Yap', 'version' => '1.0', 'response_mode' => 'SYNC', 'enable_3d_secure' => false, 'currency' => $this->getCurrency(), 'transaction_token' => $token->getCode(), 'installment-option' => $this->getInstallment(), 'connector_type' => $this->getBank(), 'mode' => $this->getTestMode() ? "test" : "live");
         $httpResponsePay = $this->httpClient->post($this->endpoints['purchase'], $headers, $pay, ['allow_redirects' => false])->send();
         return $this->response = new Response($this, $httpResponsePay->getBody());
     }
 }
コード例 #3
0
ファイル: ResponseTest.php プロジェクト: mayoz/omnipay-iyzico
 public function testAuthorizeSuccess()
 {
     $httpResponse = $this->getMockHttpResponse('AuthorizeSuccess.txt');
     $response = new Response($this->getMockRequest(), $httpResponse->json());
     $this->assertTrue($response->isSuccessful());
     $this->assertFalse($response->isRedirect());
     $this->assertSame('MTQ0NjgzMTQ5OArABirnISnF5KCCbyjn', $response->getTransactionReference());
     $this->assertNull($response->getCardReference());
     $this->assertNull($response->getMessage());
 }