public function testBankstatusRequest() { $request = new GiropayBankstatusRequest(); $request->setBic("TESTDETT421"); $httpRequest = $this->requestGenerator->buildRequest($this->client, $request); $this->assertEquals('POST', $httpRequest->getMethod()); $this->assertEquals("https://payment.girosolution.de/girocheckout/api/v2/giropay/bankstatus", $httpRequest->getUrl()); $this->assertEquals($httpRequest->getBody()->getField('hash'), "b6e4de587edea9f2d61bd2820f0638e4"); }
/** * @param ClientInterface $client * @param GiropayBankstatusRequest $giropayRequest * @return RequestInterface */ protected function buildBankstatusRequest(ClientInterface $client, GiropayBankstatusRequest $giropayRequest) { $requestArray = array(); $requestArray['merchantId'] = $this->getMerchantId(); $requestArray['projectId'] = $this->getProjectId(); if ($giropayRequest->getBic() == "") { throw new InvalidArgumentException("Field bic is required"); } $requestArray['bic'] = $giropayRequest->getBic(); //this works because the hash list in PHP has a sort order (we get the values out in the order we added them) $sortedValuesString = implode('', array_values($requestArray)); $requestArray['hash'] = $this->getHMACMD5Hash($this->getSecret(), $sortedValuesString); $request = $client->createRequest("POST", "https://payment.girosolution.de/girocheckout/api/v2/giropay/bankstatus", ['body' => $requestArray]); return $request; }