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