Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cart/Order Token Missing / Not Unique #2541

Closed
solverat opened this issue Feb 11, 2024 · 4 comments
Closed

Cart/Order Token Missing / Not Unique #2541

solverat opened this issue Feb 11, 2024 · 4 comments
Assignees
Labels
Milestone

Comments

@solverat
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Since #2511, the checkout requires a valid token, to complete the order.

We're struggling with two issues here:

  • The token is not unique per se: Back-Check if an order exists with generated token? I know, changes are low, but it's not unique
  • Carts which have been created before #Performance optimization #2265, don't come with any token => 404 in checkout (It's quite old, but still valid).

Possible Solution: #2539 (comment)

Or migrate it:

protected function execute(InputInterface $input, OutputInterface $output): int
{
    $listing = new CoreShopOrder\Listing();
    $listing->setUnpublished(true);
    $listing->addConditionParam('token = "" OR token IS NULL');
    $listing->addConditionParam(sprintf('saleState = "%s"', OrderSaleStates::STATE_CART ));

    foreach ($listing->getObjects() as $cart) {

        $token = $this->tokenGenerator->generate(10);

        $output->writeln(sprintf('<comment>Set missing token %s for cart %d', $token, $cart->getId()));

        $cart->setToken($token);
        $cart->save();
    }

    return Command::SUCCESS;
}
@dpfaffenbauer
Copy link
Member

@solverat a migration can be very heavy on the database. So I'd rather use the fallback approach, WDYT?

@dpfaffenbauer
Copy link
Member

I'd prefer a migration anyway ;).

@dpfaffenbauer dpfaffenbauer added this to the 3.2.4 milestone Feb 11, 2024
@dpfaffenbauer dpfaffenbauer self-assigned this Feb 11, 2024
@solverat
Copy link
Contributor Author

:D yes, probably a fallback would be smoother

@dpfaffenbauer
Copy link
Member

follow up ticket for uniqueness check: #2546

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants