You are here

public function WorldPayHelper::addAddress in Commerce Worldpay 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Commerce/PaymentGateway/WorldPayHelper.php \Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway\WorldPayHelper::addAddress()

Parameters

array $addressData:

Throws

\Drupal\Core\TypedData\Exception\MissingDataException

File

src/Plugin/Commerce/PaymentGateway/WorldPayHelper.php, line 68

Class

WorldPayHelper
Class WorldPayHelper Helper class for collecting form data.

Namespace

Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway

Code

public function addAddress(array $addressData) {
  if (NULL === $addressData) {
    throw new MissingDataException('There is no address data provided!');
  }
  $this->data += [
    'name' => $addressData['first_name'] . ' ' . $addressData['surname'],
    'address' => $addressData['address1'],
    'postcode' => $addressData['postCode'],
    'country' => $addressData['countryCode'],
    'countryString' => $addressData['country'],
    'email' => $addressData['email'],
  ];
}