public function change(string
$paymentMethodId, RequestDataBag
$requestDataBag, SalesChannelContext
$context, CustomerEntity
$customer): SuccessResponse
{ $this->
validatePaymentMethodId($paymentMethodId,
$context->
getContext());
$this->customerRepository->
update([ [ 'id' =>
$customer->
getId(),
'defaultPaymentMethodId' =>
$paymentMethodId,
],
],
$context->
getContext());
$event =
new CustomerChangedPaymentMethodEvent($context,
$customer,
$requestDataBag);
$this->eventDispatcher->
dispatch($event);
return new SuccessResponse();
} /**
* @throws InvalidUuidException
*/
private function validatePaymentMethodId(string
$paymentMethodId, Context
$context): void
{ if (!Uuid::
isValid($paymentMethodId)) {