Skip to content

Commit

Permalink
[shopsys] logged user is not allowed to change their email in cart (#…
Browse files Browse the repository at this point in the history
…3468)
  • Loading branch information
vitek-rostislav authored Oct 16, 2024
2 parents 1369c34 + c5b8c91 commit 648d7bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ public function handle(
OrderProcessingStack $orderProcessingStack,
): OrderProcessingData {
$orderData = $orderProcessingData->orderData;
$orderData->customerUser = $orderProcessingData->orderInput->getCustomerUser();
$customerUser = $orderProcessingData->orderInput->getCustomerUser();
$orderData->customerUser = $customerUser;

if ($customerUser !== null) {
$orderData->email = $customerUser->getEmail();
}

return $orderProcessingStack->processNext($orderProcessingData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function testCustomerIsAdded(): void
$actualOrderData = $result->orderData;

$this->assertSame($expectedCustomerUser, $actualOrderData->customerUser);
$this->assertSame($expectedCustomerUser->getEmail(), $actualOrderData->email);
}

public function testCustomerUserIsIgnoredIfMissing(): void
Expand Down

0 comments on commit 648d7bb

Please sign in to comment.