/** * @param PaymentRequestDTO $paymentRequestDTO * @throws PaymentException * @return PaymentResponseDTO */ public function requestHostedEndpoint(PaymentRequestDTO $paymentRequestDTO) { $giropayRequest = new GiropayTransactionStartRequest(); /* * * $request->setInfo1Label("Ihre Kundennummer"); * $request->setInfo1Text("0815"); */ if ($paymentRequestDTO->getSepaBankAccount() == null) { throw new InvalidArgumentException(); } $giropayRequest->setMerchantTxId(1234567890); $giropayRequest->setPurpose($paymentRequestDTO->getOrderDescription()); $giropayRequest->setCurrency($paymentRequestDTO->getOrderCurrencyCode()); $giropayRequest->setAmount($paymentRequestDTO->getTransactionTotal()); $giropayRequest->setIban($paymentRequestDTO->getSepaBankAccount()->getSepaBankAccountIBAN()); $giropayRequest->setBic($paymentRequestDTO->getSepaBankAccount()->getSepaBankAccountBIC()); $giropayRequest->setUrlRedirect($this->configuration->getRedirectUrl()); $giropayRequest->setUrlNotify($this->configuration->getNotifyUrl()); try { $giropayResponse = $this->giropayPaymentService->process($giropayRequest); /** @var GiropayTransactionStartResponse $giropayResponse */ if (!GiropayResultType::$OK->equals($giropayResponse->getResult())) { throw new PaymentException($giropayResponse->getResult()->getType() . ' (' . $giropayResponse->getResult()->getFriendlyType() . ')'); } } catch (\Exception $e) { throw new PaymentException("Could not process payment: " . $e->getMessage(), 0, $e); } $responseDTO = new PaymentResponseDTO(PaymentType::$THIRD_PARTY_ACCOUNT, GiropayPaymentGatewayType::$GIROPAY); $responseDTO->responseMap(GiropayConstants::HOSTED_REDIRECT_URL, $giropayResponse->getRedirect())->responseMap(GiropayConstants::GATEWAY_TRANSACTION_ID, $giropayResponse->getReference()); return $responseDTO; }
/** * @return int */ public function getFailureReportingThreshold() { return $this->configuration->getFailureReportingThreshold(); }