Skip to content

Commit

Permalink
Bitlair changes
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfloyd committed May 21, 2024
1 parent 04cf728 commit 1c8c56a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/RevBank/Messages.pm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sub hook_user_balance($class, $username, $old, $delta, $new, @) {
my $sign = $delta->cents >= 0 ? '+' : '-';
my $rood = $new->cents < 0 ? '31;' : '';
my $abs = $delta->abs;
my $warn = $new->cents < -2300 ? " \e[5;1m(!!)\e[0m" : "";
my $warn = $new->cents < -1337 ? " \e[5;1m(!!)\e[0m" : "";

$_ = $_->string("+") for $old, $new;
printf "New balance for $username: $old $sign $abs = \e[${rood}1m$new\e[0m$warn\n",
Expand Down
4 changes: 4 additions & 0 deletions plugins/deposit
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ sub how :Tab(&how_tab) ($self, $cart, $input, @) {
return shift @{ $how->{prompts} }, \&how_prompt;
}

if ( ($input eq "iban") && ($self->{amount} < 10 || $self->{amount} == 25) ) {
return REJECT, "\n\e[31;1mPlease transfer at least 10 EUR and not 25 or 32 EUR when using iban\e[0m\n\n";
}

my $contra =
$how->{_key} eq 'cash' ? '-cash'
: $how->{_key} eq 'reimburse' ? '-expenses/reimbursed'
Expand Down
8 changes: 5 additions & 3 deletions plugins/deposit_iban_qr
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
use IPC::Open2 qw(open2);
use List::Util qw(sum);

my $iban = "NL99ABCD1234567890";
my $beneficiary = "Account Name";
my $iban = "NL89RABO0111741386";
my $beneficiary = "Stichting Bitlair";

sub hook_checkout($class, $cart, $user, $transaction_id, @) {
my @entries = $cart->entries("is_deposit");
Expand All @@ -41,7 +41,7 @@ sub hook_checkout($class, $cart, $user, $transaction_id, @) {
"EUR" . $amount, # Amount
"",
"",
"rb $user",
"Deposit $user (RB QR)",
"",
);
close $in;
Expand All @@ -57,6 +57,8 @@ sub hook_checkout($class, $cart, $user, $transaction_id, @) {
$lines[3] =~ s/$/ EPC QR codes. N26 also works./;
$lines[5] =~ s/$/ For manual transfers, use this/;
$lines[6] =~ s/$/ IBAN: $iban/;
$lines[7] =~ s/$/ Benificiary: $beneficiary/;
$lines[8] =~ s/$/ Description: Deposit $user/;

print @lines;
}
Expand Down
5 changes: 3 additions & 2 deletions plugins/deposit_methods
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ sub hook_deposit_methods($class, $message, $hash, @) {
Please type one of the following:
'iban': IBAN transfer (NL 69 ABNA 0431 1582 07)
'iban': IBAN transfer (Min 10 EUR / NL89 RABO 0111 7413 86)
'cash': Cash in the cash box
'reimburse': Reimbursement of expenses agreed upon in advance
Note: we require an invoice or receipt with this exact amount!
Note #1: we require an invoice or receipt with this exact amount!
Note #2: please do not use this plugin for amounts >20 EUR
'other': Provide a manual description
END

Expand Down
2 changes: 1 addition & 1 deletion plugins/idle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!perl

my $timeout = 10;
my $timeout = 20;

sub hook_prompt_idle($class, $cart, $plugin, $seconds, $readline, @) {
return unless $seconds >= $timeout and $cart->size and not $plugin;
Expand Down
2 changes: 1 addition & 1 deletion plugins/revspace_saldo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ sub hook_checkout_done($class, $cart, $user, $transaction_id, @) {
my $balance = RevBank::Users::balance($user) or return;
my $since = RevBank::Users::since($user);

if ($balance < -22.00) {
if ($balance < -13.37) {
_box(
"Hoi $user,",
"",
Expand Down

0 comments on commit 1c8c56a

Please sign in to comment.