Skip to content
This repository has been archived by the owner on Oct 31, 2021. It is now read-only.

Commit

Permalink
Big dumb
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotcourant committed Apr 17, 2021
1 parent 0805265 commit 8022c8d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ stages:
variables:
GO111MODULE: 'on'
GOFLAGS: '-mod=vendor'
# PATH: '$PATH:$CI_PROJECT_DIR/bin'

Go Dependencies:
needs: [ ]
Expand Down Expand Up @@ -68,7 +67,7 @@ Binary:
- k8s:shared
- arch:amd64
script:
- go build -o ./bin/rest-api-${GOARCH} github.com/monetrapp/rest-api/cmd/api
- make build
cache:
key: go-${CI_COMMIT_SHA}
paths:
Expand Down
25 changes: 25 additions & 0 deletions pkg/controller/plaid_webhook.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,37 @@
package controller

import (
"net/http"
"net/url"
"strings"

"github.com/kataras/iris/v12/context"
)

type PlaidWebhook struct {
WebhookType string `json:"webhook_type"`
WebhookCode string `json:"webhook_code"`
ItemId string `json:"item_id"`
Error map[string]interface{} `json:"error"`
NewWebhookURL string `json:"new_webhook_url"`
NewTransactions int64 `json:"new_transactions"`
RemovedTransactions []string `json:"removed_transactions"`
}

func (c *Controller) handlePlaidWebhook(ctx *context.Context) {
verification := ctx.GetHeader("Plaid-Verification")
if strings.TrimSpace(verification) == "" {
c.returnError(ctx, http.StatusUnauthorized, "unauthorized")
return
}

// TODO Properly verify webhooks from Plaid.

var hook PlaidWebhook
if err := ctx.ReadJSON(&hook); err != nil {
c.badRequest(ctx, "malformed JSON")
return
}

}

Expand Down

0 comments on commit 8022c8d

Please sign in to comment.