private function getUserShippingData(int
$userId, array
$userData, string
$countryQuery): array
{ $entityManager =
Shopware()->
Container()->
get(ModelManager::
class);
$customer =
$entityManager->
find(Customer::
class,
$userId);
if (!
$customer instanceof Customer
) { throw new \
InvalidArgumentException('User with provided id not found'
);
} $shipping =
$this->
getShippingAddressData($entityManager,
$customer);
if ($shipping === null
) { throw new \
UnexpectedValueException('No shipping address found for user with provided userId'
);
} $userData['shippingaddress'
] =
$shipping;
if (!
isset($userData['shippingaddress'
]['firstname'
])) { $userData['shippingaddress'
] =
$userData['billingaddress'
];
$userData['shippingaddress'
]['eqalBilling'
] = true;
}