Giter Site home page Giter Site logo

ultimate / prepaidphoneplanbalancechecker Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 713 KB

Simple command line tool to check your prepaid phone plan balance and send out e-mail notifications if the balance is to low

License: The Unlicense

Java 100.00%
java http-requests email-sender properties-file phone-balance

prepaidphoneplanbalancechecker's Introduction

PrepaidPhonePlanBalanceChecker

Simple command line tool to check your prepaid phone plan balance. (Not a beauty regarding SW design, but working ๐Ÿ˜‰)

This tool can for example be run in a cron job to regularly check your balance and send out an e-mail notification if the balance falls below a given limit.

โ„น๏ธ this tool has exclusively been implemented and tested for https://www.aldi-mobile.ch/ and will require adoption for other providers, but may act as an inspiration :)

PRs Welcome
made-with-java

How to use?

  1. Download the latest release from the releases:
    Latest release
  2. Create a .properties file for your phone number and provider. Use example.properties as a reference
  3. You can run the tool from the console with the following short java command:
java -cp bin:lib/activation-1.1.1.jar:lib/javax.mail-1.6.2.jar balancechecker.impl.ALDISuisseBalanceChecker yourname.properties
  1. Create a script if you want to use execute the program more frequently.
    โ„น๏ธ If you want you can output the log to a file, by appending >> yourname.log to the script.
    e.g. checkbalance.sh
#!/bin/sh
java -cp bin:lib/activation-1.1.1.jar:lib/javax.mail-1.6.2.jar balancechecker.impl.ALDISuisseBalanceChecker yourname.properties >> yourname.log
  1. Create a cron job to run the script weekly or so
    e.g. run every Sunday at 3 AM
0 3 * * 0 cd /path/to/your/copy/of/the/tool && checkbalance.sh

How to adopt?

If you want to use this program for other providers, proceed as follows:

  1. Fork this repo
    Fork this repo
  2. Copy balancecheker.impl.ALDISuisseBalanceChecker for your provider
  3. Change the following functions for your needs:
    • validateProperties0() >>> check whether all the settings you need are set in the properties
    • getBalance() >>> perform the requests to
      1. login to your phone account
      2. retrieve the balance information
      3. parse the balance to java.math.BigDecimal
      4. logout of your account
    • main(String[] args) >>> change the third line to use your class
    • remove unnecessary constants from the top of the class
  4. Create a pull request for this repo if you want this implementation to be shared:
    Github pull-requests
    Working on your first Pull Request? You can learn how from this free series How to make a pull request
  5. Create a console script and schedule a cron job if needed (see How to use? above)

Improvements needed?

If you have any request... Feel free to create an issue ๐Ÿ˜„
GitHub issues

PS / Credits

Thanks to Naereen for the badges

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.