MT#59537 create_invoice() add existing balance check

* if no balance is found for the provided period a 422
  error is returned:
    showdetails => $c->loc('period start=[_1] end=[_2].', $stime, $etime),
    error => 'Could not find active balance.',
    httpcode => HTTP_UNPROCESSABLE_ENTITY,
  instead of a 500 server because of access to undefined $balance value

Change-Id: Icccb9f253d117327641b6803ac0d2cdb09cf030f
mr12.3
Kirill Solomko 1 year ago
parent 740bb764e5
commit 0202996756

@ -73,6 +73,15 @@ sub create_invoice {
contract => $contract,
stime => $stime,
etime => $etime,);
unless ($balance) {
die {
showdetails => $c->loc('period start=[_1] end=[_2].', $stime, $etime),
error => 'Could not find active balance.',
httpcode => HTTP_UNPROCESSABLE_ENTITY,
};
}
$stime = NGCP::Panel::Utils::DateTime::convert_tz($balance->start,undef,'UTC',$c);
$etime = NGCP::Panel::Utils::DateTime::convert_tz($balance->end,undef,'UTC',$c);
my $bm_actual = NGCP::Panel::Utils::BillingMappings::get_actual_billing_mapping(
@ -364,4 +373,4 @@ sub check_invoice_data{
}
1;
1;

Loading…
Cancel
Save