Skip to content

thomaskioko/paybill-manager

Repository files navigation

Icon

PayBill Manager (work-in-progress 👷🔧️👷‍♀️⛏)

Your personal finance manager. 💰


License Apache 2.0 Build Status codecov

Paybill manger is an Android app meant to help you manage your bill using Jenga API

It attempts to use the latest cutting edge libraries and tools. As a summary:

Development Environment

The app is written entirely in Kotlin and uses the Gradle build system. You require Android Studio 3.2 Canary 14 or higher. This is because lower versions don't support Navigation Components yet.

Jenga Credentials

PaybillManager uses Jenga Account to handle payments, so you will need to create an account. Once you have one, go ahead and get your keys

Once you have them, open gradle.properties file and paste your API key in JENGA_API_KEY, JENGA_USERNAME and JENGA_PASSWORD variables respectively.

Jenga Api Signature (Generate Pem files)

A SHA-256 signature to proof that this request is coming from the merchant. We concatinate the request object then sign with Private Key and Base64 encode it. We will use PKCS#8 with an RSA key in PEM format as per Jenga documentation.

  1. Generate a new RSA keypair using openssl Run the follwing commands in your terminal

    $ openssl genrsa -out privatekey.pem 2048 -nodes

    Once you are successful with the above command a file (privatekey.pem) will be created on your present directory, proceed to export the public key from the keypair generated. The command below shows how to do it.

  2. Export your public key

    $ openssl rsa -in privatekey.pem -outform PEM -pubout -out publickey.pem

  3. If the above command is successful, a new file (publickey.pem) will be created on your current directory. Copy the contents of this file and add it on our jengaHQ portal. Make sure to copy only the contents of the keyblock and paste as is.

  4. Important: We will need to convert the RSA key into a PKCS#8 encoded key in PEM format. We only need this on the client side. $ openssl pkcs8 -topk8 -in privatekey.pem -nocrypt -outform PEM -out pkcs8_privatekey.pem

  5. Finally, add pkcs8_privatekey.pem to your assests/pem folder.

Architecture

We followed the recommendations laid out in the Guide to App Architecture when deciding on the architecture for the app. We kept logic away from Activities and Fragments and moved it to ViewModel.

On top of this, We use a clean architecture approach to abstract functionality to respective modules. This has been explained below. 🤓

Module Layers

As mentioned before, this project uses clean architecture to abstract all functionality. We've done this by isolation functionality in respective modules.

Architecture Layers

  • UI (mobile): This layer is responsible for the UI of the app. This layer contains Android framework application implementation. At the moment we are only supporting Phones but we may add tablet support later on and we'll create a separate module for this. We'll implement the Navigation Component that will handle app navigation.

  • Presentation: The Presentation layer allows us to abstract the presentation logic from the framework specific implementation of our user interface. We'll be using MVVM and android architecture components library to handle presentation of our app.

  • Domain: This houses business rules/use case classes. This provides the core functionality of the project, think of it as rules of the projects. eg, Add Bill, Update Bill, Make payment. e.t.c

  • Data: The Data layer allows us to abstract the sources of the data that our application uses. It implements the domain later to help us satisfy the required functionality. It will help us determine where we should fetch data from, Cache or remote.

  • Remote: The Remote layer allows us to abstract the sources of the remote data that our application uses. We'll use Retrofit to handle networking functionality.

  • Cache: The Cache layer allows us to abstract the local source of data that our application uses. We'll use Room to handle local storage.

Libraries Used

  • Foundation - Components for core system capabilities, Kotlin extensions and support for multidex and automated testing.

    • AppCompat - Degrade gracefully on older versions of Android.
    • Android KTX - Write more concise, idiomatic Kotlin code.
    • Test - An Android testing framework for unit and runtime UI tests.
    • Robolectic - For UI test
  • Architecture - A collection of libraries that help you design robust, testable, and maintainable apps. Start with classes for managing your UI component lifecycle and handling data persistence.

    • Lifecycles - Create a UI that automatically responds to lifecycle events.
    • LiveData - Build data objects that notify views when the underlying database changes.
    • Navigation - Handle everything needed for in-app navigation.
    • Room - Access your app's SQLite database with in-app objects and compile-time checks.
    • ViewModel - Store UI-related data that isn't destroyed on app rotations. Easily schedule asynchronous tasks for optimal execution.
  • Third party

Development Progress

  • Setup Travis CI
  • Add Kotlin Support
  • Create payment module
  • Add CodeCov
  • Setup CodeQuality Checks
  • Setup Crashlytics
  • Setup LeakCanary
  • Invoke STK Push
  • Work On UI
  • Switch to Coroutines (Maybe) 🤔
  • Use WorkManager for reminders
  • Get CodeCoverage above 50%
  • Release Beta Version

Contributions

If you've found an error in this sample, please file an issue.

Patches are encouraged, and may be submitted by forking this project and submitting a pull request. Since this project is still in its very early stages, if your change is substantial, please raise an issue first to discuss it.

Would you like to contribute code?

  1. Fork Paybill Manager.
  2. Create a new branch (using GitHub) or the command git checkout -b branch-name dev).
  3. Start a pull request. Reference existing issues when possible.

No code!

References

  • Android Clean Architecture Sample app that is part of a series of blog posts about how to architect an android application using Uncle Bob's clean architecture approach.
  • Android Architecture Blueprints Demonstrate possible ways to help with testing, maintaining and extending of an Android app using different architectural concepts and tools.

License

Copyright 2019 Thomas Kioko

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.