MCPcopy Index your code
hub / github.com/NdoleStudio/httpsms / GetBillingAnchorDay

Method GetBillingAnchorDay

api/pkg/entities/user.go:134–139  ·  view source on GitHub ↗

GetBillingAnchorDay returns the day-of-month that anchors this user's billing cycle. For paid users with an active subscription, it uses the renewal date. For free users or when SubscriptionRenewsAt is nil, it falls back to the account creation date.

()

Source from the content-addressed store, hash-verified

132// For paid users with an active subscription, it uses the renewal date.
133// For free users or when SubscriptionRenewsAt is nil, it falls back to the account creation date.
134func (user User) GetBillingAnchorDay() int {
135 if user.SubscriptionRenewsAt != nil && !user.IsOnFreePlan() {
136 return user.SubscriptionRenewsAt.Day()
137 }
138 return user.CreatedAt.Day()
139}

Calls 1

IsOnFreePlanMethod · 0.95