19 private $customerRepository;
24 private $dateTimeFactory;
29 private $customerOrders;
42 $this->dateTimeFactory = $dateTimeFactory;
43 $this->customerOrders = $customerOrders;
67 'phone' =>
$order->getBillingAddress()->getTelephone(),
69 'createdDate' => $this->formatDate(
$customer->getCreatedAt()),
70 'lastUpdateDate' => $this->formatDate(
$customer->getUpdatedAt())
74 $ordersInfo = $this->customerOrders->getAggregatedOrdersInfo(
$customerId);
75 if (isset($ordersInfo[
'aggregateOrderCount'])) {
76 $result[
'userAccount'][
'aggregateOrderCount'] = $ordersInfo[
'aggregateOrderCount'];
78 if (isset($ordersInfo[
'aggregateOrderDollars'])) {
79 $result[
'userAccount'][
'aggregateOrderDollars'] = $ordersInfo[
'aggregateOrderDollars'];
91 private function formatDate($date)
93 $result = $this->dateTimeFactory->create(
95 new \DateTimeZone(
'UTC')
98 return $result->format(\DateTime::ATOM);
__construct(\Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, CustomerOrders $customerOrders, \Magento\Framework\Intl\DateTimeFactory $dateTimeFactory)