Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MerchantAccountDataBuilder.php
Go to the documentation of this file.
1 <?php
6 declare(strict_types=1);
7 
9 
13 
18 {
24  private static $merchantAccountId = 'merchantAccountId';
25 
29  private $config;
30 
34  private $subjectReader;
35 
42  public function __construct(Config $config, SubjectReader $subjectReader)
43  {
44  $this->config = $config;
45  $this->subjectReader = $subjectReader;
46  }
47 
51  public function build(array $buildSubject): array
52  {
53  $paymentDO = $this->subjectReader->readPayment($buildSubject);
54  $order = $paymentDO->getOrder();
55 
56  $result = [];
57  $merchantAccountId = $this->config->getMerchantAccountId($order->getStoreId());
58  if (!empty($merchantAccountId)) {
59  $result[self::$merchantAccountId] = $merchantAccountId;
60  }
61 
62  return $result;
63  }
64 }
$config
Definition: fraud_order.php:17
$order
Definition: order.php:55