Skip to content

Commit

Permalink
feat: add YNAP parsing to transaction import
Browse files Browse the repository at this point in the history
This adds YNAP parsing to transaction importing, removing the need to
parse the file in the YNAP web app before uploading it to Envelope Zero.

Co-Authored-By: Fynn Heintz <[email protected]>
Co-Authored-By: Morre <[email protected]>
  • Loading branch information
morremeyer and malfynnction committed Aug 14, 2023
1 parent f861350 commit 03c9c13
Show file tree
Hide file tree
Showing 11 changed files with 405 additions and 74 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,30 @@ env:
jobs:
pre-commit:
runs-on: ubuntu-latest
permissions:
packages: read

steps:
- uses: actions/[email protected]

- name: Cache dependencies
uses: actions/setup-node@v3
with:
node-version: '16'
node-version: '20'
cache: 'npm'

- name: set npm auth
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc

- name: install node modules
run: npm ci

- uses: pre-commit/[email protected]

cypress:
runs-on: ubuntu-latest
permissions:
packages: read

# Current backend version as service container
services:
Expand All @@ -44,6 +52,9 @@ jobs:
steps:
- uses: actions/[email protected]

- name: set npm auth
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc

- uses: cypress-io/[email protected]
env:
PORT: 3001
Expand Down Expand Up @@ -106,9 +117,9 @@ jobs:
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: ${{ steps.push_check.outputs.push }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
REACT_APP_VERSION=${{ github.ref_name }}
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@envelope-zero:registry=https://npm.pkg.github.com
7 changes: 4 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ Contributions are welcome. Please note the [Code of Conduct](CODE_OF_CONDUCT.md)

## Tool & Repository setup

You will need the following tools:
You will need to:

- [pre-commit](https://pre-commit.com/)
- Install [pre-commit](https://pre-commit.com/)
- Set up a GitHub Personal Access Token to read from the GitHub package repository. Follow the steps in https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token.

Once those are installed, run `make setup` to perform the repository setup.
Once these steps are done, run `make setup` to perform the repository setup.

## Development server

Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM node:20.5.1-alpine AS builder
FROM node:20.3.1-alpine AS builder
ENV NODE_ENV production
WORKDIR /app

# copy package.json first to avoid unnecessary npm install
COPY package.json package-lock.json /app/
RUN npm install --production

ARG GITHUB_TOKEN
RUN echo "//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}" > ~/.npmrc && \
npm install --production

# Copy app files
COPY src /app/src
Expand Down
8 changes: 2 additions & 6 deletions cypress/e2e/transaction-import.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ describe('Transaction Import', () => {
cy.contains('My Other Account')
cy.contains('My Account').click()

cy.getInputFor('File').selectFile(
'cypress/fixtures/transactions-parsed.csv'
)
cy.getInputFor('File').selectFile('cypress/fixtures/comdirect.csv')

cy.clickAndWait('Submit')

Expand Down Expand Up @@ -163,9 +161,7 @@ describe('Transaction Import', () => {
cy.awaitLoading()

cy.getInputFor('Account').type('My account{enter}')
cy.getInputFor('File').selectFile(
'cypress/fixtures/transactions-parsed.csv'
)
cy.getInputFor('File').selectFile('cypress/fixtures/comdirect.csv')

cy.clickAndWait('Submit')
cy.contains('This is a duplicate of an existing transaction')
Expand Down
11 changes: 11 additions & 0 deletions cypress/fixtures/comdirect.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
;
"Umsätze Verrechnungskonto ";"Zeitraum: 30 Tage";
"Neuer Kontostand";"16,94 EUR";

"Buchungstag";"Wertstellung (Valuta)";"Vorgang";"Buchungstext";"Umsatz in EUR";
"20.06.2023";"20.06.2023";"Irrevevant";"Empfänger: Non Existing Account Buchungstext: Text Ref. 000000000/0 ";"-84,76";
"19.06.2023";"19.06.2023";"Irrevevant";"Auftraggeber: My Other Account Buchungstext: Transfer from my other account Ref. 0000000000000/0 ";"5,00";
"16.06.2023";"16.06.2023";"Irrevevant";"Empfänger: New Account Buchungstext: REDACTED Ref. 000000000/0 ";"-784,94";
"15.06.2023";"15.06.2023";"Irrevevant";"Auftraggeber: External Account Buchungstext: Text Ref. 000000000/0 ";"-52,03";

"Alter Kontostand";"16,89 EUR";
5 changes: 0 additions & 5 deletions cypress/fixtures/transactions-parsed.csv

This file was deleted.

Loading

0 comments on commit 03c9c13

Please sign in to comment.