MT#16109 update "prepaid" pref correctly

Change-Id: I6285db0776a87e4537961fb8a79430d093016b45
changes/42/3142/1
Rene Krenn 10 years ago
parent 8940c55731
commit 59ec368233

@ -542,7 +542,7 @@ sub edit :Chained('base_restricted') :PathPart('edit') :Args(0) {
}
}
NGCP::Panel::Utils::Subscriber::switch_prepaid(c => $c,
NGCP::Panel::Utils::Subscriber::switch_prepaid_contract(c => $c,
#old_prepaid => $old_prepaid,
#new_prepaid => $billing_profile->prepaid,
prepaid => $billing_profile->prepaid,

@ -300,7 +300,7 @@ sub update_customer {
);
}
NGCP::Panel::Utils::Subscriber::switch_prepaid(c => $c,
NGCP::Panel::Utils::Subscriber::switch_prepaid_contract(c => $c,
#old_prepaid => $old_resource->{prepaid},
#new_prepaid => $billing_profile->prepaid,
prepaid => $billing_profile->prepaid,

@ -950,7 +950,7 @@ sub add_profile_mappings {
$bm_actual = get_actual_billing_mapping(c => $c,
contract => $contract,
now => $now);
NGCP::Panel::Utils::Subscriber::switch_prepaid(c => $c,
NGCP::Panel::Utils::Subscriber::switch_prepaid_contract(c => $c,
#old_prepaid => $old_prepaid,
#new_prepaid => $bm_actual->billing_mappings->first->billing_profile->prepaid,
prepaid => $bm_actual->billing_mappings->first->billing_profile->prepaid,

@ -116,7 +116,7 @@ sub get_provisoning_voip_subscriber_lock_level {
sub switch_prepaid {
my %params = @_;
NGCP::Panel::Utils::Preferences::set_provisoning_voip_subscriber_first_int_attr_value(%params,
value => ($params{prepaid} ? 1 : 0),
attribute => 'prepaid'
@ -124,6 +124,18 @@ sub switch_prepaid {
}
sub switch_prepaid_contract {
my %params = @_;
my $contract = $params{contract};
for my $subscriber ($contract->voip_subscribers->search_rs({ 'me.status' => { '!=' => 'terminated' } })->all) {
switch_prepaid(%params,
prov_subscriber => $subscriber->provisioning_voip_subscriber,
) if ($subscriber->provisioning_voip_subscriber);
}
}
sub get_lock_string {
my $level = shift;
return $LOCK{$level};

@ -147,7 +147,7 @@ my $gantt_events;
if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
#goto SKIP;
goto SKIP;
#goto THREADED;
if ('Europe/Vienna' eq NGCP::Panel::Utils::DateTime::current_local()->time_zone->name) {
my $package = _create_profile_package('create','hour',1);
@ -237,10 +237,11 @@ if (_get_allow_fake_client_time()) { # && $enable_profile_packages) {
_set_time();
}
SKIP:
{
my $profile_initial = _create_billing_profile('UNDERRUN1_INITIAL');
my $profile_topup = _create_billing_profile('UNDERRUN1_TOPUP');
my $profile_underrun = _create_billing_profile('UNDERRUN1_UNDERRUN');
my $profile_initial = _create_billing_profile('UNDERRUN1_INITIAL',prepaid => 0);
my $profile_topup = _create_billing_profile('UNDERRUN1_TOPUP',prepaid => 0);
my $profile_underrun = _create_billing_profile('UNDERRUN1_UNDERRUN',prepaid => 1);
my $package = _create_profile_package('1st','month',1, initial_balance => 100,
carry_over_mode => 'discard', underrun_lock_threshold => 50, underrun_lock_level => 4, underrun_profile_threshold => 50,
@ -1960,7 +1961,7 @@ sub _perform_topup_cash {
}
sub _create_billing_profile {
my ($name) = @_;
my ($name,@further_opts) = @_;
$req = HTTP::Request->new('POST', $uri.'/api/billingprofiles/');
$req->header('Content-Type' => 'application/json');
$req->header('Prefer' => 'return=representation');
@ -1968,6 +1969,7 @@ sub _create_billing_profile {
name => $name." $t",
handle => $name."_$t",
reseller_id => $default_reseller_id,
@further_opts,
};
$req->content(JSON::to_json($req_data));
$res = $ua->request($req);

Loading…
Cancel
Save