public function testCreateGetPaymentRequest() { $res = $this->client->createPaymentRequest($this->paymentRequest); codecept_debug($res->getStatusCode()); codecept_debug($res->getHeaders()); $this->assertEquals(201, $res->getStatusCode()); $id = Util::getPaymentRequestIdFromResponse($res); $res = $this->client->getPaymentRequest($id); $body = Util::decodeResponse($res); codecept_debug($body); $this->assertEquals($id, $body['id']); }
/** * @dataProvider handlerProvider * @param $handler * @param bool $shouldTestWithHandler */ public function testCreateGetPaymentRequestWithHandler($handler, $shouldTestWithHandler) { if (!$shouldTestWithHandler) { $this->markTestSkipped('Skipping handler test with ' . get_class($handler)); } $client = $this->makeClient($handler); $paymentRequest = $this->paymentRequest; $paymentRequest['payerAlias'] = $this->randomSwedishPhoneNumber(); codecept_debug($paymentRequest['payerAlias']); $res = $client->createPaymentRequest($paymentRequest); codecept_debug($res->getStatusCode()); codecept_debug($res->getHeaders()); codecept_debug((string) $res->getBody()); $this->assertEquals(201, $res->getStatusCode()); $id = Util::getPaymentRequestIdFromResponse($res); $res = $client->getPaymentRequest($id); $body = Util::decodeResponse($res); codecept_debug($body); $this->assertEquals($id, $body['id']); }
public function testGetPaymentRequestIdFromResponse() { $id = 'ABC123'; $response = new Response(200, ['Location' => 'http://localhost/paymentrequests/' . $id]); $this->assertEquals($id, Util::getPaymentRequestIdFromResponse($response)); }