Skip to content

Commit

Permalink
Use pointer for trialspec (#4589)
Browse files Browse the repository at this point in the history
  • Loading branch information
MauAraujo authored Apr 29, 2024
1 parent cb7a7b0 commit f5ef333
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions api/server/handlers/project/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (p *ProjectCreateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
if err != nil {
err = telemetry.Error(ctx, span, err, "error creating Metronome customer")
p.HandleAPIError(w, r, apierrors.NewErrInternal(err))
return
}
proj.UsageID = customerID
proj.UsagePlanID = customerPlanID
Expand Down
2 changes: 1 addition & 1 deletion api/types/billing_metronome.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type AddCustomerPlanRequest struct {
// NetPaymentTermDays is the number of days after issuance of invoice after which the invoice is due
NetPaymentTermDays int `json:"net_payment_terms_days,omitempty"`
// Trial is the trial period for the plan
Trial TrialSpec `json:"trial_spec,omitempty"`
Trial *TrialSpec `json:"trial_spec,omitempty"`
}

// TrialSpec is the trial period for the plan
Expand Down
2 changes: 1 addition & 1 deletion internal/billing/metronome.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (m MetronomeClient) addCustomerPlan(ctx context.Context, customerID uuid.UU
}

if trialDays != 0 {
req.Trial = types.TrialSpec{
req.Trial = &types.TrialSpec{
LengthInDays: int64(trialDays),
}
}
Expand Down

0 comments on commit f5ef333

Please sign in to comment.