subjectReader = $subjectReader; } /** * @inheritdoc */ public function build(array $buildSubject) { $paymentDO = $this->subjectReader->readPayment($buildSubject); $order = $paymentDO->getOrder(); $result = []; $billingAddress = $order->getBillingAddress(); if ($billingAddress) { $result[self::BILLING_ADDRESS] = [ self::FIRST_NAME => $billingAddress->getFirstname(), self::LAST_NAME => $billingAddress->getLastname(), self::COMPANY => $billingAddress->getCompany(), self::STREET_ADDRESS => $billingAddress->getStreetLine1(), self::EXTENDED_ADDRESS => $billingAddress->getStreetLine2(), self::LOCALITY => $billingAddress->getCity(), self::REGION => $billingAddress->getRegionCode(), self::POSTAL_CODE => $billingAddress->getPostcode(), self::COUNTRY_CODE => $billingAddress->getCountryId() ]; } $shippingAddress = $order->getShippingAddress(); if ($shippingAddress) { $result[self::SHIPPING_ADDRESS] = [ self::FIRST_NAME => $shippingAddress->getFirstname(), self::LAST_NAME => $shippingAddress->getLastname(), self::COMPANY => $shippingAddress->getCompany(), self::STREET_ADDRESS => $shippingAddress->getStreetLine1(), self::EXTENDED_ADDRESS => $shippingAddress->getStreetLine2(), self::LOCALITY => $shippingAddress->getCity(), self::REGION => $shippingAddress->getRegionCode(), self::POSTAL_CODE => $shippingAddress->getPostcode(), self::COUNTRY_CODE => $shippingAddress->getCountryId() ]; } return $result; } }