statiegeld: support statiegeld-only products
This commit is contained in:
parent
4d5eae3ad7
commit
5e91aaff3d
2 changed files with 3 additions and 2 deletions
|
@ -30,13 +30,15 @@ sub statiegeld_product($product) {
|
||||||
$product = $products->{$product} or return;
|
$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 @relevant_addons = grep {
|
||||||
my $addon = $_;
|
my $addon = $_;
|
||||||
|
|
||||||
!$addon->{percent}
|
!$addon->{percent}
|
||||||
and (List::Util::any { $addon->{contra} eq $_ } @addon_accounts)
|
and (List::Util::any { $addon->{contra} eq $_ } @addon_accounts)
|
||||||
and $addon->{price} > 0;
|
and $addon->{price} > 0;
|
||||||
} @{ $product->{addons} // [] };
|
} $product, @{ $product->{addons} // [] };
|
||||||
|
|
||||||
return 0 if not @relevant_addons;
|
return 0 if not @relevant_addons;
|
||||||
return { product => $product, statiegeld_addons => \@relevant_addons };
|
return { product => $product, statiegeld_addons => \@relevant_addons };
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
# voiding of tokens
|
# voiding of tokens
|
||||||
# querying of tokens
|
# querying of tokens
|
||||||
# expiry of tokens
|
# expiry of tokens
|
||||||
# token for non-hidden addon (direct product use)
|
|
||||||
|
|
||||||
use List::Util;
|
use List::Util;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue