$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();
$shippingAddress['customerId'
] =
$customer['id'
];
$customer['defaultShippingAddressId'
] =
$shippingAddress['id'
];
$customer['addresses'
][] =
$shippingAddress;
} if ($data->
get('accountType'
)) { $customer['accountType'
] =
$data->
get('accountType'
);
}