From 9e9749fec2f18529265dfb6ef586edd0e9e7199c Mon Sep 17 00:00:00 2001 From: Mauricio Araujo Date: Thu, 16 May 2024 13:25:58 -0400 Subject: [PATCH] Remove arg --- api/server/handlers/billing/create.go | 6 +----- internal/billing/usage.go | 6 ++---- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/api/server/handlers/billing/create.go b/api/server/handlers/billing/create.go index 340233fb50..4d84659089 100644 --- a/api/server/handlers/billing/create.go +++ b/api/server/handlers/billing/create.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "net/http" - "time" "github.com/porter-dev/porter/api/server/handlers" "github.com/porter-dev/porter/api/server/shared" @@ -147,12 +146,9 @@ func (c *CreateBillingHandler) grantRewardIfReferral(ctx context.Context, referr } if referral != nil && referral.Status != models.ReferralStatusCompleted { - // Lago requires an expiration to be passed in, so we set it to 5 years which in - // practice will mean the credits will most likely run out before expiring - expiresAt := time.Now().AddDate(5, 0, 0) name := "Referral reward" rewardAmount := c.Config().BillingManager.LagoClient.DefaultRewardAmountCents - err := c.Config().BillingManager.LagoClient.CreateCreditsGrant(ctx, referrerProject.ID, name, rewardAmount, &expiresAt, referrerProject.EnableSandbox) + err := c.Config().BillingManager.LagoClient.CreateCreditsGrant(ctx, referrerProject.ID, name, rewardAmount, referrerProject.EnableSandbox) if err != nil { return telemetry.Error(ctx, span, err, "failed to grand credits reward") } diff --git a/internal/billing/usage.go b/internal/billing/usage.go index 0c7b34e645..a8869ddfde 100644 --- a/internal/billing/usage.go +++ b/internal/billing/usage.go @@ -100,9 +100,7 @@ func (m LagoClient) CreateCustomerWithPlan(ctx context.Context, userEmail string } walletName := "Porter Credits" - expiresAt := time.Now().UTC().AddDate(0, 1, 0).Truncate(24 * time.Hour) - - err = m.CreateCreditsGrant(ctx, projectID, walletName, defaultStarterCreditsCents, &expiresAt, sandboxEnabled) + err = m.CreateCreditsGrant(ctx, projectID, walletName, defaultStarterCreditsCents, sandboxEnabled) if err != nil { return telemetry.Error(ctx, span, err, "error while creating starter credits grant") } @@ -261,7 +259,7 @@ func (m LagoClient) CheckCustomerCouponExpiration(ctx context.Context, projectID } // CreateCreditsGrant will create a new credit grant for the customer with the specified amount -func (m LagoClient) CreateCreditsGrant(ctx context.Context, projectID uint, name string, grantAmount int64, expiresAt *time.Time, sandboxEnabled bool) (err error) { +func (m LagoClient) CreateCreditsGrant(ctx context.Context, projectID uint, name string, grantAmount int64, sandboxEnabled bool) (err error) { ctx, span := telemetry.NewSpan(ctx, "create-credits-grant") defer span.End()