You are here

public function WorldPayHelper::addShipmentAddress 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::addShipmentAddress()

Parameters

array $addressData:

Throws

\Drupal\Core\TypedData\Exception\MissingDataException

File

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

Class

WorldPayHelper
Class WorldPayHelper Helper class for collecting form data.

Namespace

Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway

Code

public function addShipmentAddress(array $addressData) {
  if (NULL === $addressData) {
    throw new MissingDataException('There is no address data provided!');
  }
  $this->data += [
    'name' => $addressData['DeliveryFirstname'] . ' ' . $addressData['DeliverySurname'],
    'address' => $addressData['DeliveryAddress1'],
    'postcode' => $addressData['DeliveryPostCode'],
    'country' => $addressData['DeliveryCountry'],
    'countryString' => $addressData['DeliveryCountryString'],
  ];
}