diff --git a/.github/workflows/build-deploy-and-docker-build.yml b/.github/workflows/build-deploy-and-docker-build.yml new file mode 100644 index 00000000..f262179c --- /dev/null +++ b/.github/workflows/build-deploy-and-docker-build.yml @@ -0,0 +1,109 @@ +name: Build, deploy and docker build frontend + +on: + push: + branches: + - '**' + tags-ignore: + - 'v*' + paths: + - 'power-pay-frontend/**' + + pull_request: + branches: + - '**' + paths: + - 'power-pay-frontend/**' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-frontend +jobs: + # Build Job + build: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Install Node + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Install Dependencies + run: cd power-pay-frontend && npm ci + + - name: Build Project + run: cd power-pay-frontend && npm run build-for-gh + + - name: Upload artifact to enable deployment + uses: actions/upload-artifact@v4 + with: + name: production-files + path: power-pay-frontend/dist + + # Deploy Job + deploy: + permissions: + pages: write + contents: write + # Add a dependency to the build job + needs: build + # Specify runner + deployment step + runs-on: ubuntu-latest + steps: + - name: Download artifact + uses: actions/download-artifact@v4 + with: + name: production-files + path: dist + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v3 + if: github.ref == 'refs/heads/main' + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: dist + + + # Docker Build Job + docker-build: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to the Docker registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: string + uses: AsZc/change-string-case-action@v6 + with: + string: ${{ env.IMAGE_NAME }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }} + + - name: Build and push + uses: docker/build-push-action@v4 + if: github.event_name != 'pull_request' + with: + context: ./power-pay-frontend + file: ./power-pay-frontend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/.github/workflows/build-service.yml b/.github/workflows/build-service.yml new file mode 100644 index 00000000..a1dffda4 --- /dev/null +++ b/.github/workflows/build-service.yml @@ -0,0 +1,68 @@ +name: Build Backend + +on: + push: + branches: + - '**' + tags-ignore: + - 'v*' + paths: + - 'power-pay-backend/**' + + pull_request: + branches: + - '**' + paths: + - 'power-pay-backend/**' + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-backend + + +jobs: + build: + + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + + - id: string + uses: ASzc/change-string-case-action@v6 + with: + string: ${{ env.IMAGE_NAME}} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }} + + - name: Build and push image + uses: docker/build-push-action@v5 + if: github.event_name != 'pull_request' + with: + context: ./power-pay-backend + file: ./power-pay-backend/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + + diff --git a/.github/workflows/build-translator.yml b/.github/workflows/build-translator.yml new file mode 100644 index 00000000..2185d7aa --- /dev/null +++ b/.github/workflows/build-translator.yml @@ -0,0 +1,65 @@ +name: Build Translator + +on: + push: + branches: + - '**' + tags-ignore: + - 'v*' + paths: + - 'power-pay-translator/**' + + pull_request: + branches: + - '**' + paths: + - 'power-pay-translator/**' + +env: + CARGO_TERM_COLOR: always + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-translator + +jobs: + build: + + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - name: Build Translator + run: cd power-pay-translator && cargo build --verbose && cargo test --verbose + + + - name: Login to the Docker registry + id: login + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - id: lowercase_image_name + name: Lowercase image name + uses: AsZc/change-string-case-action@v6 + with: + string: ${{ env.IMAGE_NAME }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ steps.lowercase_image_name.outputs.lowercase }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + if: github.event_name != 'pull_request' + with: + context: ./power-pay-translator + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml deleted file mode 100644 index 762d4ffa..00000000 --- a/.github/workflows/maven.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Build Backend - -on: - push: - branches: - - '**' - tags-ignore: - - 'v*' - pull_request: - branches: - - '**' - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - name: Build Backend - run: cd power-pay-backend && mvn package \ No newline at end of file diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml deleted file mode 100644 index 8d0dd6c7..00000000 --- a/.github/workflows/node.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Build NodeJS - -on: - push: - branches: - - '**' - tags-ignore: - - 'v*' - pull_request: - branches: - - '**' - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - - name: Npm install - run: cd power-pay-frontend && npm ci - - name: Build Frontend - run: cd power-pay-frontend && npm run build \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 640d6bd8..00000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Build Translator - -on: - push: - branches: - - '**' - tags-ignore: - - 'v*' - pull_request: - branches: - - '**' - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build Translator - run: cd power-pay-translator && cargo build --verbose && cargo test --verbose \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..478af5a9 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +gis-udm@adorsys.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..1d152c63 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,137 @@ +# Contributing to CONTRIBUTING.md + +First off, thanks for taking the time to contribute! ❤️ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 + +> And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: +> - Star the project +> - Tweet about it +> - Refer this project in your project's readme +> - Mention the project at local meetups and tell your friends/colleagues + + +## Table of Contents + +- [Code of Conduct](#code-of-conduct) +- [I Have a Question](#i-have-a-question) +- [I Want To Contribute](#i-want-to-contribute) +- [Reporting Bugs](#reporting-bugs) +- [Suggesting Enhancements](#suggesting-enhancements) +- [Your First Code Contribution](#your-first-code-contribution) +- [Improving The Documentation](#improving-the-documentation) +- [Styleguides](#styleguides) +- [Commit Messages](#commit-messages) +- [Join The Project Team](#join-the-project-team) + + +## Code of Conduct + +This project and everyone participating in it is governed by the +[CONTRIBUTING.md Code of Conduct](blob/master/CODE_OF_CONDUCT.md). +By participating, you are expected to uphold this code. Please report unacceptable behavior +to <>. + + +## I Have a Question + +> If you want to ask a question, we assume that you have read the available [Documentation](). + +Before you ask a question, it is best to search for existing [Issues](/issues) that might help you. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](/issues/new). +- Provide as much context as you can about what you're running into. +- Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + + + +## I Want To Contribute + +> ### Legal Notice +> When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project license. + +### Reporting Bugs + + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](issues?q=label%3Abug). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Collect information about the bug: +- Stack trace (Traceback) +- OS, Platform and Version (Windows, Linux, macOS, x86, ARM) +- Version of the interpreter, compiler, SDK, runtime environment, package manager, depending on what seems relevant. +- Possibly your input and the output +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + + +#### How Do I Submit a Good Bug Report? + +> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent by email to <>. + + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](/issues/new). (Since we can't be sure at this point whether it is a bug or not, we ask you not to talk about a bug yet and not to label the issue.) +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the *reproduction steps* that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs-repro`. Bugs with the `needs-repro` tag will not be addressed until they are reproduced. +- If the team is able to reproduce the issue, it will be marked `needs-fix`, as well as possibly other tags (such as `critical`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). + + + + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for CONTRIBUTING.md, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation]() carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. + + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. +- **Explain why this enhancement would be useful** to most CONTRIBUTING.md users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + + + +### Your First Code Contribution + + +### Improving The Documentation + + +## Styleguides +### Commit Messages + + +## Join The Project Team + + + +## Attribution +This guide is based on the **contributing.md**. [Make your own](https://contributing.md/)! diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..4e2ca9b4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,374 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/README.md b/README.md index a37bb313..87eee428 100644 --- a/README.md +++ b/README.md @@ -1 +1,115 @@ -# e2e-banking-app \ No newline at end of file +## WorkFlow Status + +[![Build, deploy and docker build frontend](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-deploy-and-docker-build.yml/badge.svg)](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-deploy-and-docker-build.yml) + +[![Build Translator](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-translator.yml/badge.svg)](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-translator.yml) + +[![Build Backend](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-service.yml/badge.svg)](https://github.com/ADORSYS-GIS/e2e-banking-app/actions/workflows/build-service.yml) + +# e2e-banking-app +Welcome to the e2e-banking-app project! This repository contains the code for the end-to-end banking application. + +## Prerequisites + +Before getting started, make sure you have the following tools installed: + +- [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm): To manage Node.js versions. +- [Node.js](https://nodejs.org/): Javascript runtime environment. +- - [npm](https://www.npmjs.com/): Package manager for Node.js. +- - [sdkman](https://sdkman.io/): Software Development Kit Manager. +- [Java](https://www.java.com/): Programming Language and runtime environment. +- [Maven](https://maven.apache.org/): Build automation and dependency management tool. +- [cargo](https://doc.rust-lang.org/cargo/): Package manager for Rust. + +## Installation + +Follow the steps below to set up the local environment: + +1. Install nvm: + - Visit the nvm Github repository: (https://github.com/nvm-sh/nvm) + - Follow the installation instructions for your operating system. + +2. Install Node.js and npm using nvm: + ```bash + nvm install node + ``` + +3. Install sdkman: + - Visit the sdkman website: https://sdkman.io/ + - Follow the installation instructions for your operating system. + +4. Install Java and Maven using sdkman: + ```bash + sdk install java + sdk install maven + ``` + +5. Install cargo: + - Visit the cargo website: https://www.rust-lang.org/tools/install + - Follow the installation instructions. + +# Getting Started + +To run the e2e-banking-app project locally, follow these steps: + +1. Clone the repository: + ```bash + git clone https://github.com/ADORSYS-GIS/e2e-banking-app.git + ``` + +2. Change to the project directory: + ```bash + cd e2e-banking-app + ``` + +3. Install project dependencies and Start application: + + a. For power-pay-front-end: + - Change to the project directory: + ```bash + cd power-pay-frontend + ``` + - Install dependencies: + ```bash + npm install + ``` + - Build the project: + ```bash + npm run build + ``` + - Start application: + ```bash + npm start + ``` + + b. For power-pay-backend: + - Change to the project directory: + ```bash + cd power-pay-backend + ``` + - Install dependencies: + ```bash + mvn install + ``` + - Build the project: + ```bash + mvn clean package + ``` + - Start application: + ```bash + java -jar target/power-pay-backend-0.0.1-SNAPSHOT.jar + ``` + + c. For power-pay-translator: + - Change to the project directory: + ```bash + cd power-pay-translator + ``` + - Build the project: + ```bash + cargo build + ``` + - Start application: + ```bash + cargo run + ``` \ No newline at end of file diff --git a/docs/App_compatibility.md b/docs/App_compatibility.md new file mode 100644 index 00000000..dde7a06e --- /dev/null +++ b/docs/App_compatibility.md @@ -0,0 +1,89 @@ +## Description + + As part of our efforts to improve user experience and engagement, we are looking to investigate and implement Progressive Web App (PWA) features within our React application. + So in order for our PWA to be effective and efficient, we have to make sure it is compatible with any system and devices to improve user experience. To perform this we need to investigate on the compatibility criteria’s inorder to Assess our current React app's architecture and identify changes needed to support PWA features. + +## On what devices can a PWA run ? + +Progressive Web Apps (PWAs) can run on a variety of devices, including: + +1. Desktop computers: PWAs are supported on major web browsers like Chrome, Safari, and Edge on desktop operating systems such as Windows, macOS, and Linux. + +2. Mobile devices: PWAs work on both Android and iOS devices. On Android, PWAs can be installed and run like native apps from the home screen, while on iOS, they can be added to the home screen and launched in standalone mode. + +3. Tablets: PWAs can be used on various tablet devices, including iPads, Android tablets, and Windows tablets. + + +## Compatibility Criteria + +The compatibility criteria for Progressive Web Apps (PWAs) ensure that they function effectively across various devices, browsers, and platforms. So in order for our PWA to be compatible with different system, we have to consider the following criteria's; + +1. **Cross-Browser Compatibility:** + + PWAs should work consistently across different web browsers, including Google Chrome, Mozilla Firefox, Apple Safari, Microsoft Edge, and others. Test your PWA on multiple browsers to ensure compatibility and consistent behaviour. +2. **Cross-Device Compatibility:** + + PWAs should be compatible with different types of devices, including desktop computers, smartphones, tablets, and other internet-enabled devices. Ensure that your PWA is responsive and adapts seamlessly to various screen sizes, resolutions, and orientations. +3. **Operating System Compatibility:** + + PWAs should be compatible with different operating systems, including Windows, macOS, Linux, iOS, and Android. Test your PWA on different operating systems to ensure that it works as expected and provides a consistent user experience across platforms. +4. **Feature Compatibility:** + + PWAs should be compatible with a wide range of web features and APIs, including service workers, web app manifest, push notifications, and others. Ensure that your PWA gracefully handles situations where certain features are not supported by the user's device or browser. +5. **Performance Compatibility:** + + PWAs should perform well on devices with varying hardware capabilities, network conditions, and resource constraints. Optimize your PWA for fast loading times, smooth navigation, and efficient use of system resources to provide a responsive and snappy user experience. +6. **Security Compatibility:** + + PWAs should adhere to best practices for web security and privacy to protect user data and ensure a secure browsing experience. Serve your PWA over HTTPS to encrypt data transmitted between the user's device and the server, and implement security features such as Content Security Policy (CSP) to mitigate common security risks. + +## So in order for Our PWA to be compatible with diverse systems we have to implement the following in our react architecture + +1. **Service Worker:** + - Service workers are JavaScript files that act as intermediaries between the PWA and the network. + - They run separately from the main browser thread and have the ability to intercept and handle network requests made by the PWA. + - Service workers enable important PWA features such as offline functionality, by allowing the caching of assets and resources locally on the user's device. + - They also enable other advanced features like push notifications, background synchronisation, and intercepting requests to provide customised responses, which enhance the overall user experience. + - Service workers are essential for making PWAs feel more like native apps by allowing them to work reliably even when the user is offline or on a slow or unreliable network connection. +2. **Web App Manifest:** + - The web app manifest is a JSON file (usually named manifest.json) that provides metadata about the PWA to the browser. + - It includes information such as the PWA's name, description, icon, theme colors, and other properties. + - The manifest file enables the browser to understand that the website is a PWA and provides instructions on how the PWA should behave when installed on the user's device. + - For example, it specifies the PWA's display mode (e.g., fullscreen, standalone) and whether it should appear in the user's home screen or app drawer. + - The web app manifest is crucial for enhancing the discoverability and accessibility of the PWA and providing users with a native app-like experience. +3. **HTTPS (Secure Origin):** + - PWAs must be served over HTTPS (Hypertext Transfer Protocol Secure) to ensure the security and integrity of data transmitted between the PWA and the server. + - HTTPS encrypts the data exchanged between the user's device and the server, protecting it from unauthorised access or tampering by malicious actors. + - Serving the PWA over HTTPS is essential for protecting user privacy and sensitive information, such as login credentials, payment details, and personal data. + - Additionally, certain PWA features, such as service workers and push notifications, require a secure origin (HTTPS) to function properly. + - Ensuring that the PWA is served over HTTPS is a critical security measure and a prerequisite for enabling advanced PWA features and capabilities. + +## Limitations of PWA + +Despite the benefits of PWAs, they do have some limitations. + +- **Limited Browser Support** + + While PWAs are designed to be cross-platform, some browsers such as Safari and Edge may not provide optimal support for PWAs. This can result in inconsistent behaviour or limited functionality when accessing PWAs on these browsers. Efforts of improving browser support for PWAs are still underway. + +- **Performance on Older Devices** + + PWAs may not be compatible with older devices running outdated browsers. This can limit the accessibility and usage of PWAs for users who have not upgraded their devices or browsers to more recent versions. + +- **Offline Limitations** + + PWAs can work offline to some extent by utilizing service workers and caching strategies. However, their offline capabilities may not be as robust as native apps that can store and process data locally. PWAs may have limitations in terms of offline functionality and synchronization when compared to fully native solutions. + +- **Limited Native Functionality** + + PWAs may not have access to all native device features and APIs that native apps do. For example, accessing certain hardware components like the camera, fingerprint sensor, or Bluetooth may be restricted or unavailable in PWAs. + +- **Storage Limitations** + + PWAs typically have limited storage capabilities compared to native apps, especially on mobile devices. This may impact the ability to store large amounts of data locally or provide extensive offline functionality. + +- **Less Discoverability** + + Since PWAs are primarily distributed through web channels rather than app stores, they may be less discoverable to users who are not actively searching for them. We may need to invest in marketing and promotion to increase visibility and adoption of our PWA. + + diff --git a/docs/PWA_requirements_guide.md b/docs/PWA_requirements_guide.md new file mode 100644 index 00000000..4e9fbb3a --- /dev/null +++ b/docs/PWA_requirements_guide.md @@ -0,0 +1,154 @@ +# Description + +As part of our efforts to improve user experience and engagement, we are looking to investigate and implement Progressive Web App (PWA) features within our React application. + +This includes setting up offline capabilities, and ensuring the app is installable on users' home screens across different platforms. The goal is to enhance app performance, reliability, and accessibility, aligning with PWA best practices and taking into consideration limitations. + +# What is a PWA ? + +A PWA (Progressive Web Application) is an app, that’s built using web platform technologies, but that provides a user experience like that of an app. Like a website, PWAs can run and can be installed on multiple platforms and devices from a single codebase. + +Like a platform-specific app, it can be installed on a device, can operate while offline and in the background, and can integrate with the device and other installed apps. + +PWAs are deployed using Standard Web Platform Technologies , so they can run on multiple Operating Systems and device classes from a single codebase. + +# How it functions + +Progressive Web Apps (PWAs) function by leveraging modern web technologies to deliver a fast, reliable, and engaging user experience similar to that of native apps. Here's how PWAs work: + +1. Initial Loading and Installation: + +When a user first accesses a PWA, the necessary resources (HTML, CSS, JavaScript) are fetched from the server and loaded into the browser. If the PWA meets certain criteria (e.g., served over HTTPS, has a web app manifest), the browser may prompt the user to install the app to their device's home screen or app drawer. + +2. Service Worker Installation: + +As part of the initial loading process, a service worker is registered in the background. The service worker is a JavaScript file that runs separately from the main browser thread and intercepts network requests made by the PWA. + +3. Caching of Resources: + +The service worker caches essential resources, such as HTML, CSS, JavaScript, and media files, locally on the user's device. This allows the PWA to load quickly and provide a smooth user experience, even when the user is offline or on a slow or unreliable network connection. + +4. Offline Functionality: + +When the user is offline, the service worker serves cached resources from the device's storage rather than fetching them from the server. This enables the PWA to continue functioning, even when there is no internet connection. + +5. Data Fetching: + +When the user interacts with the PWA, such as submitting a form or requesting new content, the PWA sends a network request to the server to fetch the necessary data. If the user is offline, the service worker may intercept the request and serve cached data instead. + +6. Syncing Data: + +If the user performs actions while offline, such as submitting a form or making changes to data, the PWA can queue these actions and sync them with the server once the user is back online. This is achieved using background sync, a feature provided by service workers. + +7. Online Functionality: + +When the user is online, the PWA fetches data from the server as usual, providing real-time updates and ensuring that the user has access to the latest content and features. + +# What are PWA requirements + +The three main requirements of a Progressive Web App (PWA) are: + +1. Service Worker: + +Service workers are JavaScript files that run in the background and intercept network requests made by the PWA. They enable features such as offline functionality, push notifications, and caching of assets, allowing the PWA to work reliably even with a limited internet connection. + +2. Web App Manifest: + +The web app manifest is a JSON file (manifest.json) that provides metadata about the PWA, such as its name, description, icon, and theme colors. The manifest file enables the browser to understand that the website is a PWA and allows users to install the app to their home screen or app drawer, providing a native app-like experience. + +3. HTTPS (Secure Origin): + +PWAs must be served over HTTPS to ensure the security and integrity of data transmitted between the app and the server. Serving your PWA over HTTPS is essential for protecting user privacy and sensitive information, as well as for enabling certain PWA features such as service workers and push notifications. + +# How does the PWA help our system for Real + +- Increased Reach: + +PWAs are optimized for performance, with fast loading times. By leveraging caching techniques and minimizing network requests which gives a positive user experience, even on slow or unreliable networks. + +- Offline Functionality: + +PWAs can work offline or with a limited internet connection, allowing users to access content and features even when they are offline. This offline functionality improves accessibility and ensures that users can engage with our app regardless of their network status. + +- Reduced Development Costs: + +PWAs use standard web technologies and can be built using existing web development frameworks and tools. This reduces development costs and complexity compared to building separate native apps for different platforms. + +- Lower Maintenance Costs: + +PWAs are easier to maintain and update compared to native apps, as changes can be made to the web application codebase and deployed instantly to all users. Also if you have to always pay the deployment cost for you native app that are stored on app stores, it will be very costly. + +- Push Notifications: + +PWAs can send push notifications to users even when the app is not actively in use. This can be used to notify users about new features, promotions, or important updates, keeping them engaged with the app. + +# Best Practices of PWAs + +Implementing a Progressive Web App (PWA) involves several best practices to ensure optimal performance, user experience, and functionality across various devices and platforms. Below are some best practices to implement in order to ensure optimisation…. + +- Adapt to all Browsers & Devices + + Our PWA is based on web technologies meaning that, on top of being installable on devices, PWAs can run in web browsers too. To ensure compatibility, it’s essential to test our app across various browsers, phones and operating systems. + + We also ensure users can interact with our app, no matter how they access our content. (We should make sure our apps content can be assessed through any inputs). + +- Provide an Offline Experience + + In our case, our PWA should function even when the user is offline. Means we can continue using all our app’s functionalities even when offline. In such a way that it doesn’t restrict our user to have internet connection. + +- Make it Fast + + The speed at which our app loads and performs it’s core functions plays a role in user engagement and relation (The more time it takes to load, the poor the user experience). + + This is because different users have different expectations for installed apps compared to websites. They expect them to be fast and responsive. + +- Make it Accessible + + Accessibility is crucial to ensure everyone can use our app, regardless of an individuals abilities or the device they use to access it. It is also required by law, and ensures that as many people as possible use our app. + +- Provide an App-like Experience + + - Integrate with the Operating System + + Users expect installed PWAs to behave like an installed platform-specific app. We should integrate our app with the Operating System such that it can send Push Notifications to the user’s device. + + - App Look and Feel + + Design your PWA to provide an app-like experience, including smooth transitions, gestures, and navigation patterns. Use progressive enhancement techniques to enhance functionality based on the capabilities of the user's device and browser. + +- Installability + +Make your PWA installable by adding a web app manifest file (manifest.json) and a service worker to enable offline functionality. Ensure that users can easily install your PWA on +their device's home screen or app drawer for quick access. + +- Security + +Security is a critical best practice for Progressive Web Apps (PWAs) to ensure the protection of user data and maintain a trustworthy user experience, such as User Privacy, Authentication and Authorisation. + +# Limitations of PWA + +Despite the best practices of PWAs, they do have some limitations. + +- Limited Browser Support + + While PWAs are designed to be cross-platform, some browsers such as Safari and Edge may not provide optimal support for PWAs. This can result in inconsistent behaviour or limited functionality when accessing PWAs on these browsers. Efforts of improving browser support for PWAs are still underway. + +- Performance on Older Devices + + PWAs may not be compatible with older devices running outdated browsers. This can limit the accessibility and usage of PWAs for users who have not upgraded their devices or browsers to more recent versions. + +- Offline Limitations + + PWAs can work offline to some extent by utilizing service workers and caching strategies. However, their offline capabilities may not be as robust as native apps that can store and process data locally. PWAs may have limitations in terms of offline functionality and synchronization when compared to fully native solutions. + +- Limited Native Functionality + + PWAs may not have access to all native device features and APIs that native apps do. For example, accessing certain hardware components like the camera, fingerprint sensor, or Bluetooth may be restricted or unavailable in PWAs. + +- Storage Limitations + + PWAs typically have limited storage capabilities compared to native apps, especially on mobile devices. This may impact the ability to store large amounts of data locally or provide extensive offline functionality. + +- Less Discoverability + + Since PWAs are primarily distributed through web channels rather than app stores, they may be less discoverable to users who are not actively searching for them. We may need to invest in marketing and promotion to increase visibility and adoption of our PWA. \ No newline at end of file diff --git a/docs/Rocket-server.md b/docs/Rocket-server.md new file mode 100644 index 00000000..26ae53c0 --- /dev/null +++ b/docs/Rocket-server.md @@ -0,0 +1,40 @@ + +Rust Rocket Server with Serde Integration + +Overview: +This Rust project integrates a base server using the Rocket framework and implements support for serialization and deserialization with Serde, serde_json, and serde_derive. The primary objective is to establish a robust backend foundation for efficient data handling. + +Setup: + + Dependencies: + Ensure Rocket, serde, serde_json, and serde_derive are added to the Cargo.toml file. + + Configuration: + Create a main.rs file and set up a basic Rocket server to handle incoming HTTP requests. + Implement an index endpoint for testing purposes. + + Serialization and Deserialization: + Serde is utilized for seamless data exchange between the server and clients. No additional setup is required. + + Docker Configuration: + Update the Dockerfile to expose the server port (e.g., EXPOSE 8000). + +Usage: + + Building the Server: + Run cargo build to compile the Rust project. + + Running the Server: + Execute cargo run to start the Rocket server. + + Interacting with Endpoints: + Access the server endpoints via HTTP requests (e.g., http://localhost:8000). + +Example: + + Upon running the server, navigate to http://localhost:8000 in your web browser to view the "Welcome to Power Pay App!" message. + +NB: + + Ensure that Docker is installed and running to utilize the Dockerfile configuration. + \ No newline at end of file diff --git a/docs/Setup-build-and-push-docker-images.md b/docs/Setup-build-and-push-docker-images.md new file mode 100644 index 00000000..756db495 --- /dev/null +++ b/docs/Setup-build-and-push-docker-images.md @@ -0,0 +1,37 @@ +# Building and Uploading Docker Images to ghcr.io using Github Action +This document outlines the steps to build a Docker image and upload it to ghcr.io using a Github Action. The process involves building the frontend, backend and using a translator service to communicate with them. + +## About Github Actions +Github Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and publish docker images on the ghcr.io, test every pull request to your directory. For a deeper understanding you can see [Learn Github Actions](https://docs.github.com/en/actions/learn-github-actions) + +## Prerequisites +- A Github repository for each sub-project with a Dockerfile. +- A personal access token (PAT) with write:packages scope. You can create a PAT by following these steps: [Github Docs ](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) + +### Step 1. +- Create new files named: + .github/workflows/maven.yml, + .github/workflows/node.yml, and + .github/workflows/rust.yml + in the main project directory for the backend, frontend and translator respectively. + + ### Step 2. + - In the above created files, define the Github Action workflow for each. + + ### Step 3. +- Save the various .yml files. + +### Step 4. +- Commit and push the changes to your repository. + +### Step 5. +- Github Action will automatically trigger the workflow defined in the above files whenever pushed to the mentioned branch. + +### Step 6. +- The workflow will build the frontend, backend and translator Docker images using their respective Dockerfiles and push them to ghcr.io using the provided credentials. + +### Step 7. +- You can access the Docker images on ghcr.io at ghcr.io///:, where is your GitHub username or organization, is the name of your repository, is the name of the Docker image(frontend, backend or translator) and is the SHA of the commit. + +### Step 8. +- Make sure to update your deployment or other relevant scripts to use the newly built Docker images from ghcr.io. \ No newline at end of file diff --git a/docs/Translational-service-backend.md b/docs/Translational-service-backend.md new file mode 100644 index 00000000..6a31fb81 --- /dev/null +++ b/docs/Translational-service-backend.md @@ -0,0 +1,208 @@ +## Table of Contents + +1. [PowerPay Translator](#powerpay-translator) +2. [Translation Service Backend](#translation-service-backend) + - [Components](#components) + - [Interactions](#interactions) + - [Technology](#technology) + - [Architecture](#architecture) + - [Integration with PowerPay Service](#integration-with-powerpay-service) + - [Error Handling](#error-handling) + - [Deployment](#deployment) + - [Monitoring and Logging](#monitoring-and-logging) + - [Concrete interactions between different components](#concrete-interactions-between-different-components) +3. [Defining between component API](#defining-between-component-api) + - [Twilio SMS Gateway API](#twilio-sms-gateway-api) + - [Translation Service API](#translation-service-api) + - [PowerPay Service API](#powerpay-service-api) +4. [Conclusion](#conclusion) + + + +# PowerPay Translator + +This service in the microservice architecture should get messages from the SMS gateway and send to the P.P.Service. + +# Translation Service Backend + +The Translation Service backend is a microservice in the PowerPay system that handles messages received from the SMS gateway and forwards them to the PowerPay Service. The Translation Service backend is responsible for: + +Receiving messages from the SMS gateway +Parsing and validating the messages +Forwarding the messages to the PowerPay Service +Handling errors and retries +Logging and monitoring +Receives requests from the P.P.Service to send someone an SMS + +Responds to users who send an SMS or sends someone OTP for login + +The system uses REST APIs for communication between components. The Rust application can be managed using tools like cargo (Rust's package manager) and rustfmt (for code formatting). To secure the APIs, you can use solutions like OAuth, JWT, or other authentication and authorization mechanisms. +For deployment, the application is packaged as a Docker container and deployed using a Docker Compose file to a cloud platform like GCP or AWS. Logging for the Rust app can be implemented using libraries like log and env_logger. + +For continuous integration and delivery, you we use GitHub Actions or other CI/CD tools to automate the build, test, and deployment process + + +# Components + +The Translation Service backend consists of the following components: + +### SMS Gateway : + + A third-party service that sends SMS messages to the Translation Service backend. + +### Translation Service: + + A Rust-based microservice that receives messages from the Twilio SMS gateway, parses and validates the messages, and forwards them to the PowerPay Service. +### PowerPay Service: + + + +# Interactions + +The Translation Service backend interacts with the following components: + +### SMS Gateway: + The Translation Service backend receives messages from the Twilio SMS gateway using the Twilio API. + +### PowerPay Service: + + The Translation Service backend forwards messages to the PowerPay Service using the PowerPay API. + + +# Technology + +The Translation Service backend is built using the following technology: + +### Rust: + + A performant, reliable, and secure programming language for the backend. +### Twilio API: + + A third-party API for sending and receiving SMS messages. +### PowerPay API: + + A custom API for processing messages and performing operations in the PowerPay system. + + + +# Architecture + +The architecture of the Translation Service backend consists of the following components: + +## API Gateway: + + Receives requests from external clients and forwards them to the Translation Service backend. +## Translation Service Backend: + + Processes requests, performs translation where necessary, and forwards them to the PowerPay service. +## PowerPay Service: + + Receives translated requests from the Translation Service backend and processes them accordingly. +The Translation Service backend acts as an intermediary between the API gateway and the PowerPay service, ensuring seamless communication by translating data as required. + + + +# Integration with PowerPay Service + +The Translation Service backend integrates with the PowerPay service through a series of API calls. It forwards translated requests to the appropriate endpoints within the PowerPay service, ensuring that translated data is seamlessly transmitted and processed. + + + +# Error Handling +The Translation Service backend includes robust error handling mechanisms to address any issues that may arise during translation or communication with the PowerPay service. This includes: + +### Error Detection: + + Identifying errors during translation or data transmission. +Error Reporting: Logging errors and notifying relevant stakeholders for resolution. +Fallback Mechanisms: Implementing fallback mechanisms to handle errors gracefully and maintain system stability. + + + + + +# Deployment + +The Translation Service backend is deployed to a cloud platform, such as GCP or AWS, for high availability and scalability. The backend is packaged as a Docker container and deployed using a Docker Compose file. The container includes all the necessary dependencies and configurations for the backend to run. + +# Monitoring and Logging + +The Translation Service backend includes monitoring and logging capabilities to ensure that the system is operating correctly and to diagnose and troubleshoot issues. The backend logs all requests, responses, and errors, and sends the logs to a centralized logging service for analysis and alerting. The backend also includes metrics and monitoring capabilities to track the performance and health of the system. + + +# Concrete interactions between different components + +The Translation Service backend interacts with the following components: + +SMS Gateway: The Translation Service backend receives messages from the Twilio SMS gateway using the Twilio API detailed description cam be found here on using twilio API'S + +https://www.twilio.com/docs/messaging/api#send-messages + + +. When a message is received, the Translation Service extracts the necessary information, such as the sender's phone number, the recipient's phone number, and the message content. The Translation Service then validates the message and forwards it to the PowerPay Service for further processing. +PowerPay Service: The Translation Service forwards messages to the PowerPay Service using the PowerPay API. The PowerPay Service processes the message and performs the necessary operations, such as sending money, registering users, and checking balances. Once the operation is complete, the PowerPay Service sends a response back to the Translation Service, which then forwards the response to the Twilio SMS gateway to be sent back to the user as an SMS message. +Database: The Translation Service and PowerPay Service both read and write data to the database as needed. The database stores all the necessary information for the system to operate, such as user data, transaction history, and account balances. The Translation Service and PowerPay Service use the database to persist data and to query for information that is needed to process messages and perform operations. + +These interactions are illustrated in the following diagram: + +```mermaid +sequenceDiagram +participant SMS Gateway as SMS Gateway + participant Translation Service Backend as Translation Service Backend +participant PowerPay Service as PowerPay Service + + SMS Gateway ->>Translation Service Backend: / handle_message + +Translation Service Backend->>PowerPay Service: POST / api / send_money + +PowerPay Service-->>Translation Service Backend: POST /send_sms (OTP) +PowerPay Service-->>PowerPay Service: verification + + +Translation Service Backend-->> SMS Gateway: sms containing otp +SMS Gateway->PowerPay Service: balance checking + SMS Gateway ->>Translation Service Backend: / handle_message +Translation Service Backend->>PowerPay Service: GET / api / balance +PowerPay Service-->>PowerPay Service: verification + +PowerPay Service-->>Translation Service Backend: GET /send_sms + +Translation Service Backend-->> SMS Gateway: sms containing balance +``` + +# Defining between component API + +SMS Gateway API + +The SMS Gateway API is a third-party API that is used to send and receive SMS messages. The Translation Service backend uses the API to receive messages from the Twilio SMS Gateway. + + you can refare this url for more information on the implementation. +https://www.twilio.com/docs/glossary/what-is-sms-api-short-messaging-service + + + +### Translation Service API +The Translation Service API is a custom API that is used to receive messages from the SMS Gateway, parse and validate the messages, and forward them to the PowerPay Service. The Translation Service API is implemented as a Rust-based microservice. + + +PowerPay Service API +The PowerPay Service API is a custom API that is used to process messages and perform the necessary operations, such as sending money, registering users, and checking balances. The PowerPay Service API is implemented as a microservice. + + +The Table below summarizes the operations on the API endpoints for the Translation Service backend: + +| Endpoint | Method |Description | +|-----------------|-----------------|-----------------| +| /handle_messages | POST |Receive a message from the SMS Gateway, parse and validate it, and forward it to the PowerPay Service. The request body should contain the following fields: sender (the phone number of the sender), recipient (the phone number of the recipient), and content (the content of the message). +| /send_sms | GET |The PowerPay Service will process the check balance and send a response back to the /send_sms endpoint of the Translation Service such as the OTP , which will then forward the response to the SMS gateway to be sent back to the user as an SMS message. + + + +# Conclusion + +The Translation Service backend is a critical component in the PowerPay system that enables users to send and receive money, register with the system, and check their balances. The backend is built using Rust and interact with the SMS gateway, the PowerPay Service, and the cloud-native database. The backend is deployed to a cloud platform for high availability and scalability, and includes monitoring and logging capabilities to ensure that the system is operating correctly. +n summary, the Translation Service backend consists of three main components: the SMS Gateway, the Translation Service, and the PowerPay Service. The SMS Gateway sends SMS messages to the Translation Service, which then parses and validates the messages and forwards them to the PowerPay Service. The PowerPay Service processes the messages and sends a response back to the Translation Service, which then forwards the response to the SMS gateway to be sent back to the user as an SMS message. + +The Translation Service API and the PowerPay Service API are both custom APIs that are used to facilitate communication between the components. The Translation Service API is used to receive messages from the Twilio SMS Gateway, and the PowerPay Service API is used to process the messages and perform the necessary operations. + +For more information on the specific endpoints and their input formats, please refer to the Twilio SMS Gateway API documentation, the Translation Service API documentation, and the PowerPay Service API documentation. diff --git a/docs/backend_guide.md b/docs/backend_guide.md new file mode 100644 index 00000000..9f684bd8 --- /dev/null +++ b/docs/backend_guide.md @@ -0,0 +1,420 @@ +# Project Overview + +The Power Payment Backend is a cutting-edge system designed to facilitate seamless money transfers between users. + +By offering robust security measures and scalability, the project aims to provide a hassle-free experience for users when transferring funds. The system is designed to handle a growing user base and high transaction volumes. + +With its advanced technology stack and meticulous attention to detail, the Power Payment Backend sets out to meet the needs of users who value simplicity, speed, and security in their financial transactions. It serves as a reliable and efficient backend infrastructure for facilitating electronic money transfers. + + +# Architecture and Technologies + +The backend architecture consists of several key components, including the Power Payment Service, SMS Gateway, Power Payment App, and a scalable and secure database. In the following sections, we will provide detailed explanations of each of these components. + +``` mermaid +graph TB + +A[Power Pay Store App] --> |Trigger Topup| B[Power Pay Service, SMS Gateway] +B --> C[Database] +D[Power Pay Payment, Power Pay Store, Power Pay Website] --> A +D --> |OAuth| E[Power Pay Payment App] +E --> |https requests| B +B --> |Notification| F[Cloud Messaging] +F --> E +G[Tchoronko] --> |Auth Service| H[Telecom Provider] +H --> B +H --> |SMS| G +``` + +# System Components + +1. Power Pay Service: + +This is the core of the backend which intelligently processes all requests and orchestrates the system's intricate logic. This service intuitively interacts with other components ensuring smooth and reliable communication channels. + +2. Database: + +The database acts as the robust repository for user data, transaction history, and account balances. Meticulously designed, the database schema ensures optimum data integrity, security, and scalability, enabling efficient storage and retrieval of critical information. + +# Technologies and tools used for backend + +1. GCP/AWS (Cloud Deployment): + +* The Power Payment Backend can be deployed on cloud platforms such as Google Cloud Platform (GCP) or Amazon Web Services (AWS). +* These cloud platforms provide infrastructure services that enable easy provisioning, scaling, and management of the backend application. +* The backend can be deployed using cloud-native technologies like Kubernetes or serverless computing to ensure high availability, scalability, and fault tolerance. + +2. Database (Cloud Native for database component): + +* The database component of the Power Payment Backend can be implemented using a cloud-native database service. +* For example, on GCP, you can use Cloud Spanner, Cloud SQL, or Firestore. On AWS, you can use Amazon RDS, Amazon DynamoDB, or Amazon Aurora. +* These cloud-native databases offer managed services that handle scalability, replication, backups, and security, allowing the backend to leverage the benefits of cloud computing. + +3. Java (Spring Boot for Power Pay Service): + +* The Power Pay Service can be developed using Java and the Spring Boot framework. +* Spring Boot provides a simplified way to build Java applications by handling common configurations and dependencies. +* With Spring Boot, you can create RESTful APIs, handle request processing, and implement business logic for the Power Payment Backend. +* Java's robustness, scalability, and extensive ecosystem make it a suitable choice for developing the backend service. + +# API Documentation + +The Power Payment Backend exposes various APIs with the following endpoints: + +- POST /api/users: Create a new user account. Request body should include user details. +- POST /api/transaction: Initiate a money transfer between users. Request body should include transfer details. +- GET /api/balance/{userId}: Get the balance details of a specific user by their ID. + +For each endpoint, provide examples of requests and responses along with the expected request and response formats. + +# Status codes to be used + +- 200 OK: + +This status code indicates a successful request. It is typically returned when the API operation was completed successfully, and the requested data or action was processed without any issues. + +- 201 Created: + +This status code is returned when a new resource has been successfully created. It is commonly used in scenarios where a POST request is made to create a new entity, and the creation process is successful. + +- 400 Bad Request: + +This status code indicates that the server cannot process the request due to client error. It is typically returned when the request is malformed, missing required parameters, or contains invalid data. The accompanying error message or response body should provide more details about the specific issue. + +- 401 Unauthorized: + +This status code indicates that the request requires authentication or authorization credentials. It is commonly used when the client is not authenticated or does not have sufficient privileges to access the requested resource. The client may need to provide valid credentials or obtain appropriate permissions to proceed. + +- 403 Forbidden: + +This status code is similar to 401, but it specifically indicates that the client does not have permission to access the requested resource, regardless of authentication status. It is commonly used when the server understands the request but refuses to fulfill it due to access restrictions. + +- 404 Not Found: + +This status code indicates that the requested resource could not be found on the server. It is commonly used when the server cannot locate the requested endpoint or resource. This could be due to a mistyped URL, a deleted resource, or a non-existent resource identifier. + +- 500 Internal Server Error: + +This status code indicates that an unexpected error occurred on the server while processing the request. It is commonly used as a generic response for any unhandled or unexpected server-side errors. The accompanying error message or response body should provide more details about the specific error. + +# Database Schema + +The provided Entity Relationship Diagram (ERD) depicts the data model for the Power Pay system. It showcases the relationships between different entities within the system. Here's a concise explanation of the ERD: + +``` mermaid +--- +title: Power Pay Entity Relationship Diagram +--- +erDiagram + +Users ||--o{ Transactions : "SenderUserID" +Users ||--|| OTP : "userId" +Users ||--o{ UserContacts : "userId" +Users }|--o{ Transactions : "RecipientUserID" +Users ||--|| Kiosk : "userId" +Users ||--|| Store : "userId" + +Users{ + int userId pk + String phoneNumber + String PIN + String balance +} + +Transactions{ + int transactionId pk + Double amount + String status +} + +OTP{ + int otpId pk + String optValue + Date expirationDate +} + +UserContacts{ + int contactId pk + String contactName +} + +Kiosk{ + int kioskId pk + String location + String balance +} + +Store{ + int storeId pk + String location + String balance +} +``` + +1. Users: + +This entity represents the users of the Power Pay system. It includes attributes such as userId (primary key), phoneNumber, PIN, and balance. + +2. Transactions: + +This entity captures the transactions made within the Power Pay system. It includes attributes such as transactionId (primary key), amount, and status. The relationship between Users and Transactions indicates that a user can initiate multiple transactions as a sender (SenderUserID) and receive multiple transactions as a recipient (RecipientUserID). + +3. OTP: + +This entity represents the One-Time Passwords used for authentication. It includes attributes such as otpId (primary key), otpValue, and expirationDate. The relationship between Users and OTP indicates that a user can have just one OTP associated with their account. + +4. UserContacts: + +This entity stores the contacts of a user. It includes attributes such as contactId (primary key) and contactName. The relationship between Users and UserContacts indicates that a user can have multiple contacts in their address book. + +5. Kiosk: + +This entity represents the kiosks within the Power Pay system. It includes attributes such as kioskId (primary key), location, and balance. The relationship between Users and Kiosk indicates that a user can be associated to a single kiosk. + +6. Store: + +This entity represents the stores within the Power Pay system. It includes attributes such as storeId (primary key), location, and balance. The relationship between Users and Store indicates that a user can be associated to a single store. + +# Logical Model + +A logical model abstracts away the technical implementation aspects and focuses on the conceptual understanding of the system. It helps in understanding the data requirements, relationships between entities, and the constraints that govern the data. This model serves as a blueprint for database design and forms the basis for translating the logical model into a physical model, which deals with implementation-specific details such as storage formats, indexing, and performance optimization. The logical model of the Power Pay is as follows: + +- Users (userId [PK], phoneNumber, PIN, balance) +- Transactions (transactionId [PK], amount, status, SenderUserID [FK], RecipientUserID [FK]) +- OTP (otpId [PK], otpValue, expirationDate, userId [FK]) +- UserContacts (contactId [PK], contactName, userId [FK]) +- Kiosk (kioskId [PK], location, balance, userId [FK]) +- Store (storeId [PK], location, balance, userId [FK]) + +Note: +- [PK] : Primary Key +- [FK] : Foreign Key + +# Authentication Process + +The Power Payment system employs specific mechanisms and workflows for authenticating smartphone and Choronko users in the backend. This section outlines the authentication procedures while addressing security concerns and the integrity of the translator service. + +1. Smartphone User Authentication: + +For smartphone user authentication, the following steps are followed: + +a. User Registration: + +- During the registration process, smartphone users provide their phone numbers, which are stored in the user database. +- To ensure authentication requests originate from our system, we will implement IP filtering and domain whitelisting, allowing requests only from our specific domain. + +b. OTP Generation and Delivery: + +- Upon successful registration, the backend generates a One-Time Password (OTP) and sends it to the user's phone number via SMS. +- To ensure the security of OTP delivery, we will integrate with a trusted SMS gateway or service provider that follows industry-standard encryption protocols. + +c. OTP Verification: + +- The backend validates the OTP entered by the user against the one stored in the database. +- To ensure the integrity of the OTP verification process, we will implement measures such as rate limiting and session management to prevent unauthorized access and protect against brute-force attacks. + +d. PIN Setup: + +- After successful OTP verification, the user is prompted to set a Personal Identification Number (PIN) for subsequent authentication. +- The user's PIN will be securely stored in the user database using strong cryptographic hashing algorithms like bcrypt or Argon2, along with salting techniques to prevent unauthorized access. + +2. Choronko User Authentication: + +For Choronko user authentication, the following steps are undertaken: + +a. SMS Gateway Integration: + +- The backend integrates with an SMS gateway to receive and interpret messages sent by Choronko users. +- To ensure the authenticity and integrity of the SMS gateway, we will implement security measures such as encryption, secure API endpoints, and mutual authentication using secure tokens or certificates. + +b. Syntax Interpretation: + +- The SMS gateway extracts the phone number and PIN from the incoming message using the specified syntax, such as numberpin#. +- We will implement robust parsing and validation mechanisms to ensure the correct interpretation of the incoming messages, including input sanitization to prevent potential attacks like SQL injection or cross-site scripting (XSS). + +c. PIN Verification: + +- The backend verifies the received PIN against the one stored in the Choronko user's database record. +- To ensure the security of PIN verification, we will utilize secure database access patterns, strong authentication protocols, and proper error handling to prevent information leakage. + +# Security Measures for the PWA and Translator Service: + +Apart from authentication, we recognize the need to secure the Progressive Web App (PWA) and its interaction with the backend, as well as the security of the translator service. To address these concerns, we will: + +1. Implement Secure Communication: + +- Utilize secure communication protocols such as HTTPS to protect data transmission between the PWA and the backend. +- Implement proper authentication and authorization mechanisms, including token-based authentication (such as JWT) or session management, to ensure only authorized requests are processed. + +2. Apply Input Validation and Sanitization: + +- Employ strict input validation and sanitization techniques to prevent common security vulnerabilities such as SQL injection or cross-site scripting (XSS) attacks. +- Utilize input validation libraries and frameworks, and follow secure coding practices to sanitize and validate user inputs. + +3. Employ Access Control: + +- Implement access control mechanisms to restrict unauthorized access to sensitive resources and functionalities within the PWA and the translator service. +- Utilize role-based access control (RBAC) or attribute-based access control (ABAC) models to define and enforce access policies. + +4. Perform Regular Security Audits: + +- Conduct regular security audits and vulnerability assessments to identify and address any potential security weaknesses. +- Use security scanning tools, penetration testing, and code reviews to proactively identify and fix security vulnerabilities. + +By implementing these security measures, we ensure that authentication requests originate from our system and that the translator service is not compromised or fake. Additionally, these measures address the non-technical concerns of allowing users only from our domain and protecting against hackers from different websites. + +# Error Handling + +Error handling is an essential aspect of any application, including the Power Payment Backend, to ensure smooth operation and a positive user experience. Proper error handling involves identifying, capturing, and appropriately responding to errors that may occur during the execution of backend processes. Below is an explanation of how error handling should be done in the backend, along with examples: + +- HTTP Status Codes: + +The app utilizes appropriate HTTP status codes to indicate the nature of the error, allowing clients to understand the response at a glance. + +For example: Review API Documentation above for status code and explanation. + +- Error Logging and Notification: + +To ensure effective issue monitoring and troubleshooting, errors in the Power Payment Backend should be logged to a centralized logging system or a dedicated log file. This logging mechanism should include essential details such as timestamps, error messages, and stack traces. This enables developers and system administrators to analyze and resolve issues efficiently. Additionally, notifications or alerts can be triggered to promptly notify the relevant individuals or teams when critical errors occur. This ensures swift action can be taken to address and resolve the issues. + +To acquire error logging, you can follow these steps: + +1. Include the relevant logging dependencies: + +Spring Boot uses SLF4J as the logging facade, so we need to include the SLF4J API and a logging implementation as dependencies in our backend. For example, we can include spring-boot-starter-logging or spring-boot-starter-log4j2 for Log4j 2. + +2. Configure logging properties: + +In the application.properties or application.yml file, specify the desired logging properties. For example, you can set the log level, log output format, and log file location. Spring Boot provides various logging properties that you can customize to meet your requirements. + +3. Use logging statements in your code: + +Within the backend code, we will use logging statements to log errors or other relevant information. Spring Boot provides the Logger interface from the SLF4J library, which we can instantiate and use to log messages at different log levels (e.g., logger.error("Error message")). + +4. Leverage AOP for detailed logging: + +Since Spring Boot supports Aspect-Oriented Programming (AOP), which allows us to apply cross-cutting concerns, such as logging, to specific methods or classes. We will use AOP in our backend to log detailed information like method entry, exit, and exception handling. + +- Exception Handling: + +Exceptions should be caught and handled appropriately using (try catch) to prevent application crashes and provide meaningful feedback to the user. + +Example: If a database connection error occurs while processing a payment transaction, an exception can be caught, and the user can be informed that there was a temporary issue and to try again later. + +- User-Friendly Error Messages: + +Error messages should be user-friendly, informative, and provide actionable instructions or suggestions whenever possible. + +Example: If a user attempts to authenticate with an incorrect PIN, they can be presented with an error message stating, "Invalid PIN. Please double-check your PIN and try again." + +- Graceful Degradation: + +To ensure system stability and prevent cascading failures, the Power Pay backend should implement graceful degradation. This involves handling errors in a manner that maintains system functionality and provides a satisfactory user experience. Specifically, the backend should adhere to the following principles: + +1. Identify critical functionalities: + +Determine the core functionalities that are essential for the Power Pay system to operate effectively. + +2. Implement robust error handling mechanisms: + +Develop comprehensive error handling mechanisms within the backend code. This includes using try-catch blocks, error logging, and structured exception handling to capture and handle potential errors or failures gracefully. + +3. Define fallback mechanisms: + +Establish fallback mechanisms for critical functionalities that can be activated in case of errors or failures. This ensures that the system can continue to operate with reduced capabilities, providing an alternative workflow or temporarily disabling the affected feature until the underlying issue is resolved. + +4. Monitor system status: + +Continuously monitor the health and availability of external APIs, services, and dependencies used by the backend. This allows for proactive identification of potential issues or downtime, enabling swift response and remediation. + +5. Implement automated recovery mechanisms: + +Develop automated recovery mechanisms, such as retrying failed requests, automatically restoring failed connections, or switching to backup systems when available. These mechanisms help restore normal system functionality as soon as possible. + +- Error Response Formats: + +The backend should provide consistent error response formats, such as JSON or XML, that include relevant error codes, messages, and additional details for easier identification and debugging by client applications. + +To provide consistent error responses in the backend: + +1. Define a standard format: Establish a structured format (e.g., JSON or XML) for error responses. + +2. Implement error handling middleware: Use middleware to transform errors into the standardized format. + +3. Assign meaningful error codes: Use specific error codes to indicate different error scenarios. + +4. Include clear messages: Provide descriptive messages that explain encountered issues. + +5. Add debugging details: Include relevant information (e.g., stack traces) for easier debugging. + +6. Handle missing/invalid parameters: Validate requests and return appropriate error responses. + +Example: An API request that fails due to missing required parameters can return a JSON response with an appropriate error code (e.g., 400 Bad Request) and a message indicating the missing parameters. + +- Input Validation and Sanitization: + +Input data should be validated and sanitized to prevent common security vulnerabilities such as SQL injection or cross-site scripting (XSS) attacks. It can be done by doing the following steps: + +To achieve input validation and sanitization, you can follow these steps: + +1. Define Validation Rules: + +Determine the specific validation rules for each input field or parameter. This includes constraints such as data type, length, format, and any specific business rules that need to be enforced. + +2. Implement Server-Side Validation: + +Perform input validation on the server-side to ensure that user-supplied data meets the defined validation rules. Use server-side programming languages and frameworks to validate and sanitize input data. + +3. Use Framework Validators: + +Many web frameworks provide built-in validators that can be used to validate input fields. For example, in Spring Boot, you can utilize validation annotations like @NotNull, @Size, @Pattern, etc., or use the @Valid annotation along with the javax.validation API. + +Example: Prior to processing a user's input for a payment amount, the backend should validate that it is a valid numeric value and sanitize it to remove any potential harmful characters. + +# Testing + +Testing is a critical aspect of ensuring the quality and reliability of the Power Pay Backend. This section provides guidance on the different types of tests to perform and outlines the libraries and technologies used for each type. + +1. Unit Testing + +To verify the functionality of individual units of code in isolation, we perform unit testing using the following libraries and technologies: + +- Testing Framework: I recommend using JUnit or TestNG for writing unit tests. + +- Mocking and Stubbing: Utilize libraries like Mockito or PowerMockito to isolate units being tested from their dependencies. + +- Spring Boot Testing Annotations: Leverage Spring Boot's testing annotations, such as @SpringBootTest, @WebMvcTest, or @DataJpaTest, to configure the testing environment and load dependencies. + +2. Integration Testing + +To ensure seamless integration between different components of the Power Pay Backend, we perform integration testing, utilizing the following libraries and technologies: + +- Testing Framework: I suggest using TestNG for integration testing. + +- Spring Boot Testing Annotations: Utilize Spring Boot's testing annotations, such as @SpringBootTest or @WebMvcTest, to configure the integration test environment and load dependencies. + +- API Testing: For testing API endpoints, consider using RestAssured or Karate. + +3. Automated Testing + +Automated testing facilitates continuous integration and helps catch regressions. We employ the following libraries and technologies for automated testing in the Power Pay Backend: + +- Continuous Integration and Delivery (CI/CD): Set up a CI/CD pipeline using tools like Jenkins, GitLab CI, or CircleCI to automate the build, test, and deployment processes. + +- Test Automation Frameworks: For API testing, utilize RestAssured or Karate. + +- Code Coverage Analysis: Measure test coverage using tools like JaCoCo or Cobertura to ensure comprehensive testing. Analyze the coverage report to identify areas that require additional test coverage. + +- Load and Performance Testing: Use tools such as Apache JMeter, Gatling, or Locust to simulate heavy loads and measure system performance. + +- Security Testing: Employ tools like OWASP ZAP or Burp Suite to conduct security testing and identify vulnerabilities in the application. + +4. Additional Considerations + +- Test Data Management: Implement strategies for managing test data effectively, such as using tools like Flyway or DbUnit for database testing. + +# Conclusion + +The Power Payment Backend leverages modern and industry-leading technologies, including Spring Boot, PostgreSQL, and a RESTful API architecture. This technology stack guarantees optimum performance, scalability, and security. Rigorous testing practices, encompassing unit tests, integration tests, and end-to-end tests, ensure the system's reliability and stability. The deployment process is streamlined through a CI/CD pipeline, guaranteeing consistent and seamless deployments, backed by thorough testing. + +Designed with ease of use, maintenance, and extensibility in mind, the Power Payment Backend follows a highly modular architecture. Changes made to one component have minimal impact on other components, promoting flexibility and efficiency. The system boasts exceptional scalability, effortlessly accommodating a growing user base and high request volumes. Security is a top priority, with stringent measures in place to safeguard user data and transactions, instilling confidence in the system's integrity and privacy. diff --git a/docs/lombok_guide.md b/docs/lombok_guide.md new file mode 100644 index 00000000..c56d7e2f --- /dev/null +++ b/docs/lombok_guide.md @@ -0,0 +1,418 @@ +# Introduction to Lombok in Spring Boot +Lombok is a powerful Java library that simplifies the development of Spring Boot applications by reducing boilerplate code. It offers a set of annotations that can be applied to classes, resulting in the automatic generation of code during compilation. This documentation explores how Lombok can streamline Spring Boot development, enhance code readability, and improve productivity. + +# Exlanation of Boilerplate Code +Boilerplate code refers to sections of code that are repetitive, standardized, and necessary for a certain functionality or structure, but do not contribute directly to the unique logic or business requirements of the program. It includes common patterns, declarations, and configurations that are written repeatedly throughout the codebase. + +Boilerplate code can be time-consuming to write, prone to errors and inconsistencies, and can make the codebase larger and harder to maintain. Examples of boilerplate code include defining getters and setters, implementing constructors etc. + +# How Lombok reduces boilerplate code +Lombok helps to reduce boilerplate code by automatically generating common code constructs, eliminating the need for developers to write them manually. Here's how Lombok achieves this: + +1. Annotations: Lombok provides a set of annotations that can be applied to classes, fields, and methods. These annotations trigger the generation of code during compilation. + +2. Code Generation: When the Lombok annotations are applied, Lombok's annotation processor kicks in during the compilation process. It analyzes the annotated elements and generates the corresponding code based on the annotations. + +For example, @Getter and @Setter annotations generate getter/setter methods for all fields in a class. Similarly, the @ToString annotation generates a toString() method, and the @NoArgsConstructor annotation generates a no-argument constructor. + +# Getting Started with Lombok + +## 1. Installation of Lombok +To start using Project Lombok, you need to first install it. There are several ways to install Lombok, but the most common one is through Maven or Gradle. + +### Installing Lombok with Maven +To install Lombok with Maven, add the following dependency to your pom.xml file: +```java + + org.projectlombok + lombok + 1.18.30 + provided + +``` + +### Installing Lombok with Gradle +To install Lombok with Gradle, add the following dependency to your build.gradle file: +```java +dependencies { + compileOnly 'org.projectlombok:lombok:1.18.30' + annotationProcessor 'org.projectlombok:lombok:1.18.30' +} +``` + +## 2. Setting up Lombok in the IDE +After installing Lombok, you need to set it up in your IDE. Below are instructions for setting up Lombok in popular IDEs like IntelliJ IDEA and VSCode. + +### Setting up Lombok in IntelliJ IDEA +1. Open IntelliJ IDEA and navigate to File > Settings. +2. In the Settings window, go to Build, Execution, Deployment > Compiler > Annotation Processors. +3. Check the box next to "Enable annotation processing". +4. Under "Annotation Processors", click the "+" button to add a new annotation processor. +5. In the "Create New Annotation Processor" window, enter the following information: + - Name: Lombok + - Processor path: [path_to_lombok_jar]/lombok-1.18.20.jar + - Output directory: [path_to_project]/target/generated-sources/lombok + - Processor options: lombok.addLombokGeneratedAnnotation=true +6. Click "OK" to save the new annotation processor. +7. Close the Settings window and rebuild your project. + +### Setting up Lombok in VSCode +1. Install the Lombok plugin for VSCode. +2. Open your project in VSCode and go to the Settings tab. +3. Search for "lombok.config.path" and set the value to ${workspaceFolder}/lombok.config. +4. Create a new file named lombok.config in the root directory of your project. +5. Add the following line to the lombok.config file: lombok.addLombokGeneratedAnnotation=true. +6. Save the lombok.config file and rebuild your project. + +# Lombok Annotations for Spring Boot +Lombok offers various annotations that can significantly reduce boilerplate code in Spring Boot projects. Let's explore some commonly used annotations: + +1. @Getter and @Setter: Automatically generates getter and setter methods for class fields. +2. @NoArgsConstructor and @AllArgsConstructor: Generates no-args and all-args constructors, respectively. +3. @Data: Combines @Getter, @Setter, @ToString, @EqualsAndHashCode, and @RequiredArgsConstructor together, providing a convenient way to generate all of them at once. +4. @Builder: Generates a builder pattern for creating instances of the class. +5. @Value: Generates an immutable class with final fields, getters, and a constructor. +6. @Slf4j: Generates a logger instance using SLF4J. +7. @Entity and @Table (for JPA entities): Generates necessary JPA annotations for entity classes. + +# Example usage +a. @Getter, @Setter: +When a field is annotated with @Getter and/or @Setter, Lombok will automatically generate the default getter and/or setter, respectively. The default implementation for getters simply takes care of returning the annotated field. Similarly, the default implementation for setters takes one parameter of the same type as the annotated field and simply sets it with the received value. When a field called value is annotated with both @Getter and @Setter, Lombok will define a getValue() (or isValue() if the field is boolean), and a setValue() method. The generated getter/setter method will be public, unless a particular AccessLevel is specified. The allowed AccessLevel values are PUBLIC, PROTECTED, PACKAGE, and PRIVATE. Note that we can also annotate the entire class. In this case, this logic will be applied to each field. + +- With Lombok: +```java +@Getter +@Setter +public class Author { + private int id; + private String name; + @Setter(AccessLevel.PROTECTED) + private String surname; +} +``` + +- With Java Vanilla: +```java +public class User { + private int id; + private String name; + private String surname; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + protected void setSurname(String surname) { + this.surname = surname; + } +} +``` + +b. @NonNull: +We can annotate with @NonNull a record component, a parameter of a method, or an entire constructor. This way, Lombok will generate null-check statements for you accordingly. + +- With Lombok: +```java +public class Author { + private int id; + private String name; + private String surname; + + public Author( + @NonNull int id, + @NonNull String name, + String surname + ) { + this.id = id; + this.name = name; + this.surname = surname; + } +} +``` + +- With Java Vanilla: +```java +public class Author { + private int id; + private String name; + private String surname; + + public Author( + int id, + String name, + String surname + ) { + if (id == null) { + throw new NullPointerException("id is marked @NonNull but is null"); + } + this.id = id; + if (name == null) { + throw new NullPointerException("name is marked @NonNull but is null"); + } + this.name = name; + this.surname = surname; + } +} +``` + +c. @Data: +@Data is a shortcut annotation that combines the features of @ToString, @EqualsAndHashCode, @Getter @Setter, and @RequiredArgsConstructor together. So, @Data generates all the boilerplate involved in POJOs (Plain Old Java Objects). This means, in particular, getters for all fields, setters for all non-final fields, proper toString, equals, and hashCode implementations involving every field of the class, and a constructor for all final fields. + +- With Lombok: +```java +@Data +public class Author { + private final int id; + private String name; + private String surname; +} +``` + +- With Java Vanilla: +```java +public class Author { + private final int id; + private String name; + private String surname; + + public Author(int id) { + this.id = id; + } + + public int getId() { + return id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSurname() { + return surname; + } + + public void setSurname(String surname) { + this.surname = surname; + } + + @Override + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = prime * result + getId(); + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getSurname() == null) ? 0 : getSurname().hashCode()); + return result; + } + + @Override + public boolean equals(Object o) { + if (o == this) return true; + if (!(o instanceof Author)) return false; + Author other = (Author) o; + if (!other.canEqual((Object)this)) return false; + if (this.getId() == null ? other.getId() != null : !this.getId().equals(other.getId())) return false; + if (this.getName() == null ? other.getName() != null : !this.getName().equals(other.getName())) return false; + if (this.getSurname() == null ? other.getSurname() != null : !this.getSurname().equals(other.getSurname())) return false; + return true; + } +} +``` + +d. @ToString: +When a class is annotated with @ToString, Lombok will take care of generating a proper implementation of the toString() method. By default, a String containing the class name, followed by each field's value separated by a comma, will be returned. By setting the includeFieldNames parameter to true, the name of each field will be placed before its value. By default, all non-static fields will be considered when generating the toString() method. Annotate a field with @ToString.Exclude to make Lombok ignore it. Alternatively, you can specify which fields you wish to be taken into account by using @ToString(onlyExplicitlyIncluded = true). Then, mark each field you want to include with @ToString.Include. + +- With Lombok: +```java +@ToString(includeFieldNames=true) +public class Author { + private int id; + private String name; + private String surname; +} +``` + +- With Java Vanilla: +```java +public class Author { + private int id; + private String name; + private String surname; + + @Override + public String toString() { + return "Author(id=" + this.id + ", name=" + this.name + ", surname=" + this.surname + ")"; + } +} +``` + +e. @NoArgsConstructor, @RequiredArgsConstructor, @AllArgsConstructor: +When a class is annotated with @NoArgsConstructor, Lombok will take care of automatically generating a constructor with no parameters. Likewise, when annotated with @AllArgsConstructor, a constructor with one parameter for each field in your class will be generated. Similarly, @RequiredArgsConstructor leads to a constructor with a parameter for each field requiring special handling. In particular, this involves non-initialized final fields, as well as any fields marked as @NonNull that are not initialized where declared. Do not forget that static fields will be ignored by these annotations. + +- With Lombok: +```java +@NoArgsConstructor +@AllArgsConstructor +@RequiredArgsConstructor +public class Author { + private int id; + private String name; + private String surname; + private final String birthPlace; +} +``` + +- With Java Vanilla: +```java +public class Author { + private int id; + private String name; + private String surname; + private final String birthPlace; + + // @NoArgsConstructor + public Author() {} + + // @AllArgsConstructor + public Author(int id, String name, String surname, String birthPlace) { + this.id = id + this.name = name + this.surname = surname + this.birthPlace = birthPlace + } + + // @RequiredArgsConstructor + public Author(String birthPlace) { + this.birthPlace = birthPlace + } +} +``` + +### Example: Using Lombok Annotations with Composition and Lists + +In this example, I am demonstrating how to use Lombok annotations in combination with composition and lists to create `Car` and `Engine` objects. + +a. Engine class: +```java +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Setter +@Getter +@AllArgsConstructor +@ToString +public class Engine { + private String type; + private int power; +} +``` + +b. Car class: +```java +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.List; + +@Setter +@Getter +@AllArgsConstructor +@ToString +public class Car { + private String make; + private String model; + private List engine; +} +``` + +In this example, we have the Car class and the Engine class, both of which utilize Lombok annotations to reduce boilerplate code. + +To demonstrate the usage of these classes, we create three Engine objects (engine1, engine2, engine3) and add them to a List. Then, we create a Car object named car1 with the provided make, model, and engine list. Finally, we print the car1 object, which triggers the toString() method and displays the string representation of the object. + +```java +package com.example.demo1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import com.example.demo1.lomboktest.*; + +import java.util.ArrayList; +import java.util.List; + +@SpringBootApplication +public class Demo1Application { + public static void main(String[] args) { + SpringApplication.run(Demo1Application.class, args); + Engine engine1 = new Engine("V6", 300); + Engine engine2 = new Engine("V8", 400); + Engine engine3 = new Engine("Electric", 500); + + List engine = new ArrayList<>(); + engine.add(engine1); + engine.add(engine2); + + Car car1 = new Car("Ford", "Mustang", engine); + System.out.println(car1); + + } + +} +``` + +When you run this code, it will output the string representation of the car1 object, which includes the make, model, and engine list. + +```java +Car(make=Ford, model=Mustang, engine=[Engine(type=V6, power=300), Engine(type=V8, power=400), Engine(type=Electric, power=500)]) +``` + +# Best Practices and Common Pitfalls: + +## 1. Best Practices +Here are some best practices for using Lombok annotations: +- Use Lombok only when it helps to reduce boilerplate code significantly. +- Always include a clear description of the behavior of your class, especially when using Lombok annotations that generate methods, such as @Getter or @Setter. +- Use @NoArgsConstructor only for non-abstract classes where it makes sense to have an instance with default values. +- Be careful when using @EqualsAndHashCode classes with collections or circular references. Consider providing an implementation for equals() and hashCode() manually. +- Use @Builder when you need to create complex objects with many properties. +- Avoid using @Data annotation for large classes or entities with many fields. In such cases, it is better to explicitly define the required methods with @Getter @Setter annotations. +- Use @NonNull and @Nullable to specify whether a parameter or a return value can be null or not. + +## Common Pitfalls +- Be aware of the side effects of Lombok annotations. For example, @Data generates all methods for you, including equals(), hashCode(), and toString(). Make sure you understand what code is being generated and how it works. +- Use the latest version of Lombok to avoid potential bugs and issues. +- Lombok annotations may not work correctly with some IDEs or build tools. Make sure to test your code thoroughly before deploying it to production. + +# Conclusion +In conclusion, Lombok is a valuable tool for Spring Boot development, offering automatic code generation to reduce boilerplate code. By leveraging Lombok's annotations, developers can save time and effort by eliminating the need to write repetitive code such as getters and setters, constructors, builder patterns, and logging statements. This results in cleaner and more concise code, improved productivity, and enhanced code maintainability. Adopting Lombok in Spring Boot projects can streamline the development process, allowing developers to focus on the core logic and requirements of their applications. + +# References: +- Official Lombok documentation: https://projectlombok.org/ +- Lombok with Spring Boot tutorial: https://www.baeldung.com/intro-to-project-lombok +- Techwasti article on lombok: https://techwasti.com/project-lombok-complete-guide-for-java-developer +- Auth0 article on lombok: https://auth0.com/blog/a-complete-guide-to-lombok/ diff --git a/docs/mockups_wireframes/Registration.png b/docs/mockups_wireframes/Registration.png new file mode 100644 index 00000000..4d653357 Binary files /dev/null and b/docs/mockups_wireframes/Registration.png differ diff --git a/docs/mockups_wireframes/SendMoney.png b/docs/mockups_wireframes/SendMoney.png new file mode 100644 index 00000000..e7e5c77a Binary files /dev/null and b/docs/mockups_wireframes/SendMoney.png differ diff --git a/docs/mockups_wireframes/Withdraw_Money.png b/docs/mockups_wireframes/Withdraw_Money.png new file mode 100644 index 00000000..8a6dd30a Binary files /dev/null and b/docs/mockups_wireframes/Withdraw_Money.png differ diff --git a/docs/mockups_wireframes/check_balance.png b/docs/mockups_wireframes/check_balance.png new file mode 100644 index 00000000..f1b98d73 Binary files /dev/null and b/docs/mockups_wireframes/check_balance.png differ diff --git a/docs/power-payment-app.md b/docs/power-payment-app.md new file mode 100644 index 00000000..66ecc572 --- /dev/null +++ b/docs/power-payment-app.md @@ -0,0 +1,259 @@ +# Power Payment App + +## Overview + +**What does it do?** + +PowerPay is a mobile payment application that allows users to send and receive money, top-up their accounts, and withdraw cash. It offers a flexible payment experience by utilizing both smartphones and physical devices called Choronko. + +**Who is using it?** + +- PowerPay Users: Individuals with smartphones who can initiate and manage transactions through the app. +- PowerPay Kiosks: Physical kiosks that facilitate top-ups and withdrawals for users with smartphones and Choronko. +- Choronko Users: Individuals who can send and receive payments using the Choronko device without needing a smartphone. + +## Technologies used + +- ReactJS: Our primary framework for building our user interface and implementing a Progressive Web App (PWA) approach. This ensures a responsive and performant user experience across different devices. +- HTML and CSS: The foundation for structuring and styling the user interface elements of the PowerPay App. +- RESTful APIs: The communication protocol between the front-end (ReactJS) and the back-end server. RESTful APIs provide a standardized way to request and receive data, facilitating efficient interaction between the application layers. +- PWA Implementation: The PWA approach utilizes web technologies to deliver an app-like experience that can be installed on user devices. This might involve additional libraries or frameworks to enhance features like offline functionality and push notifications. +- HTTP Communication: RESTful APIs rely on HTTP requests and responses for communication. The back-end server will be configured to handle these requests and provide the necessary data or functionalities. + + +### React App Architecture: + +**The PowerPay React application leverages a component-based architecture for building the user interface and managing application state. Here are the key aspects of this architecture:** + +- Components: Reusable UI building blocks that encapsulate functionality and presentation. The app will likely consist of various components representing screens (registration, Top-up, withdraw money,check balance send money, etc.) and smaller reusable elements (buttons, forms, input fields). +- State Management: As the application complexity grows, a state management solution might be implemented to handle complex data flows and keep UI components in sync. Popular choices include Redux or MobX, which offer centralized state management for a more predictable and scalable application. +- Data Fetching: The React app will likely fetch data from backend APIs using libraries like Axios or Fetch API. This data can then be used to populate UI components and update the application state. +- Routing: A routing library like React Router will manage navigation between different screens within the app. This allows users to seamlessly switch between functionalities based on their actions. + + +```mermaid + +graph LR +A[RegistrationScreen] +B[TopUpScreen] +C[WithdrawMoneyScreen] +D[CheckBalanceScreen] +E[SendMoneyScreen] +F[Button] +G[Form] +H[InputField] +I[State Management] +J[Data Fetching] +K[React Router] +L[Backend APIs] + +A -->|Route| B +A -->|Route| C +A -->|Route| D +A -->|Route| E +B --> F +C --> F +D --> F +E --> F +E --> G +G --> H +B --> I +C --> I +D --> I +E --> I +I --> J +B --> K +C --> K +D --> K +E --> K +J --> L +K -->|Route| A + + +``` + + +### Deployment and Operation: + +**Deploying and operating the PowerPay React app involves several steps:** + +- Build Process: The React application code will be bundled and optimized for production using tools like Webpack. This creates a production-ready build that can be deployed to a hosting environment. + +- Hosting Platform: Here, we can present two cost-effective options for your client: + +1. Static Hosting: Platforms like Netlify or Vercel are well-suited for PWAs as they can serve the static assets of the app and handle routing efficiently. These platforms typically offer free plans or affordable pricing tiers suitable for simpler applications. + +2. Managed Hosting Providers: Managed hosting providers offer shared hosting or cloud hosting solutions specifically designed for web applications. Popular options include Heroku, DigitalOcean, or A2 Hosting. These providers offer a balance of affordability, ease of use, and scalability for growing applications. + +- CI/CD Pipeline: A continuous integration and continuous delivery (CI/CD) pipeline automates the build, testing, and deployment process. This ensures consistency, reduces manual errors, and allows for frequent updates with minimal downtime. Depending on the chosen hosting platform, there might be built-in CI/CD integrations or third-party options available at a reasonable cost. + +- Monitoring and Logging: Implementing monitoring and logging solutions helps track application performance, identify errors, and troubleshoot issues after deployment. Here, consider open-source solutions like ELK Stack or cost-effective monitoring tools offered by the chosen hosting provider. + +## Architecture and Interaction + +### User Interface: +**The PowerPay mobile app offers a user-friendly interface/layouts that facilitates various financial transactions.** +**There wireframes of the layouts are:* +![reference image](/docs/mockups_wireframes/Registration.png) +![reference image](/docs/mockups_wireframes/SendMoney.png) +![reference image](/docs/mockups_wireframes/Withdraw_Money.png) +![reference image](/docs/mockups_wireframes/check_balance.png) + + +## User Workflow in PowerPay App +The PowerPay app streamlines various financial transactions through a user-friendly workflow. Here's how power pay users will interact with the app's interfaces: +1. **User Registration:** +- New users launch the app and then navigates to the registration screen. +- They enter their personal details (name, phone number) in the designated fields on screen. +- After entering details, The user is directed to a screen to enter the received OTP. +- They enter the OTP code in the designated field +- Upon successful OTP verification, the user is now redirected to a different screen. +- The user is required to enter a pin code , these is important to ensure a secure access. +- After filling in all the required details , including the OTP and the pin, the user now clicks on the "Register" button. +- Upon succesfull registration , the app sends the registration information to the backend server for verification and for storage in the Data base and a new interface is displayed to the use which contains all the required transactions the user might want to execute(SendMoney , Top-up , Withdraw etc). + +**Depending on what feature the user wants to use present in the main interface, we have:** + + **Send Money:** +- From the main interface users tap the "Send Money" button. +- They are directed to the send money screen +- On the send money screen, users enter the recipient's phone number in the designated field. +- They enter the amount in the designated field . +- A friendly message is later on displayed on the screen confirming if the use wants to send the specific amount to the recipient number and later on the user is prompted to enter pin code for comfirmation. +- After reviewing the details on the screen , users confirm the transaction by tapping the "Send" button. + +**Top Up:** +- The top-up process can be done either at the kiosk or at the power pay store with a power pay operator. + +- The user who wants to top up provides physical cash to the kiosk user or power pay operator followed by their account details. + +- From the main interface , the kiosk users or power pay operator tap the "Top Up" button. +- They are directed to the top-up screen. +- In the top-up screen they enter the user account details(number, amount , etc) as specified by the user who wants to top up in the designated field. +- After entering the amount , users confirm the top-up by tapping the "Top Up" button. + +**Withdrawal:** +- These operation is either performed either at the kiosk or power pay store. +- These involve the user involve taking physical cash and amount being reducted digitally in his/her power pay app. + +- From the main interface, users(kiosk user or power pay operator) tap the "withdrawal" button +- They are directed to the withdrawal screen. +- The user now put in the number and amount given to them by the user who wants to carry on the withdraw. +- If the user account balance is sufficient enough, the withdrawal process is continued followed by a message in the user's phone asking user to enter pin to confirm/initiate withdraw and also providing the amount that was withdrawed/date of withdrawal . +withdrawal is then made succesful + +**Check Balance:** + +- From the main interface , users tap the "Check Balance" button. +- They are directed to the check balance screen. +- The user is requested a pin code for confirmation. +- The user's current account balance is prominently displayed on screen for easy viewing. + +``` mermaid +graph LR +A[Registration Screen] +B[OTP Screen] +C[Pin Code Screen] +D[Main Interface] +E[Send Money Screen] +F[Top Up Screen] +G[Withdrawal Screen] +H[Check Balance Screen] +I[Backend Server] + +A -->|Enter personal details| B +B -->|Enter OTP| C +C -->|Enter pin code| D +D -->|Select Send Money| E +D -->|Select Top Up| F +D -->|Select Withdrawal| G +D -->|Select Check Balance| H +E -->|Enter recipient's phone number and amount| D +E -->|Confirm transaction and enter pin code| I +F -->|Enter user account details and amount| D +F -->|Confirm top-up| I +G -->|Enter user account details and amount| D +G -->|Confirm withdrawal and enter pin code| I +H -->|Enter pin code| D +D -->|Logout| A + +``` + + +## Error Handling in the PowerPay App +The PowerPay app strives to provide a smooth user experience by gracefully handling errors that might occur during communication with the back-end server. Here's how the app will address potential issues: + +Types of Errors: + +- Network Errors: These occur when the user's device loses internet connectivity or cannot establish a connection to the server. +- Server Errors: These can happen due to issues on the back-end server, such as high load, bugs, or maintenance. +- API Errors: Errors returned from the back-end APIs due to invalid data formats, unauthorized access attempts, or other API-specific issues. +- User Errors: Errors returned when the user mistakes in data entery orinteraction with the app's functionalities. + +**Common API Errors:** +- *400 Bad Request:* This error typically indicates that the request sent by the PowerPay app to the back-end API contains invalid data or a parameter is missing. +Common causes might be missing required fields in the request body, incorrectly formatted data (e.g., wrong date format, invalid characters in names), or exceeding character limits for specific fields. + +- *404 Not Found:* This error indicates that the resource (e.g., user data, transaction history) requested by the app is not found on the back-end server. +This could be due to a typo in the API endpoint URL, referencing a non-existent user ID, or temporary server issues. + +- *403 Forbidden:* This error signifies that the user associated with the request is authorized but doesn't have the necessary permissions to perform the specific action. + +- *500 Internal Server Error:* This generic error signifies a problem on the back-end server preventing it from fulfilling the request. +This could be due to server overload, bugs in the back-end code, or database issues. + +**API Error Handling:** +1. **Graceful error display:** Inform users without technical jargon +- For example, instead of "400 Bad Request," the app displays "There seems to be a problem with your request. Please check your information and try again." +2. **Offer Retry Options for Recoverable Errors:** +- Not all errors are permanent. Some might be caused by temporary network issues or server overload. +- The app should offer users the option to retry the action after a short delay. +- This allows users to potentially complete their task if the initial error was temporary. + + +**User Error Handling:** + +The PowerPay app prioritizes user-friendliness by providing clear and helpful messages in case of user errors. Here are some examples: + +*Invalid Phone Number:* +- If a user enters a phone number in an incorrect format (e.g., missing digits, invalid characters), the app will display a message like "Invalid phone number format. Please enter a valid 10-digit phone number." + +*Missing Information:* +- In cases where a user forgets to fill in a required field (e.g., name during registration, amount during top-up), the app will display a message like "Please enter all required fields." + +*Invalid Withdrawal Amount:* +- If a user tries to withdraw an amount exceeding their account balance or below the minimum allowed withdrawal limit, the app will display a message explaining the issue. +For example, "Insufficient funds. Your current balance is not enough for this withdrawal." or "Please enter a valid amount." + +*Incorrect PIN:* +- If a user enters an incorrect PIN during transaction processes, the app will limit the number of attempts to prevent unauthorized access. +- After exceeding the attempt limit, the app will prompt the user to reset their PIN or contact support. +- A generic message like "Incorrect PIN. Please try again." After exceeding attempts, a more informative message can be displayed. + + +## Error Location: + +These error handling mechanisms will be implemented in several key locations within the user flow: + +- User Interface (UI) Layer: When the app encounters an error during data fetching or API calls from the UI, it will trigger the error handling logic. This could be during functionalities like: +- Registration: Network errors might prevent successful Registration attempts. +- Top-up: Server errors could interrupt the top-up process. +- Sending Money: API errors might occur due to invalid recipient information. +- Balance Check: Network errors could prevent retrieving the latest balance. + +## API and Backend Communication: + +**API (Application Programming Interface):** + +- An API serves as a communication bridge between the frontend and backend of an application. +- The Power Pay app utilizes APIs to send requests from the frontend to the backend and receive responses containing the requested data or actions to be performed. +- The API endpoints define specific routes or URLs that the frontend can access to interact with the backend services. +- The API endpoints may include functionalities such as user registration, transaction initiation, and transaction status retrieval. + +## Backend Communication: + +- The frontend of the Power Pay app communicates with the backend through HTTP(S) requests. +- When a user performs an action, such as initiating a transaction(Top-up account, withdrawal , send money or check balance etc ), the frontend sends an HTTP request to the corresponding API endpoint on the backend. +- The backend receives the request, processes it, and interacts with various data sources to fulfill the request. +- The backend may communicate with databases, external services (such as SMS gateways), or other backend systems to gather or update the required data. +- The backend may also perform necessary validations, business logic execution, and security checks before responding to the frontend. diff --git a/docs/sass_usage.md b/docs/sass_usage.md new file mode 100644 index 00000000..b1964fad --- /dev/null +++ b/docs/sass_usage.md @@ -0,0 +1,65 @@ +## Introduction and overview of sass + +sass (syntactically awesome style sheets) is a scripting language that extends css. sass brings typical progamming features and functionality such as functions,loops,maxims and inheritance into css thereby making css more organised, easier to mainntain and create complex styles.It is often refered to as **css with super powers**. sass has the two syntax that is the .scss and the .sass. The .scss is popularlily used because of it's simple syntax that is similar to css. sass can be used to build css frameworks and libraries. + +# Prerequisites + +Before being able to use sass, make sure to have the following installed + +- [nvm (Node Version Manager)](https://github.com/nvm-sh/nvm): To manage Node.js versions. + +- [node.js] (https://nodejs.org/en/):javascript runtime enviroment, the foundation on which sass is built. + +- [npm] (https://www.npmjs.com/): Package manager for node.js + + +- [sass] (https://sass-lang.com/install/) :The preprocessor programming language that is either interpreted or compiled into css. + +# installation +Follow the following steps to install and use sass: + +1. Install nvm: + - Visit the nvm Github repository: (https://github.com/nvm-sh/nvm) + - Follow the installation instructions for your operating system. + +2. Install Node.js and npm using nvm: + ```bash + nvm install node + ``` + +3. install sass: + ```bash + npm add sass -D + + ``` + +## Getting started with sass + +Follow the following to use sass in the e2e-banking-app project: + +1. clone the github repository + - Open the github repository on your browser: https://github.com/ADORSYS-GIS/e2e-banking-app + - copy the url based on your requirement + - ```git clone {url} + ``` +2. Change to the project's front end directory + ```bash + cd e2e-banking-app/power-pay-frontend + ``` +3. install project dependencies + ```bash + npm install + ``` +4. Create files + Create .scss file(s) in the src directory for the scss code. + +5. Start coding + - sass functions, varaibles and all other sass features go to the .scss file + - visit the sass website for sass basics: https://sass-lang.com/guide/ + +6.Import the .scss file(s) in the app.tsx file,use the features defined in the scss file and the styles defined in the scss file will be automatcally applied. + + + + + diff --git a/docs/useStorage.md b/docs/useStorage.md index a5d49242..dd2d4634 100644 --- a/docs/useStorage.md +++ b/docs/useStorage.md @@ -33,11 +33,14 @@ So This is how we can obtain reusable , non-tree shaking and persistent data acr ```mermaid graph TD; + subgraph "interface" data[data: type, setdata: function] end + + subgraph "Components" A[component1] B[component2] diff --git a/power-pay-backend/.dockerignore b/power-pay-backend/.dockerignore index e69de29b..a2d4d320 100644 --- a/power-pay-backend/.dockerignore +++ b/power-pay-backend/.dockerignore @@ -0,0 +1,5 @@ +* +!src +!pom.xml +!mvnw +!.mvn \ No newline at end of file diff --git a/power-pay-backend/Dockerfile b/power-pay-backend/Dockerfile index ccd5137b..48cea0b2 100644 --- a/power-pay-backend/Dockerfile +++ b/power-pay-backend/Dockerfile @@ -1,7 +1,21 @@ -FROM eclipse-temurin:17 +FROM eclipse-temurin:21-jdk as builder + +WORKDIR /app + +COPY . . + +RUN ./mvnw clean package + + +FROM eclipse-temurin:21-jre-alpine + +LABEL maintainer="PowerPay Team " +LABEL application="power-pay-backend" ENV APP_VERSION=0.0.1-SNAPSHOT -COPY target/power-pay-backend-$APP_VERSION.jar app.jar +COPY --from=builder /app/target/power-pay-backend-${APP_VERSION}.jar /app/app.jar + +EXPOSE 8080 -ENTRYPOINT ["java", "-jar", "app.jar"] +ENTRYPOINT ["java", "-jar", "/app/app.jar"] diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/CheckBalance.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/CheckBalance.java new file mode 100644 index 00000000..98f933bd --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/CheckBalance.java @@ -0,0 +1,9 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + + +import jakarta.persistence.Entity; + +@Entity +public class CheckBalance extends Procedure { + +} \ No newline at end of file diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Procedure.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Procedure.java new file mode 100644 index 00000000..64d05c1b --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Procedure.java @@ -0,0 +1,59 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public abstract class Procedure { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private int id; + public ProcedureStatus status = ProcedureStatus.WAITING; + private String phoneNumber; + + + public void markAsDone() { + status = ProcedureStatus.DONE; + } + + public void markAsError() { + status = ProcedureStatus.ERROR; + } + + public boolean isDone() { + return status == ProcedureStatus.DONE; + } + + public boolean isError() { + return status == ProcedureStatus.ERROR; + } + + public boolean isWaiting() { + return status == ProcedureStatus.WAITING; + } + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public ProcedureStatus getStatus() { + return status; + } + + public void setStatus(ProcedureStatus status) { + this.status = status; + } + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } +} \ No newline at end of file diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureStatus.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureStatus.java new file mode 100644 index 00000000..1227bf53 --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureStatus.java @@ -0,0 +1,8 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + +public enum ProcedureStatus { + + DONE, + WAITING, + ERROR +} diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureType.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureType.java new file mode 100644 index 00000000..ad6a468c --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/ProcedureType.java @@ -0,0 +1,6 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + +public enum ProcedureType { + Transaction, + CheckBalance +} diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Transaction.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Transaction.java new file mode 100644 index 00000000..8fc03406 --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/Transaction.java @@ -0,0 +1,38 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + +import jakarta.persistence.Entity; + +@Entity +public class Transaction extends Procedure { + private String receiverPhoneNumber; + private Double amount; + private String currency; + + { + currency = "XAF"; + } + + public String getReceiverPhoneNumber() { + return receiverPhoneNumber; + } + + public void setReceiverPhoneNumber(String receiverPhoneNumber) { + this.receiverPhoneNumber = receiverPhoneNumber; + } + + public Double getAmount() { + return amount; + } + + public void setAmount(Double amount) { + this.amount = amount; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } +} \ No newline at end of file diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/User.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/User.java new file mode 100644 index 00000000..6125a72d --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/User.java @@ -0,0 +1,39 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; + +@Entity +public class User { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private String phoneNumber; + private String pin; + private String userName; + + public String getPhoneNumber() { + return phoneNumber; + } + + public void setPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + } + + public String getPin() { + return pin; + } + + public void setPin(String pin) { + this.pin = pin; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/UserRegistration.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/UserRegistration.java new file mode 100644 index 00000000..9791f630 --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/domain/UserRegistration.java @@ -0,0 +1,26 @@ +package com.adorsys.gis.powerpay.powerpaybackend.domain; + +import jakarta.persistence.Entity; + +@Entity +public class UserRegistration extends Procedure{ + private String opt; + private String userName; + + public String getOpt() { + return opt; + } + + public void setOpt(String opt) { + this.opt = opt; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } +} + diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalance.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalance.java new file mode 100644 index 00000000..5b059184 --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalance.java @@ -0,0 +1,5 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services; + +//implementing an empty interface +public interface CheckBalance { +} \ No newline at end of file diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalanceImpl.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalanceImpl.java new file mode 100644 index 00000000..48ee0bad --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/CheckBalanceImpl.java @@ -0,0 +1,8 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services; + +import org.springframework.stereotype.Service; + +@Service // annotation to ensure classes are recognized as Spring Beans +public class CheckBalanceImpl implements CheckBalance { + +} diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoney.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoney.java new file mode 100644 index 00000000..0e4f6f15 --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoney.java @@ -0,0 +1,5 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services; + +//implementing an empty interface +public interface SendMoney { +} \ No newline at end of file diff --git a/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoneyImpl.java b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoneyImpl.java new file mode 100644 index 00000000..25531a8e --- /dev/null +++ b/power-pay-backend/src/main/java/com/adorsys/gis/powerpay/powerpaybackend/services/SendMoneyImpl.java @@ -0,0 +1,8 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services; + +import org.springframework.stereotype.Service; + +@Service +public class SendMoneyImpl implements SendMoney{ + +} \ No newline at end of file diff --git a/power-pay-backend/src/main/resources/application.yaml b/power-pay-backend/src/main/resources/application.yaml index e69de29b..0717fde0 100644 --- a/power-pay-backend/src/main/resources/application.yaml +++ b/power-pay-backend/src/main/resources/application.yaml @@ -0,0 +1,8 @@ +management: + endpoints: + web: + exposure: + include: health, metrics + endpoint: + health: + show-details: always \ No newline at end of file diff --git a/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/CheckBalanceTest.java b/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/CheckBalanceTest.java new file mode 100644 index 00000000..1e50c52a --- /dev/null +++ b/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/CheckBalanceTest.java @@ -0,0 +1,14 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services_tests; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +import com.adorsys.gis.powerpay.powerpaybackend.services.CheckBalance; + +public class CheckBalanceTest { + @Test + public void testCheckBalance() { + // Create a mock object of the CheckBalance interface + CheckBalance checkBalance = Mockito.mock(CheckBalance.class); + + } +} diff --git a/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/SendMoneyTest.java b/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/SendMoneyTest.java new file mode 100644 index 00000000..a26f93a2 --- /dev/null +++ b/power-pay-backend/src/test/java/com/adorsys/gis/powerpay/powerpaybackend/services_tests/SendMoneyTest.java @@ -0,0 +1,14 @@ +package com.adorsys.gis.powerpay.powerpaybackend.services_tests; +import com.adorsys.gis.powerpay.powerpaybackend.services.SendMoney; + +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; + +public class SendMoneyTest { + @Test + public void testSendMoney() { + // Create a mock object of the CheckBalance interface + SendMoney sendMoney = Mockito.mock(SendMoney.class); + + } +} diff --git a/power-pay-frontend/package-lock.json b/power-pay-frontend/package-lock.json index 9d0ed1bd..2b10272d 100644 --- a/power-pay-frontend/package-lock.json +++ b/power-pay-frontend/package-lock.json @@ -20,6 +20,8 @@ "eslint": "^8.56.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", + "gh-pages": "^6.1.1", + "sass": "^1.71.1", "typescript": "^5.2.2", "vite": "^5.1.4" } @@ -1538,6 +1540,21 @@ "node": ">=8" } }, + "node_modules/array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/async": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", + "integrity": "sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==", + "dev": true + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1655,6 +1672,21 @@ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, + "node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "dev": true, + "engines": { + "node": ">=16" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1740,6 +1772,12 @@ "integrity": "sha512-+2OAGjUx68xElQhydpcbqH50hE8Vs2K6TkAeLhICYfndb67CVH0UsZaijmRUE3rHlIxU1u0jxwhgVe6fK3YANA==", "dev": true }, + "node_modules/email-addresses": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/email-addresses/-/email-addresses-5.0.0.tgz", + "integrity": "sha512-4OIPYlA6JXqtVn8zpHpGiI7vE6EQOAg16aGnDMIAlZVinnoZ8208tW1hAbjWydgN/4PLTT9q+O1K6AH/vALJGw==", + "dev": true + }, "node_modules/esbuild": { "version": "0.19.12", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.19.12.tgz", @@ -2145,6 +2183,32 @@ "node": "^10.12.0 || >=12.0.0" } }, + "node_modules/filename-reserved-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/filename-reserved-regex/-/filename-reserved-regex-2.0.0.tgz", + "integrity": "sha512-lc1bnsSr4L4Bdif8Xb/qrtokGbq5zlsms/CYH8PP+WtCkGNF65DPiQY8vG3SakEdRn8Dlnm+gW/qWKKjS5sZzQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/filenamify": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/filenamify/-/filenamify-4.3.0.tgz", + "integrity": "sha512-hcFKyUG57yWGAzu1CMt/dPzYZuv+jAJUT85bL8mrXvNe6hWj6yEHEc4EdcgiA6Z3oi1/9wXJdZPXF2dZNgwgOg==", + "dev": true, + "dependencies": { + "filename-reserved-regex": "^2.0.0", + "strip-outer": "^1.0.1", + "trim-repeated": "^1.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -2157,6 +2221,23 @@ "node": ">=8" } }, + "node_modules/find-cache-dir": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", + "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -2193,6 +2274,20 @@ "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", "dev": true }, + "node_modules/fs-extra": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.2.0.tgz", + "integrity": "sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=14.14" + } + }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -2222,6 +2317,56 @@ "node": ">=6.9.0" } }, + "node_modules/gh-pages": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/gh-pages/-/gh-pages-6.1.1.tgz", + "integrity": "sha512-upnohfjBwN5hBP9w2dPE7HO5JJTHzSGMV1JrLrHvNuqmjoYHg6TBrCcnEoorjG/e0ejbuvnwyKMdTyM40PEByw==", + "dev": true, + "dependencies": { + "async": "^3.2.4", + "commander": "^11.0.0", + "email-addresses": "^5.0.0", + "filenamify": "^4.3.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "^11.1.1", + "globby": "^6.1.0" + }, + "bin": { + "gh-pages": "bin/gh-pages.js", + "gh-pages-clean": "bin/gh-pages-clean.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/gh-pages/node_modules/array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==", + "dev": true, + "dependencies": { + "array-uniq": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/gh-pages/node_modules/globby": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "integrity": "sha512-KVbFv2TQtbzCoxAnfD6JcHZTYCzyliEaaeM/gH8qQdkKr5s0OP9scEgvdcngyk7AVdY6YVW/TJHd+lQ/Df3Daw==", + "dev": true, + "dependencies": { + "array-union": "^1.0.1", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -2305,6 +2450,12 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -2329,6 +2480,12 @@ "node": ">= 4" } }, + "node_modules/immutable": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.5.tgz", + "integrity": "sha512-8eabxkth9gZatlwl5TBuJnCsoTADlL6ftEr7A4qgdaTsPyreilDSnUk57SO+jfKcNtxPa22U5KK6DSeAYhpBJw==", + "dev": true + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -2474,6 +2631,18 @@ "node": ">=6" } }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -2537,6 +2706,30 @@ "yallist": "^3.0.2" } }, + "node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -2610,6 +2803,24 @@ "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", "dev": true }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2666,6 +2877,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -2732,6 +2952,100 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", + "integrity": "sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha512-0Gni6D4UcLTbv9c57DfxDGdr41XfgUjqWZu492f0cIGr16zDU06BWP/RAEvOuo7CQ0CNjHaLlM59YJJFm3NWlw==", + "dev": true, + "dependencies": { + "pinkie": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/postcss": { "version": "8.4.35", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", @@ -2919,6 +3233,105 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/sass": { + "version": "1.71.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.71.1.tgz", + "integrity": "sha512-wovtnV2PxzteLlfNzbgm1tFXPLoZILYAMJtvoXXkD7/+1uP41eKkIt1ypWq5/q2uT94qHjXehEYfmjKOvjL9sg==", + "dev": true, + "dependencies": { + "chokidar": ">=3.0.0 <4.0.0", + "immutable": "^4.0.0", + "source-map-js": ">=0.6.2 <2.0.0" + }, + "bin": { + "sass": "sass.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/sass/node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/sass/node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/sass/node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/sass/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/sass/node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/sass/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/scheduler": { "version": "0.23.0", "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", @@ -3023,6 +3436,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-outer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-outer/-/strip-outer-1.0.1.tgz", + "integrity": "sha512-k55yxKHwaXnpYGsOzg4Vl8+tDrWylxDEpknGjhTiZB8dFRU5rTo9CAzeycivxV3s+zlTKwrs6WxMxR95n26kwg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", @@ -3062,6 +3487,18 @@ "node": ">=8.0" } }, + "node_modules/trim-repeated": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/trim-repeated/-/trim-repeated-1.0.0.tgz", + "integrity": "sha512-pkonvlKk8/ZuR0D5tLW8ljt5I8kmxp2XKymhepUeOdCEfKpZaktSArkLHZt76OB1ZvO9bssUsDty4SWhLvZpLg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/ts-api-utils": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.2.1.tgz", @@ -3111,6 +3548,15 @@ "node": ">=14.17" } }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/update-browserslist-db": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", diff --git a/power-pay-frontend/package.json b/power-pay-frontend/package.json index 944f9f3b..02970fd5 100644 --- a/power-pay-frontend/package.json +++ b/power-pay-frontend/package.json @@ -1,9 +1,13 @@ { "name": "power-pay-frontend", "private": true, + "homepage": "https://ADORSYS-GIS.github.io/e2e-banking-app", "version": "0.0.0", "type": "module", "scripts": { + "predeploy": "npm run build", + "deploy": "gh-pages -d build", + "build-for-gh": "vite build --base=/e2e-banking-app", "dev": "vite", "build": "tsc && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", @@ -22,6 +26,8 @@ "eslint": "^8.56.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", + "gh-pages": "^6.1.1", + "sass": "^1.71.1", "typescript": "^5.2.2", "vite": "^5.1.4" } diff --git a/power-pay-translator/Cargo.toml b/power-pay-translator/Cargo.toml index 44e3d9ca..1ea8d63e 100644 --- a/power-pay-translator/Cargo.toml +++ b/power-pay-translator/Cargo.toml @@ -6,3 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +rocket = "0.5.0" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +serde_derive = "1.0" \ No newline at end of file diff --git a/power-pay-translator/Dockerfile b/power-pay-translator/Dockerfile index 62108739..42d006b9 100644 --- a/power-pay-translator/Dockerfile +++ b/power-pay-translator/Dockerfile @@ -1 +1,21 @@ -FROM rust +FROM rust as base + +WORKDIR /app + +FROM base as builder + +# Copy the Cargo.toml and Cargo.lock files to cache dependencies +COPY ./ ./ + +# Build the dependencies +RUN cargo build --release + +FROM base + +WORKDIR /app + +COPY --from=builder /app/target/release/power-pay-translator /app/power-pay-translator + +EXPOSE 8000 + +CMD ["/app/power-pay-translator"] \ No newline at end of file diff --git a/power-pay-translator/README.md b/power-pay-translator/README.md deleted file mode 100644 index 5fd3a44b..00000000 --- a/power-pay-translator/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# PowerPay Translator - -This service in the microservice architecture should get messages from the twilio and send to the P.P.Service. \ No newline at end of file diff --git a/power-pay-translator/src/main.rs b/power-pay-translator/src/main.rs index e7a11a96..4c3a51e7 100644 --- a/power-pay-translator/src/main.rs +++ b/power-pay-translator/src/main.rs @@ -1,3 +1,12 @@ -fn main() { - println!("Hello, world!"); +#[macro_use] +extern crate rocket; + +#[get("/")] +fn index() -> &'static str { + "Welcome to the Power Pay App!" +} + +#[launch] +fn rocket() -> _ { + rocket::build().mount("/", routes![index]) }