Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes for module API

- also some erro handling to prevent bad usage inserts
  • Loading branch information...
commit 2bfca2039e96e0a9c25da86b2bd472013f061222 1 parent a866fdf
@ajithhub authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 poll_balance.pl
  2. BIN  usage.db
View
13 poll_balance.pl
@@ -31,9 +31,9 @@
print YAML::Dump($username, $password);
-my $account = Business::Billing::TMobile::USA->new(debug =>0);
+my $account = Business::Billing::TMobile::USA->new(debug =>1);
-my $user = $account->login(user => $username, password => $password)
+my $user = $account->login(username => $username, password => $password)
or die "Problem logging in";
@@ -62,13 +62,18 @@
or die "Problem inserting";
}
-printf "Go rowid %s", $user_id;
-
+printf "Go rowid %s\n", $user_id;
my $prepay_info = $account->get_prepay_details();
my $exp_time = Date::Parse::str2time($prepay_info->{expiration});
+for my $key (qw(minutes, messages, balance)) {
+ exists $prepay_info->{$key} and
+ defined $prepay_info->{$key}
+ or die "Missing data, can't update db: %s", $key;
+}
+
$ins_usage_sth->execute(
$user_id,
$prepay_info->{minutes},
View
BIN  usage.db
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.