/** @return HttpClient */ public function createHttpClient(ClientInterface $transport = null) { $httpClient = new HttpClient($this->apiUrl, $this->apiVersion, $this->authentication, $transport ?: new GuzzleClient()); $httpClient->setCaBundle($this->caBundle); $httpClient->setLogger($this->logger); return $httpClient; }
public function testGetPaymentMethod() { $expected = new PaymentMethod(); $response = $this->getMock(ResponseInterface::class); $this->http->expects($this->any())->method('get')->with('/v2/payment-methods/PAYMENT_METHOD_ID', ['foo' => 'bar'])->willReturn($response); $this->mapper->expects($this->any())->method('toPaymentMethod')->with($response)->willReturn($expected); $actual = $this->client->getPaymentMethod('PAYMENT_METHOD_ID', ['foo' => 'bar']); $this->assertSame($expected, $actual); }
public function testTwoFactorTokenPost() { $this->transport->expects($this->once())->method('send')->with($this->isRequestFor('POST', '/'), $this->isValidOptionsArray(['CB-2FA-TOKEN'])); $this->client->post('/', ['foo' => 'bar', Param::TWO_FACTOR_TOKEN => 'TOKEN']); }