Check giftcard balance before finishing checkout

Created on 12 January 2023, over 2 years ago
Updated 10 November 2023, over 1 year ago

Problem/Motivation

If the giftcard balance is modified manually during checkout process, an exception is thrown and the order cannot be completed.

Drupal\Core\Entity\EntityStorageException: Giftcard balance must not be negative in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 815 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Steps to reproduce

  • Create a giftcard manually
  • Add products to the cart, proceed to checkout
  • Redeem the giftcard from the giftcard pane
  • Add a giftcard transaction reducing the giftcard balance to 0
  • Click on the checkout submit button
  • Exception is thrown

Proposed resolution

Check the giftcard balance at checkout pane valitation step and prevent checkout completion if the giftcard balance has been modified.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain plopesc Valladolid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024