Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CustomerDataBuilder.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
19  const CUSTOMER = 'customer';
20 
24  const FIRST_NAME = 'firstName';
25 
29  const LAST_NAME = 'lastName';
30 
34  const COMPANY = 'company';
35 
39  const EMAIL = 'email';
40 
45  const PHONE = 'phone';
46 
50  private $subjectReader;
51 
57  public function __construct(SubjectReader $subjectReader)
58  {
59  $this->subjectReader = $subjectReader;
60  }
61 
65  public function build(array $buildSubject)
66  {
67  $paymentDO = $this->subjectReader->readPayment($buildSubject);
68 
69  $order = $paymentDO->getOrder();
70  $billingAddress = $order->getBillingAddress();
71 
72  return [
73  self::CUSTOMER => [
74  self::FIRST_NAME => $billingAddress->getFirstname(),
75  self::LAST_NAME => $billingAddress->getLastname(),
76  self::COMPANY => $billingAddress->getCompany(),
77  self::PHONE => $billingAddress->getTelephone(),
78  self::EMAIL => $billingAddress->getEmail(),
79  ]
80  ];
81  }
82 }
$billingAddress
Definition: order.php:25
$order
Definition: order.php:55