public function equals(GiropayRequest $o) { return $this->getMethod() == $o->getMethod(); }
/** * Builds a Giropay Response of out of a Guzzle HttpResponse * @return GiropayResponse * @param \GuzzleHttp\Message\Response $httpResponse * @param Message\GiropayRequest $paymentRequest */ public function buildResponseFromHttpResponse(Response $httpResponse, GiropayRequest $paymentRequest) { $giropayResponse = null; if (GiropayMethodType::$TRANSACTION_START->equals($paymentRequest->getMethod())) { $giropayResponse = $this->buildTransactionStartResponse($httpResponse); } elseif (GiropayMethodType::$TRANSACTION_STATUS->equals($paymentRequest->getMethod())) { $giropayResponse = $this->buildTransactionStatusResponse($httpResponse); } else { throw new \InvalidArgumentException("Method type not supported: " . $paymentRequest->getMethod()->getFriendlyType()); } return $giropayResponse; }
/** * @param ClientInterface $client * @param GiropayRequest $giropayRequest * @return RequestInterface */ public function buildRequest(ClientInterface $client, GiropayRequest $giropayRequest) { $request = null; if (GiropayMethodType::$TRANSACTION_START->equals($giropayRequest->getMethod())) { $request = $this->buildTransactionStartRequest($client, $giropayRequest); } else { if (GiropayMethodType::$TRANSACTION_STATUS->equals($giropayRequest->getMethod())) { $request = $this->buildTransactionStatusRequest($client, $giropayRequest); } else { if (GiropayMethodType::$BANKSTATUS->equals($giropayRequest->getMethod())) { $request = $this->buildBankstatusRequest($client, $giropayRequest); } else { throw new InvalidArgumentException("Method type not supported: " . $giropayRequest->getMethod()->getFriendlyType()); } } } return $request; }