From 0e9603bb49436e4bb74e893f74a63ef31065f798 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 12 Sep 2023 14:18:37 +0100 Subject: [PATCH] Bug 34764: Set fee_acknowledged to expect a string For consistency with other options I opted to have the fee acknowledged parameter to expect a string and as it's an optional parameter I've dropped the default value of 'N' too. Test plan 1) Prior to this patch 1a) Attempt a checkout without passing -fa/--fee_acknowledged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout` The final field of the SIP request will be '|BON', the default 1b) Attempt a checkout passing -fa/--fee_acknowledged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged --patron 23529000035676 --item 39999000007756 -m checkout` The final field of the SIP request will still be '|BON', failure 1c) Attempt a checkout passing a string for fee_acknoewledeged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout` The final field of the SIP request will still be '|BON', failure 2) Apply the patch 2a) Attempt a checkout without passing -fa/--fee_acknowledged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --patron 23529000035676 --item 39999000007756 -m checkout` The optional `|BO` element should not be present 2b) Attempt a checkout passing -fa/--fee_acknowledged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged N --patron 23529000035676 --item 39999000007756 -m checkout` The final field of the SIP request will now be '|BON', success 2c) Attempt a checkout passing a string for fee_acknoewledeged flag `./misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL --fee-acknowledged Y --patron 23529000035676 --item 39999000007756 -m checkout` The final field of the SIP request will now be '|BOY', success Signed-off-by: David Nind Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- misc/sip_cli_emulator.pl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/misc/sip_cli_emulator.pl b/misc/sip_cli_emulator.pl index 60bba2013a..dbb56537fe 100755 --- a/misc/sip_cli_emulator.pl +++ b/misc/sip_cli_emulator.pl @@ -44,7 +44,7 @@ my $summary; my $item_identifier; -my $fee_acknowledged = 0; +my $fee_acknowledged; my $fee_type; my $payment_type; @@ -72,7 +72,7 @@ GetOptions( "i|item=s" => \$item_identifier, - "fa|fee-acknowledged" => \$fee_acknowledged, + "fa|fee-acknowledged=s" => \$fee_acknowledged, "s|summary=s" => \$summary, @@ -449,12 +449,11 @@ sub build_checkout_command_message { my $terminal_password = $params->{terminal_password}; my $item_properties = $params->{item_properties}; my $patron_password = $params->{patron_password}; - my $fee_acknowledged = $params->{fee_acknowledged} || 'N'; + my $fee_acknowledged = $params->{fee_acknowledged}; my $cancel = $params->{cancel} || 'N'; $SC_renewal_policy = $SC_renewal_policy eq 'Y' ? 'Y' : 'N'; $no_block = $no_block eq 'Y' ? 'Y' : 'N'; - $fee_acknowledged = $fee_acknowledged eq 'Y' ? 'Y' : 'N'; $cancel = $cancel eq 'Y' ? 'Y' : 'N'; $nb_due_date ||= $transaction_date; @@ -520,7 +519,7 @@ sub build_hold_command_message { my $item_identifier = $params->{item_identifier}; my $title_identifier = $params->{title_identifier}; my $terminal_password = $params->{terminal_password}; - my $fee_acknowledged = $params->{fee_acknowledged} || 'N'; + my $fee_acknowledged = $params->{fee_acknowledged}; return HOLD @@ -552,11 +551,10 @@ sub build_renew_command_message { my $title_identifier = $params->{title_identifier}; my $terminal_password = $params->{terminal_password}; my $item_properties = $params->{item_properties}; - my $fee_acknowledged = $params->{fee_acknowledged} || 'N'; + my $fee_acknowledged = $params->{fee_acknowledged}; $third_party_allowed = $third_party_allowed eq 'Y' ? 'Y' : 'N'; $no_block = $no_block eq 'Y' ? 'Y' : 'N'; - $fee_acknowledged = $fee_acknowledged eq 'Y' ? 'Y' : 'N'; $nb_due_date ||= $transaction_date; @@ -647,7 +645,7 @@ Options: -t --terminator SIP2 message terminator, either CR, or CRLF (defaults to CRLF) - -fa --fee-acknowledged Sends a confirmation of checkout fee + -fa --fee-acknowledged Accepts "Y" to acknowledge a fee, "N" to not acknowledge it --fee-type Fee type for Fee Paid message, defaults to '01' --payment-type Payment type for Fee Paid message, default to '00' -- 2.39.5