Explorar el Código

Fix customer check and billing flag check (#4646)

Mauricio Araujo hace 2 años
padre
commit
e3325cf237

+ 1 - 0
dashboard/src/main/home/app-dashboard/apps/Apps.tsx

@@ -486,6 +486,7 @@ const Apps: React.FC = () => {
         />
       )}
       {!currentProject?.sandbox_enabled &&
+        currentProject?.billing_enabled &&
         trialExpired &&
         !hasPaymentEnabled &&
         showBillingModal && (

+ 3 - 0
internal/billing/usage.go

@@ -136,6 +136,9 @@ func (m LagoClient) CheckIfCustomerExists(ctx context.Context, projectID uint, e
 	customerID := m.generateLagoID(CustomerIDPrefix, projectID, enableSandbox)
 	_, lagoErr := m.client.Customer().Get(ctx, customerID)
 	if lagoErr != nil {
+		if lagoErr.ErrorCode == "customer_not_found" {
+			return false, nil
+		}
 		return exists, telemetry.Error(ctx, span, fmt.Errorf(lagoErr.ErrorCode), "failed to get customer")
 	}