From 49e41ea0ea218a2a1ff341247965e1c1a86760a3 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Sun, 12 May 2019 20:50:49 +0200 Subject: [PATCH] Change from Term::QRCode to qrencode; minimize QR It's more likely that people will manage to install qrencode, than the 0.01 perl module from 2008 with broken dependencies. Also, by eliminating optional parts of the EPC QR data, the resulting code fits on fewer lines. --- plugins/deposit_epc_qr | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/plugins/deposit_epc_qr b/plugins/deposit_epc_qr index 8fc1766..a4ec575 100644 --- a/plugins/deposit_epc_qr +++ b/plugins/deposit_epc_qr @@ -1,6 +1,5 @@ #!perl -use Term::QRCode; use List::Util qw(sum); sub command { NEXT } @@ -22,16 +21,21 @@ sub hook_checkout { if (defined $amount && $amount > 0) { print "Here's your EPC QR code:\n"; - print Term::QRCode->new->plot(join( + open my $pipe, "| qrencode -t ansiutf8 -m 2" + or die "Couldn't run qrencode"; + + print $pipe join( "\n", - "BCD", "001", 1, "SCT", - "BANKCC01", # Change this to your bank's BIC number + "BCD", "002", 1, "SCT", + "", "Your Hackerspace", # Account name "NL12ABCD1234567890", # IBAN Number "EUR" . $amount, # Amount - "CHAR", "", - "deposit $user (T: $transaction_id)", # Description "", - )) . "\n"; + "", + "deposit", # $user (T: $transaction_id)", # Description + "", + ); + close $pipe; } }