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

(-)a/misc/sip_cli_emulator.pl (-2 / +78 lines)
Lines 46-51 my $item_identifier; Link Here
46
46
47
my $fee_acknowledged = 0;
47
my $fee_acknowledged = 0;
48
48
49
my $fee_type;
50
my $payment_type;
51
my $currency_type;
52
my $fee_amount;
53
my $fee_identifier;
54
my $transaction_id;
55
49
my $terminator = q{};
56
my $terminator = q{};
50
57
51
my @messages;
58
my @messages;
Lines 66-71 GetOptions( Link Here
66
73
67
    "s|summary=s" => \$summary,
74
    "s|summary=s" => \$summary,
68
75
76
    "fee-type=s"       => \$fee_type,
77
    "payment-type=s"   => \$payment_type,
78
    "currency-type=s"  => \$currency_type,
79
    "fee-amount=s"     => \$fee_amount,
80
    "fee-identifier=s" => \$fee_identifier,
81
    "transaction-id=s" => \$transaction_id,
82
69
    "t|terminator=s" => \$terminator,
83
    "t|terminator=s" => \$terminator,
70
84
71
    "m|message=s" => \@messages,
85
    "m|message=s" => \@messages,
Lines 218-223 my $handlers = { Link Here
218
            'fee_acknowledged',
232
            'fee_acknowledged',
219
        ],
233
        ],
220
    },
234
    },
235
    fee_paid => {
236
        name       => 'Fee Paid',
237
        subroutine => \&build_fee_paid_command_message,
238
        parameters => {
239
            transaction_date  => $transaction_date,
240
            fee_type          => $fee_type,
241
            payment_type      => $payment_type,
242
            currency_type     => $currency_type,
243
            fee_amount        => $fee_amount,
244
            institution_id    => $location_code,
245
            patron_identifier => $patron_identifier,
246
            terminal_password => $terminal_password,
247
            patron_password   => $patron_password,
248
            fee_identifier    => $fee_identifier,
249
            transaction_id    => $transaction_id,
250
        },
251
        optional => [
252
            'fee_type', # has default
253
            'payment_type', # has default
254
            'currency_type', #has default
255
            'terminal_password',
256
            'patron_password',
257
            'fee_identifier',
258
            'transaction_id',
259
        ],
260
    },
221
};
261
};
222
262
223
my $data = run_command_message('login');
263
my $data = run_command_message('login');
Lines 457-462 sub build_renew_command_message { Link Here
457
      . build_field( FID_FEE_ACK,      $fee_acknowledged, { optional => 1 } );
497
      . build_field( FID_FEE_ACK,      $fee_acknowledged, { optional => 1 } );
458
}
498
}
459
499
500
sub build_fee_paid_command_message {
501
    my ($params) = @_;
502
503
    my $transaction_date  = $params->{transaction_date};
504
    my $fee_type          = $params->{fee_type} || '01';
505
    my $payment_type      = $params->{payment_type} || '00';
506
    my $currency_type     = $params->{currency_type} || 'USD';
507
    my $fee_amount        = $params->{fee_amount};
508
    my $institution_id    = $params->{location_code};
509
    my $patron_identifier = $params->{patron_identifier};
510
    my $terminal_password = $params->{terminal_password};
511
    my $patron_password   = $params->{patron_password};
512
    my $fee_identifier    = $params->{fee_identifier};
513
    my $transaction_id    = $params->{transaction_id};
514
515
    return
516
        FEE_PAID
517
      . $transaction_date
518
      . $fee_type
519
      . $payment_type
520
      . $currency_type
521
      . build_field( FID_FEE_AMT,        $fee_amount )
522
      . build_field( FID_INST_ID,        $institution_id )
523
      . build_field( FID_PATRON_ID,      $patron_identifier )
524
      . build_field( FID_TERMINAL_PWD,   $terminal_password, { optional => 1 } )
525
      . build_field( FID_PATRON_PWD,     $patron_password, { optional => 1 } )
526
      . build_field( FID_FEE_ID,         $fee_identifier, { optional => 1 } )
527
      . build_field( FID_TRANSACTION_ID, $transaction_id, { optional => 1 } );
528
}
529
460
sub build_field {
530
sub build_field {
461
    my ( $field_identifier, $value, $params ) = @_;
531
    my ( $field_identifier, $value, $params ) = @_;
462
532
Lines 500-505 Options: Link Here
500
570
501
  -fa --fee-acknowledged Sends a confirmation of checkout fee
571
  -fa --fee-acknowledged Sends a confirmation of checkout fee
502
572
573
  --fee-type        Fee type for Fee Paid message, defaults to '01'
574
  --payment-type    Payment type for Fee Paid message, default to '00'
575
  --currency-type   Currency type for Fee Paid message, defaults to 'USD'
576
  --fee-amount      Fee amount for Fee Paid message, required
577
  --fee-identifier  Fee identifier for Fee Paid message, optional
578
  --transaction-id  Transaction id for Fee Paid message, optional
579
503
  -m --message     SIP2 message to execute
580
  -m --message     SIP2 message to execute
504
581
505
  Implemented Messages:
582
  Implemented Messages:
Lines 509-514 Options: Link Here
509
    checkout
586
    checkout
510
    checkin
587
    checkin
511
    renew
588
    renew
512
589
    fee_paid
513
/
590
/
514
}
591
}
515
- 

Return to bug 16757