Commit graph

11 commits

Author SHA1 Message Date
Juerd Waalboer
f479060576 Fix bug: ->changed is getter only, not a setter 2023-01-19 05:24:50 +01:00
Juerd Waalboer
32470ff92b Extra newline 2023-01-19 03:16:57 +01:00
Juerd Waalboer
5e91aaff3d statiegeld: support statiegeld-only products 2023-01-19 01:51:40 +01:00
Juerd Waalboer
4d5eae3ad7 statiegeld_tokens: new token format, rename id to token_type
Added some fields for debugging and maybe future use.
2023-01-19 01:34:12 +01:00
Juerd Waalboer
bd0ebce71a Fix undef warning 2023-01-18 03:28:22 +01:00
Juerd Waalboer
b19609c6f6 Show deposit tokens on user info
Also, singular without s
2023-01-17 20:29:17 +01:00
Juerd Waalboer
5b0c85d770 Refactor read_products and its callers
- Promote to public function since it's used in other plugins anyway
- Move resolving of addons to read_products (print errors immediately)
- Cache product list based on mtime; mostly to reduce the amount of spam
  from errors as performance was never an issue.
- Cache product object in cart entry, so statiegeld_tokens plugin
  doesn't have to do the lookup all over again.
2023-01-17 20:28:35 +01:00
Juerd Waalboer
fdd098e215 Full stop 2023-01-16 05:00:17 +01:00
Juerd Waalboer
d44654e98a statiegeld_tokens: reuse code
Since that logic was factored into its own sub and is basically the same
as what was used here, let's use it here too.

This is still somewhat duplicated functionality from products::command.
Should adding addons be done in _read_products instead?
2023-01-16 04:53:50 +01:00
Juerd Waalboer
6180bf6ea5 Add new hook_checkout_prepare, rollback earlier change of hook_checkout
In hindsight, it was a bad idea to allow manipulating the cart (entries)
in hook_checkout, because that hook is used by the `log` plugin. You now
get unused entries in the log.

Although that plugin should maybe have used hook_checkout_done, existing
log file readers (including scripts) and custom plugins may depend on
the CHECKOUT items in the log being before the BALANCE items.
2023-01-16 03:52:00 +01:00
Juerd Waalboer
ca03cb95d4 New plugin statiegeld_tokens
Activating statiegeld_tokens will limit the use of the statiegeld plugin
for container deposit refunds to what was bought at this venue.

Still needs documentation.

Changes to 'statiegeld' and 'undo' were made to support the new
plugin, specifically:

- metadata (attributes) added in $cart->add, for the statiegeld_tokens
  plugin to use.
- statiegeld plugin now shares a global variable (configuration).
- undo can now be rolled back during hook_checkout.
2023-01-16 03:08:42 +01:00