Skip to content

Commit

Permalink
fix(api): Fixed crash when trying to add a Plaid link.
Browse files Browse the repository at this point in the history
Fixed a nil reference error in the plaid link controller.

Resolves #1172
  • Loading branch information
elliotcourant committed Dec 22, 2022
1 parent 45f32bb commit 9fa0067
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/controller/plaid.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,14 @@ func (c *Controller) newPlaidToken(ctx iris.Context) {
}

// If there is a configured limit on Plaid links then enforce that limit.
if maxLinks := c.configuration.Plaid.MaxNumberOfLinks; maxLinks > 0 {
if numberOfLinks >= maxLinks {
c.badRequest(ctx, "max number of Plaid links already reached")
return
}
if maxLinks := c.configuration.Plaid.MaxNumberOfLinks; maxLinks > 0 && numberOfLinks >= maxLinks {
c.badRequest(ctx, "max number of Plaid links already reached")
return
}

// If billing is enabled and the current account is trialing, then limit them to a single Plaid link until their
// trial has expired.
if c.configuration.Stripe.BillingEnabled {
if c.configuration.Stripe.IsBillingEnabled() {
trialing, err := c.paywall.GetSubscriptionIsTrialing(c.getContext(ctx), c.mustGetAccountId(ctx))
if err != nil {
c.wrapAndReturnError(ctx, err, http.StatusInternalServerError, "failed to determine trial status")
Expand Down

0 comments on commit 9fa0067

Please sign in to comment.