Skip to content
This repository was archived by the owner on Apr 5, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f8730c1
Upgrade to TS
danshapir Jul 31, 2021
b1f7710
Change to default export CheckbookAPI
danshapir Jul 31, 2021
a9c4446
Add error response
danshapir Jul 31, 2021
9c27d81
Remove Lodash
danshapir Jul 31, 2021
1a55df4
Fix
danshapir Jul 31, 2021
7e9a445
Fix includes
danshapir Jul 31, 2021
94363ef
optional idempotencyKey user create
danshapir Aug 1, 2021
1aa1b3b
Ammend
danshapir Aug 1, 2021
6bdcfed
Add plaid auth
danshapir Aug 1, 2021
6b400bf
npm
danshapir Aug 20, 2021
888df9b
Add VCC Endpoint
haimprecise Mar 15, 2022
48e4ecf
Added address to VCC params
haimprecise Mar 15, 2022
9c0b6af
Synced changes
haimprecise Mar 15, 2022
02306db
Merge pull request #1 from Precise-Finance/feature/add-vcc-endpoint
danshapir Mar 15, 2022
3a5e6b7
Added an update function for bank endpoint
haimprecise Mar 15, 2022
e054f86
Merge pull request #2 from Precise-Finance/feature/support-bank-update
haimprecise Mar 15, 2022
457db00
BugFix: Add missing slashes
haimprecise Mar 17, 2022
ff4892a
Version bump
haimprecise Mar 17, 2022
63e10b7
Version bump,
haimprecise Mar 17, 2022
a7ba443
Added releaseMicrodesposits for banks
haimprecise May 10, 2023
29ece8f
Fixed Typo
haimprecise May 17, 2023
b46e3ab
return response instead of body for failed requests
haimprecise Jul 24, 2023
ced2ebb
Add Wallet
danshapir Oct 10, 2023
005e9f0
Add deposit flow
danshapir Oct 11, 2023
5422b29
Add deposit
danshapir Oct 11, 2023
500b598
Added .github directory
danshapir Oct 30, 2023
06b9796
Bump version to 1.3.3 and add triggerWebhook method to Check class
danshapir Oct 7, 2024
fbfde22
Fix optional chaining for error handling in Resource class
danshapir Oct 7, 2024
d0957e7
Bump version to 1.3.5 and update response status handling in Resource…
danshapir Oct 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 281 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
name: CI/CD Workflow

on:
workflow_dispatch:
push:
branches:
- '**'
# pull_request:
# types:
# - closed

jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: ponicode/azure-devops-npm-action@master
with:
organisation: precise-finance
project: precise-finance
registry: precise-npm
user: danshapir
password: ${{ secrets.AZURE_PAT }}
email: dan@precisefinance.ai
# scope: ponicode
- run: cp `pwd`/.npmrc ~ # We need the .npmrc file in the $HOME directory
- name: Setup Node.js
uses: actions/setup-node@v4.0.0
with:
node-version: '18' # Adjust as necessary

- name: Cache node_modules
id: cache-node-modules # Added an ID for this step
uses: actions/cache@v3
with:
path: node_modules # caching node_modules directly
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-

- name: Install Dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true' # Only run if cache was a miss
run: npm ci

- name: Run tests
run: |
npx prisma generate
npm run test:ci

- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: JEST Tests # Name of the check run which will be created
path: reports/jest-*.xml # Path to test results
reporter: jest-junit # Format of test results

build_image:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout Helm repo
uses: actions/checkout@v4
with:
repository: Precise-Finance/charts
path: helm-repo
ref: main
token: ${{ secrets.GH_SECRET }}

- name: Install yq
run: |
sudo wget -O /usr/local/bin/yq https://github.com/mikefarah/yq/releases/download/v4.12.2/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq

- name: Get current image tag
id: get_current_tag
run: |
CURRENT_TAG=$(yq eval ".image.tag" helm-repo/${{ github.event.repository.name }}/values.yaml)
echo "current_tag=$CURRENT_TAG" >> $GITHUB_OUTPUT

- name: Check if tag needs update
id: check_tag
run: |
if [[ "${{ steps.get_current_tag.outputs.current_tag }}" == "$GITHUB_SHA" ]]; then
echo "Image tag is already up-to-date. Skipping."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi

- name: Azure npm auth
if: steps.check_tag.outputs.skip == 'false'
uses: ponicode/azure-devops-npm-action@master
with:
organisation: precise-finance
project: precise-finance
registry: precise-npm
user: danshapir
password: ${{ secrets.AZURE_PAT }}
email: dan@precisefinance.ai
# scope: ponicode
- run: cp `pwd`/.npmrc ~ # We need the .npmrc file in the $HOME directory
- name: Setup Node.js
if: steps.check_tag.outputs.skip == 'false'
uses: actions/setup-node@v4.0.0
with:
node-version: '18' # Adjust as necessary

- name: Configure AWS credentials
if: steps.check_tag.outputs.skip == 'false'
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1

- name: Login to Amazon ECR Private
if: steps.check_tag.outputs.skip == 'false'
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Set up Docker Buildx
if: steps.check_tag.outputs.skip == 'false'
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
if: steps.check_tag.outputs.skip == 'false'
uses: actions/cache@v3.3.2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile', '**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-buildx-${{ hashFiles('**/package-lock.json') }}
${{ runner.os }}-buildx-


- name: Build, tag, and push docker image to Amazon ECR using Buildx
if: steps.check_tag.outputs.skip == 'false'
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: precise/${{ github.event.repository.name }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker buildx create --use
docker buildx build --push \
--cache-from=type=local,src=/tmp/.buildx-cache \
--cache-to=type=local,dest=/tmp/.buildx-cache,mode=max \
--build-arg BUILDKIT_INLINE_CACHE=1 \
-t $REGISTRY/$REPOSITORY:$IMAGE_TAG .




- name: Update values.yaml
if: steps.check_tag.outputs.skip == 'false'
run: |
yq eval ".image.tag = \"$(echo $GITHUB_SHA )\"" -i helm-repo/${{ github.event.repository.name }}/values.yaml
cat helm-repo/${{ github.event.repository.name }}/values.yaml


- name: Set up Git
if: steps.check_tag.outputs.skip == 'false'
run: |
git config --global user.name "GitHub Action"
git config --global user.email "action@github.com"

- name: Commit and Push Changes
if: steps.check_tag.outputs.skip == 'false'
run: |
cd helm-repo
git add .
git commit -m "Update image tag after commit"
git push

- name: Generate File
run: |
cd helm-repo
echo $(git rev-parse HEAD) > ../helm_commit.txt

- name: Upload artifact
uses: actions/upload-artifact@v3.1.3
with:
name: helm-commit
path: helm_commit.txt


approval_and_tag_dev:
needs: [run_tests, build_image] # Change the dependency to the newly separated jobs
if: contains(github.ref, 'refs/pull/') || startsWith(github.ref, 'refs/heads/feature/')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3.0.2
with:
name: helm-commit
path: helm-commit
- name: Set output
id: get_commit_id
run: |
echo $(cat helm-commit/helm_commit.txt)
echo "commit_id=$(cat helm-commit/helm_commit.txt)" >> $GITHUB_OUTPUT

- name: Get Commit Details
id: get_commit_details
run: |
echo $(git log -1 --pretty=format:'%s')
echo "commit_message=$(git log -1 --pretty=format:'%s')" >> $GITHUB_OUTPUT

- name: Get PR Details
id: get_pr_details
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "pr_link=${{ github.event.pull_request.html_url }}" >> $GITHUB_OUTPUT
else
echo "Not a PR event, skipping PR details extraction."
fi

- name: send approval
uses: Precise-Finance/slack-approval@v2.8
env:
SLACK_APP_TOKEN: ${{ secrets.SLACK_APP_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
SLACK_CHANNEL_ID: deployment-approvals-dev #${{ secrets.SLACK_CHANNEL_ID }}
DEPLOYMENT_ENV: DEV
COMMIT_SHA: ${{ steps.get_commit_id.outputs.commit_id }}
GH_SECRET: ${{ secrets.GH_SECRET }}
PR_LINK: ${{ steps.get_pr_details.outputs.pr_link }}
COMMIT_MESSAGE: ${{ steps.get_commit_details.outputs.commit_message }}
timeout-minutes: 10

approval_and_tag_prod:
needs: [run_tests, build_image] # Change the dependency to the newly separated jobs
if: (github.ref == 'refs/heads/main') || (github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3.0.2
with:
name: helm-commit
path: helm-commit
- name: Set output
id: get_commit_id
run: |
echo $(cat helm-commit/helm_commit.txt)
echo "commit_id=$(cat helm-commit/helm_commit.txt)" >> $GITHUB_OUTPUT

- name: Get Commit Details
id: get_commit_details
run: |
echo $(git log -1 --pretty=format:'%s')
echo "commit_message=$(git log -1 --pretty=format:'%s')" >> $GITHUB_OUTPUT

- name: Get PR Details
id: get_pr_details
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "pr_link=${{ github.event.pull_request.html_url }}" >> $GITHUB_OUTPUT
else
echo "Not a PR event, skipping PR details extraction."
fi

- name: send approval
uses: Precise-Finance/slack-approval@v2.8
env:
SLACK_APP_TOKEN: ${{ secrets.SLACK_APP_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_SIGNING_SECRET: ${{ secrets.SLACK_SIGNING_SECRET }}
SLACK_CHANNEL_ID: deployment-approvals #${{ secrets.SLACK_CHANNEL_ID }}
DEPLOYMENT_ENV: Production
COMMIT_SHA: ${{ steps.get_commit_id.outputs.commit_id }}
GH_SECRET: ${{ secrets.GH_SECRET }}
PR_LINK: ${{ steps.get_pr_details.outputs.pr_link }}
COMMIT_MESSAGE: ${{ steps.get_commit_details.outputs.commit_message }}
timeout-minutes: 10
32 changes: 32 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Continue Deployment after Approval

on:
repository_dispatch:
types: [deployment-approved]

jobs:
post_approval_prod:
runs-on: ubuntu-latest
steps:
- name: Deploy to environment
run: |
echo "Deploying to ${{ github.event.client_payload.env }}"

- name: Deploy commit
run: |
echo "Deploying commit ${{ github.event.client_payload.sha }}"
- name: Checkout Helm repo at specific SHA
uses: actions/checkout@v4
with:
repository: Precise-Finance/charts
path: helm-repo
ref: ${{ github.event.client_payload.sha }}
token: ${{ secrets.GH_SECRET }}


- name: Tag with SHA and ENV
run: |
cd helm-repo
git tag ${{ github.event.client_payload.env }}-${{ github.event.repository.name }}
git push origin refs/tags/${{ github.event.client_payload.env }}-${{ github.event.repository.name }} -f --tags

38 changes: 38 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Code Review

permissions:
contents: read
pull-requests: write

on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]

jobs:
chatgpt_review:
if: ${{ !contains(github.event.*.labels.*.name, 'no gpt review') }} # Optional; to run only when a label is attached
runs-on: ubuntu-latest
steps:
- uses: anc95/ChatGPT-CodeReview@main
env:
GITHUB_TOKEN: ${{ secrets.GH_SECRET }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# Optional
LANGUAGE: English
MODEL: gpt-3.5-turbo # https://platform.openai.com/docs/models
# OPENAI_API_ENDPOINT: https://api.openai.com/v1
# PROMPT: Please check if there are any confusions, irregularities, security issues or performance issues in the following code diff:
# top_p: 1 # https://platform.openai.com/docs/api-reference/chat/create#chat/create-top_p
# temperature: 1 # https://platform.openai.com/docs/api-reference/chat/create#chat/create-temperature
# max_tokens: 10000
# MAX_PATCH_LENGTH: 10000 # if the patch/diff length is large than MAX_PATCH_LENGTH, will be ignored and won't review. By default, with no MAX_PATCH_LENGTH set, there is also no limit for the patch/diff length.
gpt_review_node:
if: ${{ contains(github.event.*.labels.*.name, 'gpt summary') }} # Optional; to run only when a label is attached
runs-on: ubuntu-latest
steps:
- name: gpt-review-node
uses: Precise-Finance/gpt-review@v1.1
with:
GITHUB_TOKEN: ${{ secrets.GH_SECRET }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENAI_ORG_KEY: ${{ secrets.OPENAI_ORG_KEY }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,7 @@ typings/

# IDE
.idea


.history
.DS_Store
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ You can click on the :book: icon to access the detailed API reference for each m
* ```delete(bank_id, callback)``` [:book:](https://docs.checkbook.io/reference#delete-bank)
* ```instantAccountVerification(params, callback[, idempotencyKey])``` [:book:](https://docs.checkbook.io/reference#post-bank-iav)
* ```addBankAccount(params, callback[, idempotencyKey])``` [:book:](https://docs.checkbook.io/reference#post-bank)
* ```verifyMicrodesposits(params, callback)``` [:book:](https://docs.checkbook.io/reference#post-bank-verify)
* ```releaseMicrodeposits(params, callback)``` [:book:](https://docs.checkbook.io/reference#post-bank-release)
* ```verifyMicrodeposits(params, callback)``` [:book:](https://docs.checkbook.io/reference#post-bank-verify)

* __Checkbook.users__
* ```create(params, callback[, idempotencyKey])``` [:book:](https://docs.checkbook.io/reference#post-user)
Expand Down
2 changes: 2 additions & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import CheckbookAPI from "./ts/checkbook";
export default CheckbookAPI;
5 changes: 5 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading