SolutionDataBuilder.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. declare(strict_types=1);
  7. namespace Magento\AuthorizenetAcceptjs\Gateway\Request;
  8. use Magento\AuthorizenetAcceptjs\Gateway\Config;
  9. use Magento\AuthorizenetAcceptjs\Gateway\SubjectReader;
  10. use Magento\Payment\Gateway\Request\BuilderInterface;
  11. /**
  12. * Adds the appropriate solution ID to the request
  13. */
  14. class SolutionDataBuilder implements BuilderInterface
  15. {
  16. /**
  17. * @var Config
  18. */
  19. private $config;
  20. /**
  21. * @var SubjectReader
  22. */
  23. private $subjectReader;
  24. /**
  25. * @param SubjectReader $subjectReader
  26. * @param Config $config
  27. */
  28. public function __construct(SubjectReader $subjectReader, Config $config)
  29. {
  30. $this->config = $config;
  31. $this->subjectReader = $subjectReader;
  32. }
  33. /**
  34. * @inheritdoc
  35. */
  36. public function build(array $buildSubject): array
  37. {
  38. return [
  39. 'transactionRequest' => [
  40. 'solution' => [
  41. 'id' => $this->config->getSolutionId($this->subjectReader->readStoreId($buildSubject)),
  42. ]
  43. ]
  44. ];
  45. }
  46. }