$this->
validateRegistrationData($data,
$isGuest,
$context,
$additionalValidationDefinitions,
$validateStorefrontUrl);
$customer =
$this->
mapCustomerData($data,
$isGuest,
$context);
/** @var DataBag $billing */
$billing =
$data->
get('billingAddress'
);
if ($data->
has('title'
)) { $billing->
set('title',
$data->
get('title'
));
} $billingAddress =
$this->
mapBillingAddress($billing,
$context->
getContext());
$billingAddress['id'
] = Uuid::
randomHex();
$billingAddress['customerId'
] =
$customer['id'
];
// if no shipping address is provided, use the billing address
$customer['defaultShippingAddressId'
] =
$billingAddress['id'
];
$customer['defaultBillingAddressId'
] =
$billingAddress['id'
];
$customer['addresses'
][] =
$billingAddress;
if ($shipping =
$data->
get('shippingAddress'
)) { $shippingAddress =
$this->
mapShippingAddress($shipping,
$context->
getContext());
$shippingAddress['id'
] = Uuid::
randomHex();