Bug 41369: SIP payments have no branchcode
For SIP based payments, no branchcode is recorded for the corresponding credit. Koha should be recording the institution id (i.e. branchcode) for SIP payments. Test plan: 1) Apply this patch 2) prove t/db_dependent/SIP/Transaction.t Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
82561ff33d
commit
1bb2532f33
|
|
@ -358,7 +358,7 @@ sub end_patron_session {
|
|||
sub pay_fee {
|
||||
my (
|
||||
$self, $patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency, $is_writeoff,
|
||||
$disallow_overpayment, $register_id
|
||||
$disallow_overpayment, $register_id, $inst_id
|
||||
) = @_;
|
||||
|
||||
my $trans = C4::SIP::ILS::Transaction::FeePayment->new();
|
||||
|
|
@ -372,7 +372,7 @@ sub pay_fee {
|
|||
}
|
||||
my $trans_result = $trans->pay(
|
||||
$patron->{borrowernumber}, $fee_amt, $pay_type, $fee_id, $is_writeoff, $disallow_overpayment,
|
||||
$register_id
|
||||
$register_id, $inst_id
|
||||
);
|
||||
my $ok = $trans_result->{ok};
|
||||
$trans->ok($ok);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ sub pay {
|
|||
my $is_writeoff = shift;
|
||||
my $disallow_overpayment = shift;
|
||||
my $register_id = shift;
|
||||
my $inst_id = shift;
|
||||
|
||||
my $type = $is_writeoff ? 'WRITEOFF' : 'PAYMENT';
|
||||
|
||||
|
|
@ -66,6 +67,7 @@ sub pay {
|
|||
payment_type => 'SIP' . $sip_type,
|
||||
interface => C4::Context->interface,
|
||||
cash_register => $register_id,
|
||||
library_id => $inst_id,
|
||||
};
|
||||
|
||||
if ($fee_id) {
|
||||
|
|
|
|||
|
|
@ -1237,8 +1237,8 @@ sub handle_fee_paid {
|
|||
$ils->check_inst_id( $inst_id, "handle_fee_paid" );
|
||||
|
||||
my $pay_result = $ils->pay_fee(
|
||||
$patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency,
|
||||
$is_writeoff, $disallow_overpayment, $register_id
|
||||
$patron_id, $patron_pwd, $fee_amt, $fee_type, $pay_type, $fee_id, $trans_id, $currency,
|
||||
$is_writeoff, $disallow_overpayment, $register_id, $ils->institution
|
||||
);
|
||||
$status = $pay_result->{status};
|
||||
my $pay_response = $pay_result->{pay_response};
|
||||
|
|
|
|||
|
|
@ -129,7 +129,9 @@ subtest fill_holds_at_checkout => sub {
|
|||
|
||||
subtest "FeePayment->pay tests" => sub {
|
||||
|
||||
plan tests => 5;
|
||||
plan tests => 6;
|
||||
|
||||
my $inst_id = $builder->build_object( { class => 'Koha::Libraries' } )->id;
|
||||
|
||||
# Create a borrower and add some outstanding debts to their account
|
||||
my $patron = $builder->build( { source => 'Borrower' } );
|
||||
|
|
@ -152,7 +154,7 @@ subtest "FeePayment->pay tests" => sub {
|
|||
my $pay_type = '00'; # 00 - Cash, 01 - VISA, 02 - Creditcard
|
||||
my $ok = $trans->pay(
|
||||
$patron->{borrowernumber}, 100, $pay_type, $debt1->id, 0,
|
||||
0
|
||||
0, undef, $inst_id
|
||||
);
|
||||
ok( $ok, "FeePayment transaction succeeded" );
|
||||
$debt1->discard_changes;
|
||||
|
|
@ -163,7 +165,8 @@ subtest "FeePayment->pay tests" => sub {
|
|||
my $offsets = Koha::Account::Offsets->search( { debit_id => $debt1->id, credit_id => { '!=' => undef } } );
|
||||
is( $offsets->count, 1, "FeePayment produced an offset line correctly" );
|
||||
my $credit = $offsets->next->credit;
|
||||
is( $credit->payment_type, 'SIP00', "Payment type was set correctly" );
|
||||
is( $credit->payment_type, 'SIP00', "Payment type was set correctly" );
|
||||
is( $credit->branchcode, $inst_id, "Branchcode was set correctly" );
|
||||
};
|
||||
|
||||
subtest cancel_hold => sub {
|
||||
|
|
|
|||
Loading…
Reference in New Issue