From 5e91aaff3d85543d67e6c1c7626c20b1fffb212d Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Thu, 19 Jan 2023 01:51:40 +0100 Subject: [PATCH] statiegeld: support statiegeld-only products --- plugins/statiegeld | 4 +++- plugins/statiegeld_tokens | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/statiegeld b/plugins/statiegeld index 32d26d0..09dae8a 100644 --- a/plugins/statiegeld +++ b/plugins/statiegeld @@ -30,13 +30,15 @@ sub statiegeld_product($product) { $product = $products->{$product} or return; } + # Called 'addons' here but also includes the queried product itself, + # to support things that are 100% statiegeld (e.g. empty crate) my @relevant_addons = grep { my $addon = $_; !$addon->{percent} and (List::Util::any { $addon->{contra} eq $_ } @addon_accounts) and $addon->{price} > 0; - } @{ $product->{addons} // [] }; + } $product, @{ $product->{addons} // [] }; return 0 if not @relevant_addons; return { product => $product, statiegeld_addons => \@relevant_addons }; diff --git a/plugins/statiegeld_tokens b/plugins/statiegeld_tokens index 3fcf977..df0fe4a 100644 --- a/plugins/statiegeld_tokens +++ b/plugins/statiegeld_tokens @@ -4,7 +4,6 @@ # voiding of tokens # querying of tokens # expiry of tokens -# token for non-hidden addon (direct product use) use List::Util;