| Total Complexity | 89 |
| Total Lines | 872 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 2 | Features | 0 |
Complex classes like HeidelpayBusinessFactory often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use HeidelpayBusinessFactory, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 147 | class HeidelpayBusinessFactory extends AbstractBusinessFactory |
||
| 148 | { |
||
| 149 | /** |
||
| 150 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\AuthorizeTransactionHandlerInterface |
||
| 151 | */ |
||
| 152 | public function createAuthorizeTransactionHandler(): AuthorizeTransactionHandlerInterface |
||
| 153 | { |
||
| 154 | return new AuthorizeTransactionHandler( |
||
| 155 | $this->createAuthorizeTransaction(), |
||
| 156 | $this->getAuthorizePaymentMethodAdapterCollection(), |
||
| 157 | $this->createAdapterRequestFromOrderBuilder() |
||
| 158 | ); |
||
| 159 | } |
||
| 160 | |||
| 161 | /** |
||
| 162 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\AuthorizeOnRegistrationTransactionHandlerInterface |
||
| 163 | */ |
||
| 164 | public function createAuthorizeOnRegistrationTransactionHandler(): AuthorizeOnRegistrationTransactionHandlerInterface |
||
| 165 | { |
||
| 166 | return new AuthorizeOnRegistrationTransactionHandler( |
||
| 167 | $this->createAuthorizeOnRegistrationTransaction(), |
||
| 168 | $this->getAuthorizeOnRegistrationPaymentMethodAdapterCollection(), |
||
| 169 | $this->createAdapterRequestFromOrderBuilder() |
||
| 170 | ); |
||
| 171 | } |
||
| 172 | |||
| 173 | /** |
||
| 174 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\InitializeTransactionHandlerInterface |
||
| 175 | */ |
||
| 176 | public function createInitializeTransactionHandler(): InitializeTransactionHandlerInterface |
||
| 177 | { |
||
| 178 | return new InitializeTransactionHandler( |
||
| 179 | $this->createInitializeTransaction(), |
||
| 180 | $this->getInitializePaymentMethodAdapterCollection(), |
||
| 181 | $this->createEasyCreditAdapterRequestFromQuoteBuilder(), |
||
| 182 | $this->createBasketCreator() |
||
| 183 | ); |
||
| 184 | } |
||
| 185 | |||
| 186 | /** |
||
| 187 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\DebitTransactionHandlerInterface |
||
| 188 | */ |
||
| 189 | public function createDebitTransactionHandler(): DebitTransactionHandlerInterface |
||
| 190 | { |
||
| 191 | return new DebitTransactionHandler( |
||
| 192 | $this->createDebitTransaction(), |
||
| 193 | $this->getDebitPaymentMethodAdapterCollection(), |
||
| 194 | $this->createAdapterRequestFromOrderBuilder() |
||
| 195 | ); |
||
| 196 | } |
||
| 197 | |||
| 198 | /** |
||
| 199 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\DebitOnRegistrationTransactionHandlerInterface |
||
| 200 | */ |
||
| 201 | public function createDebitOnRegistrationTransactionHandler(): DebitOnRegistrationTransactionHandlerInterface |
||
| 202 | { |
||
| 203 | return new DebitOnRegistrationTransactionHandler( |
||
| 204 | $this->createDebitOnRegistrationTransaction(), |
||
| 205 | $this->getDebitOnRegistrationPaymentMethodAdapterCollection(), |
||
| 206 | $this->createAdapterRequestFromOrderBuilder() |
||
| 207 | ); |
||
| 208 | } |
||
| 209 | |||
| 210 | /** |
||
| 211 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\FinalizeTransactionHandlerInterface |
||
| 212 | */ |
||
| 213 | public function createFinalizeTransactionHandler(): FinalizeTransactionHandlerInterface |
||
| 214 | { |
||
| 215 | return new FinalizeTransactionHandler( |
||
| 216 | $this->createFinalizeTransaction(), |
||
| 217 | $this->getFinalizePaymentMethodAdapterCollection(), |
||
| 218 | $this->getAdapterRequestFromOrderBuilderCollection(), |
||
| 219 | $this->createPaymentWriter() |
||
| 220 | ); |
||
| 221 | } |
||
| 222 | |||
| 223 | /** |
||
| 224 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\AdapterRequestFromOrderBuilderInterface[] |
||
| 225 | */ |
||
| 226 | public function getAdapterRequestFromOrderBuilderCollection(): array |
||
| 227 | { |
||
| 228 | return [ |
||
| 229 | HeidelpayConfig::PAYMENT_METHOD_INVOICE_SECURED_B2C => $this->createAdapterRequestFromOrderBuilder(), |
||
| 230 | HeidelpayConfig::PAYMENT_METHOD_EASY_CREDIT => $this->createEasyCreditAdapterRequestFromOrderBuilder() |
||
| 231 | ]; |
||
| 232 | } |
||
| 233 | |||
| 234 | /** |
||
| 235 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\ReservationTransactionHandlerInterface |
||
| 236 | */ |
||
| 237 | public function createReservationTransactionHandler(): ReservationTransactionHandlerInterface |
||
| 238 | { |
||
| 239 | return new ReservationTransactionHandler( |
||
| 240 | $this->createReservationTransaction(), |
||
| 241 | $this->getReservationPaymentMethodAdapterCollection(), |
||
| 242 | $this->createAdapterRequestFromOrderBuilder(), |
||
| 243 | $this->createPaymentWriter() |
||
| 244 | ); |
||
| 245 | } |
||
| 246 | |||
| 247 | /** |
||
| 248 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\RefundTransactionHandlerInterface |
||
| 249 | */ |
||
| 250 | public function createRefundTransactionHandler(): RefundTransactionHandlerInterface |
||
| 251 | { |
||
| 252 | return new RefundTransactionHandler( |
||
| 253 | $this->createRefundTransaction(), |
||
| 254 | $this->getRefundPaymentMethodAdapterCollection(), |
||
| 255 | $this->createAdapterRequestFromOrderBuilder() |
||
| 256 | ); |
||
| 257 | } |
||
| 258 | |||
| 259 | /** |
||
| 260 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\CaptureTransactionHandlerInterface |
||
| 261 | */ |
||
| 262 | public function createCaptureTransactionHandler(): CaptureTransactionHandlerInterface |
||
| 263 | { |
||
| 264 | return new CaptureTransactionHandler( |
||
| 265 | $this->createCaptureTransaction(), |
||
| 266 | $this->getCapturePaymentMethodAdapterCollection(), |
||
| 267 | $this->createAdapterRequestFromOrderBuilder() |
||
| 268 | ); |
||
| 269 | } |
||
| 270 | |||
| 271 | /** |
||
| 272 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\ExternalResponseTransactionHandlerInterface |
||
| 273 | */ |
||
| 274 | public function createExternalResponseTransactionHandler(): ExternalResponseTransactionHandlerInterface |
||
| 275 | { |
||
| 276 | return new ExternalResponseTransactionHandler( |
||
| 277 | $this->createExternalResponseTransaction(), |
||
| 278 | $this->getExternalResponsePaymentMethodAdapterCollection(), |
||
| 279 | $this->createExternalPaymentResponseBuilder(), |
||
| 280 | $this->createPaymentWriter() |
||
| 281 | ); |
||
| 282 | } |
||
| 283 | |||
| 284 | /** |
||
| 285 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Handler\ExternalEasyCreditResponseTransactionHandlerInterface |
||
| 286 | */ |
||
| 287 | public function createEasyCreditInitializeExternalResponseTransactionHandler(): ExternalEasyCreditResponseTransactionHandlerInterface |
||
| 288 | { |
||
| 289 | return new ExternalEasyCreditResponseTransactionHandler( |
||
| 290 | $this->createEasyCreditInitializeExternalResponseTransaction(), |
||
| 291 | $this->getExternalResponsePaymentMethodAdapterCollection(), |
||
| 292 | $this->createExternalEasyCreditPaymentResponseBuilder(), |
||
| 293 | $this->createPaymentWriter() |
||
| 294 | ); |
||
| 295 | } |
||
| 296 | |||
| 297 | /** |
||
| 298 | * @return \SprykerEco\Zed\Heidelpay\Business\Adapter\AdapterFactoryInterface |
||
| 299 | */ |
||
| 300 | public function createAdapterFactory(): AdapterFactoryInterface |
||
| 301 | { |
||
| 302 | return new AdapterFactory(); |
||
| 303 | } |
||
| 304 | |||
| 305 | /** |
||
| 306 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\Logger\TransactionLoggerInterface |
||
| 307 | */ |
||
| 308 | public function createTransactionLogger(): TransactionLoggerInterface |
||
| 309 | { |
||
| 310 | return new TransactionLogger( |
||
| 311 | $this->getUtilEncodingService(), |
||
| 312 | $this->createAesEncrypter() |
||
| 313 | ); |
||
| 314 | } |
||
| 315 | |||
| 316 | /** |
||
| 317 | * @return \SprykerEco\Zed\Heidelpay\Business\Order\SaverInterface |
||
| 318 | */ |
||
| 319 | public function createOrderSaver(): SaverInterface |
||
| 320 | { |
||
| 321 | return new Saver( |
||
| 322 | $this->createBasketCreator(), |
||
| 323 | $this->getPaymentMethodWithPreSavePaymentCollection() |
||
| 324 | ); |
||
| 325 | } |
||
| 326 | |||
| 327 | /** |
||
| 328 | * @return \SprykerEco\Zed\Heidelpay\Business\Hook\PostSaveHookInterface |
||
| 329 | */ |
||
| 330 | public function createPostSaveHook(): PostSaveHookInterface |
||
| 331 | { |
||
| 332 | return new PostSaveHook($this->getPaymentMethodWithPostSaveOrderCollection()); |
||
| 333 | } |
||
| 334 | |||
| 335 | /** |
||
| 336 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\PaymentReaderInterface |
||
| 337 | */ |
||
| 338 | public function createPaymentReader(): PaymentReaderInterface |
||
| 339 | { |
||
| 340 | return new PaymentReader($this->getQueryContainer()); |
||
| 341 | } |
||
| 342 | |||
| 343 | /** |
||
| 344 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\PaymentWriterInterface |
||
| 345 | */ |
||
| 346 | public function createPaymentWriter(): PaymentWriterInterface |
||
| 347 | { |
||
| 348 | return new PaymentWriter($this->getEntityManager()); |
||
| 349 | } |
||
| 350 | |||
| 351 | /** |
||
| 352 | * @return \SprykerEco\Zed\Heidelpay\Business\Order\OrderReaderInterface |
||
| 353 | */ |
||
| 354 | public function createOrderReader(): OrderReaderInterface |
||
| 355 | { |
||
| 356 | return new OrderReader($this->getSalesQueryContainer()); |
||
| 357 | } |
||
| 358 | |||
| 359 | /** |
||
| 360 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\TransactionLogReaderInterface |
||
| 361 | */ |
||
| 362 | public function createTransactionLogReader(): TransactionLogReaderInterface |
||
| 363 | { |
||
| 364 | return new TransactionLogReader( |
||
| 365 | $this->getQueryContainer(), |
||
| 366 | $this->createAdapterFactory()->createTransactionParser(), |
||
| 367 | $this->createOrderReader(), |
||
| 368 | $this->createAesEncrypter() |
||
| 369 | ); |
||
| 370 | } |
||
| 371 | |||
| 372 | /** |
||
| 373 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\PaymentOptionsCalculatorInterface |
||
| 374 | */ |
||
| 375 | public function createPaymentOptionsCalculator(): PaymentOptionsCalculatorInterface |
||
| 376 | { |
||
| 377 | return new PaymentOptionsCalculator($this->getCreditCardPaymentOptionsArray()); |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\DirectDebitPaymentOptionsCalculatorInterface |
||
| 382 | */ |
||
| 383 | public function createDirectDebitPaymentOptionsCalculator(): DirectDebitPaymentOptionsCalculatorInterface |
||
| 384 | { |
||
| 385 | return new DirectDebitPaymentOptionsCalculator($this->getDirectDebitPaymentOptionsArray()); |
||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\Registration\RegistrationReaderInterface |
||
| 390 | */ |
||
| 391 | public function createCreditCardRegistrationReader(): RegistrationReaderInterface |
||
| 392 | { |
||
| 393 | return new RegistrationReader($this->getQueryContainer()); |
||
| 394 | } |
||
| 395 | |||
| 396 | /** |
||
| 397 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\Registration\RegistrationSaverInterface |
||
| 398 | */ |
||
| 399 | public function createCreditCardRegistrationSaver(): RegistrationSaverInterface |
||
| 400 | { |
||
| 401 | return new RegistrationSaver($this->getQueryContainer()); |
||
| 402 | } |
||
| 403 | |||
| 404 | /** |
||
| 405 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\PaymentOption\PaymentOptionInterface[] |
||
| 406 | */ |
||
| 407 | public function getCreditCardPaymentOptionsArray(): array |
||
| 408 | { |
||
| 409 | return [ |
||
| 410 | $this->createLastSuccessfulRegistrationOption(), |
||
| 411 | $this->createNewRegistrationIframeOption(), |
||
| 412 | ]; |
||
| 413 | } |
||
| 414 | |||
| 415 | /** |
||
| 416 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\PaymentOption\PaymentOptionInterface |
||
| 417 | */ |
||
| 418 | public function createLastSuccessfulRegistrationOption(): PaymentOptionInterface |
||
| 419 | { |
||
| 420 | return new LastSuccessfulRegistration($this->createCreditCardRegistrationReader()); |
||
| 421 | } |
||
| 422 | |||
| 423 | /** |
||
| 424 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\PaymentOption\PaymentOptionInterface |
||
| 425 | */ |
||
| 426 | public function createNewRegistrationIframeOption(): PaymentOptionInterface |
||
| 427 | { |
||
| 428 | return new NewRegistrationIframe( |
||
| 429 | $this->createAdapterRequestFromQuoteBuilder(), |
||
| 430 | $this->getCreditCardPaymentMethodAdapter() |
||
| 431 | ); |
||
| 432 | } |
||
| 433 | |||
| 434 | /** |
||
| 435 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\Registration\DirectDebitRegistrationWriterInterface |
||
| 436 | */ |
||
| 437 | public function createDirectDebitRegistrationWriter(): DirectDebitRegistrationWriterInterface |
||
| 438 | { |
||
| 439 | return new DirectDebitRegistrationWriter( |
||
| 440 | $this->getEntityManager(), |
||
| 441 | $this->getRepository() |
||
| 442 | ); |
||
| 443 | } |
||
| 444 | |||
| 445 | /** |
||
| 446 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\Registration\DirectDebitRegistrationReaderInterface |
||
| 447 | */ |
||
| 448 | public function createDirectDebitRegistrationReader(): DirectDebitRegistrationReaderInterface |
||
| 449 | { |
||
| 450 | return new DirectDebitRegistrationReader($this->getRepository()); |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\PaymentOption\DirectDebitPaymentOptionInterface[] |
||
| 455 | */ |
||
| 456 | public function getDirectDebitPaymentOptionsArray(): array |
||
| 457 | { |
||
| 458 | return [ |
||
| 459 | $this->createDirectDebitNewRegistrationOption(), |
||
| 460 | $this->createDirectDebitLastSuccessfulRegistrationOption(), |
||
| 461 | ]; |
||
| 462 | } |
||
| 463 | |||
| 464 | /** |
||
| 465 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\PaymentOption\DirectDebitPaymentOptionInterface |
||
| 466 | */ |
||
| 467 | public function createDirectDebitLastSuccessfulRegistrationOption(): DirectDebitPaymentOptionInterface |
||
| 468 | { |
||
| 469 | return new DirectDebitLastSuccessfulRegistration($this->createDirectDebitRegistrationReader()); |
||
| 470 | } |
||
| 471 | |||
| 472 | /** |
||
| 473 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\DirectDebit\PaymentOption\DirectDebitPaymentOptionInterface |
||
| 474 | */ |
||
| 475 | public function createDirectDebitNewRegistrationOption(): DirectDebitPaymentOptionInterface |
||
| 476 | { |
||
| 477 | return new DirectDebitNewRegistration( |
||
| 478 | $this->createAdapterRequestFromQuoteBuilder(), |
||
| 479 | $this->getDirectDebitPaymentMethod() |
||
| 480 | ); |
||
| 481 | } |
||
| 482 | |||
| 483 | /** |
||
| 484 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\ExternalPaymentResponseBuilderInterface |
||
| 485 | */ |
||
| 486 | public function createExternalPaymentResponseBuilder(): ExternalPaymentResponseBuilderInterface |
||
| 487 | { |
||
| 488 | return new ExternalPaymentResponseBuilder($this->createPaymentReader()); |
||
| 489 | } |
||
| 490 | |||
| 491 | /** |
||
| 492 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\ExternalEasyCreditPaymentResponseBuilderInterface |
||
| 493 | */ |
||
| 494 | public function createExternalEasyCreditPaymentResponseBuilder(): ExternalEasyCreditPaymentResponseBuilderInterface |
||
| 495 | { |
||
| 496 | return new ExternalEasyCreditPaymentResponseBuilder($this->createPaymentReader()); |
||
| 497 | } |
||
| 498 | |||
| 499 | /** |
||
| 500 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithAuthorizeInterface[] |
||
| 501 | */ |
||
| 502 | public function getAuthorizePaymentMethodAdapterCollection(): array |
||
| 503 | { |
||
| 504 | return $this->createAdapterFactory() |
||
|
|
|||
| 505 | ->getAuthorizePaymentMethodAdapterCollection(); |
||
| 506 | } |
||
| 507 | |||
| 508 | /** |
||
| 509 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithAuthorizeOnRegistrationInterface[] |
||
| 510 | */ |
||
| 511 | public function getAuthorizeOnRegistrationPaymentMethodAdapterCollection(): array |
||
| 512 | { |
||
| 513 | return $this->createAdapterFactory() |
||
| 514 | ->getAuthorizeOnRegistrationPaymentMethodAdapterCollection(); |
||
| 515 | } |
||
| 516 | |||
| 517 | /** |
||
| 518 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithCaptureInterface[] |
||
| 519 | */ |
||
| 520 | public function getCapturePaymentMethodAdapterCollection(): array |
||
| 521 | { |
||
| 522 | return $this->createAdapterFactory() |
||
| 523 | ->getCapturePaymentMethodAdapterCollection(); |
||
| 524 | } |
||
| 525 | |||
| 526 | /** |
||
| 527 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithInitializeInterface[] |
||
| 528 | */ |
||
| 529 | public function getInitializePaymentMethodAdapterCollection(): array |
||
| 530 | { |
||
| 531 | return $this->createAdapterFactory() |
||
| 532 | ->getInitializePaymentMethodAdapterCollection(); |
||
| 533 | } |
||
| 534 | |||
| 535 | /** |
||
| 536 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithDebitInterface[] |
||
| 537 | */ |
||
| 538 | public function getDebitPaymentMethodAdapterCollection(): array |
||
| 539 | { |
||
| 540 | return $this->createAdapterFactory() |
||
| 541 | ->getDebitPaymentMethodAdapterCollection(); |
||
| 542 | } |
||
| 543 | |||
| 544 | /** |
||
| 545 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithDebitOnRegistrationInterface[] |
||
| 546 | */ |
||
| 547 | public function getDebitOnRegistrationPaymentMethodAdapterCollection(): array |
||
| 548 | { |
||
| 549 | return $this->createAdapterFactory() |
||
| 550 | ->getDebitOnRegistrationPaymentMethodAdapterCollection(); |
||
| 551 | } |
||
| 552 | |||
| 553 | /** |
||
| 554 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithFinalizeInterface[] |
||
| 555 | */ |
||
| 556 | public function getFinalizePaymentMethodAdapterCollection(): array |
||
| 557 | { |
||
| 558 | return $this->createAdapterFactory() |
||
| 559 | ->getFinalizePaymentMethodAdapterCollection(); |
||
| 560 | } |
||
| 561 | |||
| 562 | /** |
||
| 563 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithReservationInterface[] |
||
| 564 | */ |
||
| 565 | public function getReservationPaymentMethodAdapterCollection(): array |
||
| 566 | { |
||
| 567 | return $this->createAdapterFactory() |
||
| 568 | ->getReservationPaymentMethodAdapterCollection(); |
||
| 569 | } |
||
| 570 | |||
| 571 | /** |
||
| 572 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithRefundInterface[] |
||
| 573 | */ |
||
| 574 | public function getRefundPaymentMethodAdapterCollection(): array |
||
| 575 | { |
||
| 576 | return $this->createAdapterFactory() |
||
| 577 | ->getRefundPaymentMethodAdapterCollection(); |
||
| 578 | } |
||
| 579 | |||
| 580 | /** |
||
| 581 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithExternalResponseInterface[] |
||
| 582 | */ |
||
| 583 | public function getExternalResponsePaymentMethodAdapterCollection(): array |
||
| 584 | { |
||
| 585 | return $this->createAdapterFactory() |
||
| 586 | ->getExternalResponsePaymentMethodAdapterCollection(); |
||
| 587 | } |
||
| 588 | |||
| 589 | /** |
||
| 590 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\AdapterRequestFromOrderBuilderInterface |
||
| 591 | */ |
||
| 592 | public function createAdapterRequestFromOrderBuilder(): AdapterRequestFromOrderBuilderInterface |
||
| 593 | { |
||
| 594 | return new AdapterRequestFromOrderBuilder( |
||
| 595 | $this->createOrderToHeidelpayRequestMapper(), |
||
| 596 | $this->getCurrencyFacade(), |
||
| 597 | $this->getConfig(), |
||
| 598 | $this->createPaymentReader() |
||
| 599 | ); |
||
| 600 | } |
||
| 601 | |||
| 602 | /** |
||
| 603 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\AdapterRequestFromOrderBuilderInterface |
||
| 604 | */ |
||
| 605 | public function createEasyCreditAdapterRequestFromOrderBuilder(): AdapterRequestFromOrderBuilderInterface |
||
| 606 | { |
||
| 607 | return new EasyCreditAdapterRequestFromOrderBuilder( |
||
| 608 | $this->createOrderToHeidelpayRequestMapper(), |
||
| 609 | $this->getCurrencyFacade(), |
||
| 610 | $this->getConfig(), |
||
| 611 | $this->createPaymentReader() |
||
| 612 | ); |
||
| 613 | } |
||
| 614 | |||
| 615 | /** |
||
| 616 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\AdapterRequestFromQuoteBuilderInterface |
||
| 617 | */ |
||
| 618 | public function createAdapterRequestFromQuoteBuilder(): AdapterRequestFromQuoteBuilderInterface |
||
| 619 | { |
||
| 620 | return new AdapterRequestFromQuoteBuilder( |
||
| 621 | $this->createQuoteToHeidelpayRequestMapper(), |
||
| 622 | $this->getCurrencyFacade(), |
||
| 623 | $this->getConfig() |
||
| 624 | ); |
||
| 625 | } |
||
| 626 | |||
| 627 | /** |
||
| 628 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Request\AdapterRequestFromQuoteBuilderInterface |
||
| 629 | */ |
||
| 630 | public function createEasyCreditAdapterRequestFromQuoteBuilder(): AdapterRequestFromQuoteBuilderInterface |
||
| 631 | { |
||
| 632 | return new EasyCreditAdapterRequestFromQuoteBuilder( |
||
| 633 | $this->createQuoteToHeidelpayRequestMapper(), |
||
| 634 | $this->getCurrencyFacade(), |
||
| 635 | $this->getConfig(), |
||
| 636 | $this->getSalesFacade() |
||
| 637 | ); |
||
| 638 | } |
||
| 639 | |||
| 640 | /** |
||
| 641 | * @return \SprykerEco\Zed\Heidelpay\Business\Mapper\OrderToHeidelpayRequestInterface |
||
| 642 | */ |
||
| 643 | public function createOrderToHeidelpayRequestMapper(): OrderToHeidelpayRequestInterface |
||
| 644 | { |
||
| 645 | return new OrderToHeidelpayRequest($this->getMoneyFacade()); |
||
| 646 | } |
||
| 647 | |||
| 648 | /** |
||
| 649 | * @return \SprykerEco\Zed\Heidelpay\Business\Mapper\QuoteToHeidelpayRequestInterface |
||
| 650 | */ |
||
| 651 | public function createQuoteToHeidelpayRequestMapper(): QuoteToHeidelpayRequestInterface |
||
| 652 | { |
||
| 653 | return new QuoteToHeidelpayRequest($this->getMoneyFacade()); |
||
| 654 | } |
||
| 655 | |||
| 656 | /** |
||
| 657 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\AuthorizeTransactionInterface |
||
| 658 | */ |
||
| 659 | public function createAuthorizeTransaction(): AuthorizeTransactionInterface |
||
| 660 | { |
||
| 661 | return new AuthorizeTransaction($this->createTransactionLogger()); |
||
| 662 | } |
||
| 663 | |||
| 664 | /** |
||
| 665 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\AuthorizeOnRegistrationTransactionInterface |
||
| 666 | */ |
||
| 667 | public function createAuthorizeOnRegistrationTransaction(): AuthorizeOnRegistrationTransactionInterface |
||
| 668 | { |
||
| 669 | return new AuthorizeOnRegistrationTransaction($this->createTransactionLogger()); |
||
| 670 | } |
||
| 671 | |||
| 672 | /** |
||
| 673 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\InitializeTransactionInterface |
||
| 674 | */ |
||
| 675 | public function createInitializeTransaction(): InitializeTransactionInterface |
||
| 676 | { |
||
| 677 | return new InitializeTransaction(); |
||
| 678 | } |
||
| 679 | |||
| 680 | /** |
||
| 681 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\DebitTransactionInterface |
||
| 682 | */ |
||
| 683 | public function createDebitTransaction(): DebitTransactionInterface |
||
| 684 | { |
||
| 685 | return new DebitTransaction($this->createTransactionLogger()); |
||
| 686 | } |
||
| 687 | |||
| 688 | /** |
||
| 689 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\DebitOnRegistrationTransactionInterface |
||
| 690 | */ |
||
| 691 | public function createDebitOnRegistrationTransaction(): DebitOnRegistrationTransactionInterface |
||
| 692 | { |
||
| 693 | return new DebitOnRegistrationTransaction($this->createTransactionLogger()); |
||
| 694 | } |
||
| 695 | |||
| 696 | /** |
||
| 697 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\FinalizeTransactionInterface |
||
| 698 | */ |
||
| 699 | public function createFinalizeTransaction(): FinalizeTransactionInterface |
||
| 700 | { |
||
| 701 | return new FinalizeTransaction($this->createTransactionLogger()); |
||
| 702 | } |
||
| 703 | |||
| 704 | /** |
||
| 705 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\ReservationTransactionInterface |
||
| 706 | */ |
||
| 707 | public function createReservationTransaction(): ReservationTransactionInterface |
||
| 708 | { |
||
| 709 | return new ReservationTransaction($this->createTransactionLogger()); |
||
| 710 | } |
||
| 711 | |||
| 712 | /** |
||
| 713 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\RefundTransactionInterface |
||
| 714 | */ |
||
| 715 | public function createRefundTransaction(): RefundTransactionInterface |
||
| 716 | { |
||
| 717 | return new RefundTransaction($this->createTransactionLogger()); |
||
| 718 | } |
||
| 719 | |||
| 720 | /** |
||
| 721 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\CaptureTransactionInterface |
||
| 722 | */ |
||
| 723 | public function createCaptureTransaction(): CaptureTransactionInterface |
||
| 724 | { |
||
| 725 | return new CaptureTransaction($this->createTransactionLogger()); |
||
| 726 | } |
||
| 727 | |||
| 728 | /** |
||
| 729 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface[] |
||
| 730 | */ |
||
| 731 | public function getPaymentMethodWithPostSaveOrderCollection(): array |
||
| 732 | { |
||
| 733 | return [ |
||
| 734 | HeidelpayConfig::PAYMENT_METHOD_SOFORT => $this->createPaymentMethodSofort(), |
||
| 735 | HeidelpayConfig::PAYMENT_METHOD_PAYPAL_AUTHORIZE => $this->createPaymentMethodPaypalAuthorize(), |
||
| 736 | HeidelpayConfig::PAYMENT_METHOD_PAYPAL_DEBIT => $this->createPaymentMethodPaypalDebit(), |
||
| 737 | HeidelpayConfig::PAYMENT_METHOD_IDEAL => $this->createPaymentMethodIdeal(), |
||
| 738 | HeidelpayConfig::PAYMENT_METHOD_CREDIT_CARD_SECURE => $this->createPaymentMethodCreditCardSecure(), |
||
| 739 | HeidelpayConfig::PAYMENT_METHOD_INVOICE_SECURED_B2C => $this->createInvoiceSecuredB2c(), |
||
| 740 | HeidelpayConfig::PAYMENT_METHOD_DIRECT_DEBIT => $this->createDirectDebit(), |
||
| 741 | ]; |
||
| 742 | } |
||
| 743 | |||
| 744 | /** |
||
| 745 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPreSavePaymentInterface[] |
||
| 746 | */ |
||
| 747 | public function getPaymentMethodWithPreSavePaymentCollection(): array |
||
| 753 | ]; |
||
| 754 | } |
||
| 755 | |||
| 756 | /** |
||
| 757 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 758 | */ |
||
| 759 | public function createPaymentMethodSofort(): PaymentWithPostSaveOrderInterface |
||
| 760 | { |
||
| 761 | return new Sofort( |
||
| 762 | $this->createTransactionLogReader(), |
||
| 763 | $this->getConfig() |
||
| 764 | ); |
||
| 765 | } |
||
| 766 | |||
| 767 | /** |
||
| 768 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 769 | */ |
||
| 770 | public function createPaymentMethodPaypalAuthorize(): PaymentWithPostSaveOrderInterface |
||
| 771 | { |
||
| 772 | return new PaypalAuthorize( |
||
| 773 | $this->createTransactionLogReader(), |
||
| 774 | $this->getConfig() |
||
| 775 | ); |
||
| 776 | } |
||
| 777 | |||
| 778 | /** |
||
| 779 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 780 | */ |
||
| 781 | public function createPaymentMethodPaypalDebit(): PaymentWithPostSaveOrderInterface |
||
| 786 | ); |
||
| 787 | } |
||
| 788 | |||
| 789 | /** |
||
| 790 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPreSavePaymentInterface |
||
| 791 | */ |
||
| 792 | public function createPaymentMethodEasyCredit(): PaymentWithPreSavePaymentInterface |
||
| 793 | { |
||
| 794 | return new EasyCredit( |
||
| 795 | $this->createTransactionLogReader(), |
||
| 796 | $this->getConfig() |
||
| 797 | ); |
||
| 798 | } |
||
| 799 | |||
| 800 | /** |
||
| 801 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 802 | */ |
||
| 803 | public function createPaymentMethodIdeal(): PaymentWithPostSaveOrderInterface |
||
| 808 | ); |
||
| 809 | } |
||
| 810 | |||
| 811 | /** |
||
| 812 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 813 | */ |
||
| 814 | public function createPaymentMethodCreditCardSecure(): PaymentWithPostSaveOrderInterface |
||
| 815 | { |
||
| 816 | return new CreditCardSecure( |
||
| 817 | $this->createTransactionLogReader(), |
||
| 818 | $this->getConfig(), |
||
| 819 | $this->createCreditCardRegistrationWriter() |
||
| 820 | ); |
||
| 821 | } |
||
| 822 | |||
| 823 | /** |
||
| 824 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 825 | */ |
||
| 826 | public function createInvoiceSecuredB2c(): PaymentWithPostSaveOrderInterface |
||
| 827 | { |
||
| 828 | return new InvoiceSecuredB2c( |
||
| 829 | $this->createTransactionLogReader(), |
||
| 830 | $this->getConfig() |
||
| 831 | ); |
||
| 832 | } |
||
| 833 | |||
| 834 | /** |
||
| 835 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Type\PaymentWithPostSaveOrderInterface |
||
| 836 | */ |
||
| 837 | public function createDirectDebit(): PaymentWithPostSaveOrderInterface |
||
| 838 | { |
||
| 839 | return new DirectDebit( |
||
| 840 | $this->createTransactionLogReader(), |
||
| 841 | $this->getConfig(), |
||
| 842 | $this->createDirectDebitRegistrationWriter() |
||
| 843 | ); |
||
| 844 | } |
||
| 845 | |||
| 846 | /** |
||
| 847 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\CreditCard\Registration\RegistrationWriterInterface |
||
| 848 | */ |
||
| 849 | public function createCreditCardRegistrationWriter(): RegistrationWriterInterface |
||
| 852 | } |
||
| 853 | |||
| 854 | /** |
||
| 855 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\ExternalResponseTransactionInterface |
||
| 856 | */ |
||
| 857 | public function createExternalResponseTransaction(): ExternalResponseTransactionInterface |
||
| 858 | { |
||
| 859 | return new ExternalResponseTransaction($this->createTransactionLogger()); |
||
| 860 | } |
||
| 861 | |||
| 862 | /** |
||
| 863 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\Transaction\ExternalResponseTransactionInterface |
||
| 864 | */ |
||
| 865 | public function createEasyCreditInitializeExternalResponseTransaction(): ExternalResponseTransactionInterface |
||
| 866 | { |
||
| 867 | return new EasyCreditInitializeExternalResponseTransaction(); |
||
| 868 | } |
||
| 869 | |||
| 870 | /** |
||
| 871 | * @return \SprykerEco\Zed\Heidelpay\Business\Encrypter\EncrypterInterface |
||
| 872 | */ |
||
| 873 | public function createAesEncrypter(): EncrypterInterface |
||
| 874 | { |
||
| 875 | return new AesEncrypter($this->getConfig()); |
||
| 876 | } |
||
| 877 | |||
| 878 | /** |
||
| 879 | * @return \SprykerEco\Zed\Heidelpay\Business\Adapter\Payment\CreditCardPaymentInterface |
||
| 880 | */ |
||
| 881 | public function getCreditCardPaymentMethodAdapter(): CreditCardPaymentInterface |
||
| 882 | { |
||
| 883 | return $this->createAdapterFactory() |
||
| 884 | ->createCreditCardPaymentMethodAdapter(); |
||
| 885 | } |
||
| 886 | |||
| 887 | /** |
||
| 888 | * @return \SprykerEco\Zed\Heidelpay\Business\Adapter\Payment\DirectDebitPaymentInterface |
||
| 889 | */ |
||
| 890 | public function getDirectDebitPaymentMethod(): DirectDebitPaymentInterface |
||
| 891 | { |
||
| 892 | return $this->createAdapterFactory() |
||
| 893 | ->createDirectDebitPaymentMethod(); |
||
| 894 | } |
||
| 895 | |||
| 896 | /** |
||
| 897 | * @return \SprykerEco\Zed\Heidelpay\Business\Basket\BasketCreatorInterface |
||
| 898 | */ |
||
| 899 | public function createBasketCreator(): BasketCreatorInterface |
||
| 900 | { |
||
| 901 | return new BasketCreator( |
||
| 902 | $this->createAdapterFactory()->createBasketAdapter() |
||
| 903 | ); |
||
| 904 | } |
||
| 905 | |||
| 906 | /** |
||
| 907 | * @return \SprykerEco\Zed\Heidelpay\Business\Payment\PaymentMethodFilterInterface |
||
| 908 | */ |
||
| 909 | public function createPaymentMethodFilter(): PaymentMethodFilterInterface |
||
| 910 | { |
||
| 911 | return new PaymentMethodFilter( |
||
| 912 | $this->getConfig(), |
||
| 913 | $this->getMoneyFacade() |
||
| 914 | ); |
||
| 915 | } |
||
| 916 | |||
| 917 | /** |
||
| 918 | * @return \SprykerEco\Zed\Heidelpay\Business\Processor\Notification\HeidelpayNotificationProcessorInterface |
||
| 919 | */ |
||
| 920 | public function createHeidelpayNotificationProcessor(): HeidelpayNotificationProcessorInterface |
||
| 921 | { |
||
| 922 | return new HeidelpayNotificationProcessor( |
||
| 923 | $this->createNotificationExpander(), |
||
| 924 | $this->createHeidelpayWriter() |
||
| 925 | ); |
||
| 926 | } |
||
| 927 | |||
| 928 | /** |
||
| 929 | * @return \SprykerEco\Zed\Heidelpay\Business\Processor\Notification\Expander\NotificationExpanderInterface |
||
| 930 | */ |
||
| 931 | public function createNotificationExpander(): NotificationExpanderInterface |
||
| 932 | { |
||
| 933 | return new NotificationExpander( |
||
| 934 | $this->createNotificationXmlConverter(), |
||
| 935 | $this->getUtilEncodingService(), |
||
| 936 | $this->getMoneyPlugin(), |
||
| 937 | $this->getHeidelpayNotificationExpanderPlugins() |
||
| 938 | ); |
||
| 939 | } |
||
| 940 | |||
| 941 | /** |
||
| 942 | * @return \SprykerEco\Zed\Heidelpay\Business\Processor\Notification\Converter\NotificationXmlConverterInterface |
||
| 943 | */ |
||
| 944 | public function createNotificationXmlConverter(): NotificationXmlConverterInterface |
||
| 945 | { |
||
| 946 | return new NotificationXmlConverter(); |
||
| 947 | } |
||
| 948 | |||
| 949 | /** |
||
| 950 | * @return \SprykerEco\Zed\Heidelpay\Business\Writer\HeidelpayWriterInterface |
||
| 951 | */ |
||
| 952 | public function createHeidelpayWriter(): HeidelpayWriterInterface |
||
| 953 | { |
||
| 954 | return new HeidelpayWriter($this->getEntityManager()); |
||
| 955 | } |
||
| 956 | |||
| 957 | /** |
||
| 958 | * @return \SprykerEco\Zed\Heidelpay\Dependency\Facade\HeidelpayToSalesFacadeInterface |
||
| 959 | */ |
||
| 960 | public function getSalesFacade(): HeidelpayToSalesFacadeInterface |
||
| 961 | { |
||
| 962 | return $this->getProvidedDependency(HeidelpayDependencyProvider::FACADE_SALES); |
||
| 963 | } |
||
| 964 | |||
| 965 | /** |
||
| 966 | * @return \SprykerEco\Zed\Heidelpay\Dependency\Facade\HeidelpayToCurrencyFacadeInterface |
||
| 967 | */ |
||
| 968 | public function getCurrencyFacade(): HeidelpayToCurrencyFacadeInterface |
||
| 971 | } |
||
| 972 | |||
| 973 | /** |
||
| 974 | * @return \SprykerEco\Zed\Heidelpay\Dependency\QueryContainer\HeidelpayToSalesQueryContainerInterface |
||
| 975 | */ |
||
| 976 | public function getSalesQueryContainer(): HeidelpayToSalesQueryContainerInterface |
||
| 977 | { |
||
| 978 | return $this->getProvidedDependency(HeidelpayDependencyProvider::QUERY_CONTAINER_SALES); |
||
| 979 | } |
||
| 980 | |||
| 981 | /** |
||
| 982 | * @return \SprykerEco\Zed\Heidelpay\Dependency\Facade\HeidelpayToMoneyFacadeInterface |
||
| 983 | */ |
||
| 984 | public function getMoneyFacade(): HeidelpayToMoneyFacadeInterface |
||
| 985 | { |
||
| 986 | return $this->getProvidedDependency(HeidelpayDependencyProvider::FACADE_MONEY); |
||
| 987 | } |
||
| 988 | |||
| 989 | /** |
||
| 990 | * @return \Spryker\Shared\Money\Dependency\Plugin\MoneyPluginInterface |
||
| 991 | */ |
||
| 992 | public function getMoneyPlugin(): MoneyPluginInterface |
||
| 995 | } |
||
| 996 | |||
| 997 | /** |
||
| 998 | * @return \SprykerEco\Zed\Heidelpay\Dependency\Service\HeidelpayToUtilEncodingServiceInterface |
||
| 999 | */ |
||
| 1000 | public function getUtilEncodingService(): HeidelpayToUtilEncodingServiceInterface |
||
| 1001 | { |
||
| 1002 | return $this->getProvidedDependency(HeidelpayDependencyProvider::SERVICE_UTIL_ENCODING); |
||
| 1003 | } |
||
| 1004 | |||
| 1005 | /** |
||
| 1006 | * @return \SprykerEco\Zed\Heidelpay\Dependency\Plugin\HeidelpayNotificationExpanderPluginInterface[] |
||
| 1007 | */ |
||
| 1008 | public function getHeidelpayNotificationExpanderPlugins(): array |
||
| 1009 | { |
||
| 1010 | return $this->getProvidedDependency(HeidelpayDependencyProvider::PLUGINS_HEIDELPAY_NOTIFICATION_EXPANDER); |
||
| 1011 | } |
||
| 1012 | |||
| 1013 | /** |
||
| 1014 | * @return \SprykerEco\Zed\Heidelpay\Business\Checker\CaptureTransactionCheckerInterface |
||
| 1015 | */ |
||
| 1016 | public function createCaptureTransactionChecker(): CaptureTransactionCheckerInterface |
||
| 1017 | { |
||
| 1018 | return new CaptureTransactionChecker($this->getQueryContainer()); |
||
| 1019 | } |
||
| 1020 | } |
||
| 1021 |