View | Details | Raw Unified | Return to bug 16757
Collapse All | Expand All

(-)a/misc/sip_cli_emulator.pl (-2 / +78 lines)
Lines 44-49 my $item_identifier; Link Here
44
44
45
my $fee_acknowledged = 0;
45
my $fee_acknowledged = 0;
46
46
47
my $fee_type;
48
my $payment_type;
49
my $currency_type;
50
my $fee_amount;
51
my $fee_identifier;
52
my $transaction_id;
53
47
my $terminator = q{};
54
my $terminator = q{};
48
55
49
my @messages;
56
my @messages;
Lines 62-67 GetOptions( Link Here
62
69
63
    "fa|fee-acknowledged" => \$fee_acknowledged,
70
    "fa|fee-acknowledged" => \$fee_acknowledged,
64
71
72
    "fee-type=s"       => \$fee_type,
73
    "payment-type=s"   => \$payment_type,
74
    "currency-type=s"  => \$currency_type,
75
    "fee-amount=s"     => \$fee_amount,
76
    "fee-identifier=s" => \$fee_identifier,
77
    "transaction-id=s" => \$transaction_id,
78
65
    "t|terminator=s" => \$terminator,
79
    "t|terminator=s" => \$terminator,
66
80
67
    "m|message=s" => \@messages,
81
    "m|message=s" => \@messages,
Lines 213-218 my $handlers = { Link Here
213
            'fee_acknowledged',
227
            'fee_acknowledged',
214
        ],
228
        ],
215
    },
229
    },
230
    fee_paid => {
231
        name       => 'Fee Paid',
232
        subroutine => \&build_fee_paid_command_message,
233
        parameters => {
234
            transaction_date  => $transaction_date,
235
            fee_type          => $fee_type,
236
            payment_type      => $payment_type,
237
            currency_type     => $currency_type,
238
            fee_amount        => $fee_amount,
239
            institution_id    => $location_code,
240
            patron_identifier => $patron_identifier,
241
            terminal_password => $terminal_password,
242
            patron_password   => $patron_password,
243
            fee_identifier    => $fee_identifier,
244
            transaction_id    => $transaction_id,
245
        },
246
        optional => [
247
            'fee_type', # has default
248
            'payment_type', # has default
249
            'currency_type', #has default
250
            'terminal_password',
251
            'patron_password',
252
            'fee_identifier',
253
            'transaction_id',
254
        ],
255
    },
216
};
256
};
217
257
218
my $data = run_command_message('login');
258
my $data = run_command_message('login');
Lines 451-456 sub build_renew_command_message { Link Here
451
      . build_field( FID_FEE_ACK,      $fee_acknowledged, { optional => 1 } );
491
      . build_field( FID_FEE_ACK,      $fee_acknowledged, { optional => 1 } );
452
}
492
}
453
493
494
sub build_fee_paid_command_message {
495
    my ($params) = @_;
496
497
    my $transaction_date  = $params->{transaction_date};
498
    my $fee_type          = $params->{fee_type} || '01';
499
    my $payment_type      = $params->{payment_type} || '00';
500
    my $currency_type     = $params->{currency_type} || 'USD';
501
    my $fee_amount        = $params->{fee_amount};
502
    my $institution_id    = $params->{location_code};
503
    my $patron_identifier = $params->{patron_identifier};
504
    my $terminal_password = $params->{terminal_password};
505
    my $patron_password   = $params->{patron_password};
506
    my $fee_identifier    = $params->{fee_identifier};
507
    my $transaction_id    = $params->{transaction_id};
508
509
    return
510
        FEE_PAID
511
      . $transaction_date
512
      . $fee_type
513
      . $payment_type
514
      . $currency_type
515
      . build_field( FID_FEE_AMT,        $fee_amount )
516
      . build_field( FID_INST_ID,        $institution_id )
517
      . build_field( FID_PATRON_ID,      $patron_identifier )
518
      . build_field( FID_TERMINAL_PWD,   $terminal_password, { optional => 1 } )
519
      . build_field( FID_PATRON_PWD,     $patron_password, { optional => 1 } )
520
      . build_field( FID_FEE_ID,         $fee_identifier, { optional => 1 } )
521
      . build_field( FID_TRANSACTION_ID, $transaction_id, { optional => 1 } );
522
}
523
454
sub build_field {
524
sub build_field {
455
    my ( $field_identifier, $value, $params ) = @_;
525
    my ( $field_identifier, $value, $params ) = @_;
456
526
Lines 491-496 Options: Link Here
491
561
492
  -fa --fee-acknowledged Sends a confirmation of checkout fee
562
  -fa --fee-acknowledged Sends a confirmation of checkout fee
493
563
564
  --fee-type        Fee type for Fee Paid message, defaults to '01'
565
  --payment-type    Payment type for Fee Paid message, default to '00'
566
  --currency-type   Currency type for Fee Paid message, defaults to 'USD'
567
  --fee-amount      Fee amount for Fee Paid message, required
568
  --fee-identifier  Fee identifier for Fee Paid message, optional
569
  --transaction-id  Transaction id for Fee Paid message, optional
570
494
  -m --message     SIP2 message to execute
571
  -m --message     SIP2 message to execute
495
572
496
  Implemented Messages:
573
  Implemented Messages:
Lines 500-505 Options: Link Here
500
    checkout
577
    checkout
501
    checkin
578
    checkin
502
    renew
579
    renew
503
580
    fee_paid
504
/
581
/
505
}
582
}
506
- 

Return to bug 16757