Mauricio Araujo 2 роки тому
батько
коміт
f5ef333fc1

+ 1 - 0
api/server/handlers/project/create.go

@@ -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

+ 1 - 1
api/types/billing_metronome.go

@@ -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

+ 1 - 1
internal/billing/metronome.go

@@ -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),
 		}
 	}