/**
* @phpstan-ignore-next-line setter name is misleading, but kept for BC
*/
#[Route(path: '/store-api/order/payment', name: 'store-api.order.set-payment', methods: ['POST'], defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true])]
public function setPayment(Request
$request, SalesChannelContext
$context): SetPaymentOrderRouteResponse
{ $paymentMethodId =
(string) $request->request->
get('paymentMethodId'
);
$orderId =
(string) $request->request->
get('orderId'
);
$order =
$this->
loadOrder($orderId,
$context);
$context =
$this->orderConverter->
assembleSalesChannelContext( $order,
$context->
getContext(),
[SalesChannelContextService::PAYMENT_METHOD_ID =>
$paymentMethodId] );
$this->
validateRequest($context,
$paymentMethodId);
$this->
validatePaymentState($order);
$this->
setPaymentMethod($paymentMethodId,
$order,
$context);