Exemplo n.º 1
0
 /**
  * Get addresses.
  *
  * @return array
  */
 protected function getAddresses()
 {
     $addresses = [];
     if ($this->customer->hasData('address')) {
         $addresses = $this->customer->getDataFieldConfig('address')['source']->getAddresses();
     }
     return array_merge($addresses, $this->addresses);
 }
 /**
  * Run delete customer address entity test.
  *
  * @param Customer $customer
  * @return array
  */
 public function test(Customer $customer)
 {
     // Preconditions:
     $customer->persist();
     $addressToDelete = $customer->getDataFieldConfig('address')['source']->getAddresses()[0];
     // Steps:
     $this->objectManager->create('Mage\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
     $this->customerAccountIndex->getAccountNavigationBlock()->openNavigationItem('Address Book');
     $this->customerAddress->getBookBlock()->getAdditionalAddressBlock()->deleteAddress($addressToDelete);
     return ['deletedAddress' => $addressToDelete];
 }
 /**
  * Get billing address for asserts.
  *
  * @param Customer $customer
  * @return null|Address
  */
 protected function getBillingAddress(Customer $customer)
 {
     return $customer->hasData('address') ? $customer->getDataFieldConfig('address')['source']->getAddresses()[0] : null;
 }
Exemplo n.º 4
0
 /**
  * Prepare order data.
  *
  * @param array $data
  * @return array
  */
 protected function prepareOrderData(array $data)
 {
     $customerGroupId = $this->customer->hasData('group_id') ? $this->customer->getDataFieldConfig('group_id')['source']->getCustomerGroup()->getCustomerGroupId() : 1;
     $result = ['name' => $this->customer->getFirstname(), 'order' => ['currency' => $data['order_currency_code'], 'account' => ['group_id' => $customerGroupId, 'email' => $this->customer->getEmail()], 'shipping_method' => $data['shipping_method']], 'item' => $this->prepareOrderProductsData($data['entity_id']), 'billing_address' => $this->prepareBillingAddress($data['billing_address_id']), 'shipping_same_as_billing' => 'on', 'payment' => $data['payment_auth_expiration']];
     return $result;
 }
 /**
  * Prepare condition replacement data.
  *
  * @param Customer $customer
  * @return array
  */
 protected function prepareReplacement(Customer $customer)
 {
     /** @var Address $address */
     $address = $customer->getDataFieldConfig('address')['source']->getAddresses()[0];
     return ['conditions' => ['%email%' => $customer->getEmail(), '%company%' => $address->getCompany(), '%address%' => $address->getStreet(), '%telephone%' => $address->getTelephone(), '%postcode%' => $address->getPostcode(), '%province%' => $address->getRegionId(), '%city%' => $address->getCity()]];
 }