Update Partner
This commit is contained in:
parent
5907802908
commit
6fabd843d2
@ -103,10 +103,12 @@ type PartnerLicense struct {
|
|||||||
|
|
||||||
func (l *LicenseDB) ToPartnerLicense() PartnerLicense {
|
func (l *LicenseDB) ToPartnerLicense() PartnerLicense {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
daysToExpire := int64(l.EndDate.Sub(now).Hours() / 24)
|
|
||||||
|
|
||||||
|
daysToExpire := int64(l.EndDate.Sub(now).Hours() / 24)
|
||||||
var licenseStatus string
|
var licenseStatus string
|
||||||
if daysToExpire < 0 {
|
if now.Before(l.StartDate) {
|
||||||
|
licenseStatus = "INACTIVE"
|
||||||
|
} else if daysToExpire < 0 {
|
||||||
licenseStatus = "EXPIRED"
|
licenseStatus = "EXPIRED"
|
||||||
} else if daysToExpire <= 30 {
|
} else if daysToExpire <= 30 {
|
||||||
licenseStatus = "EXPIRING_SOON"
|
licenseStatus = "EXPIRING_SOON"
|
||||||
|
|||||||
@ -73,7 +73,8 @@ func (u *AuthServiceImpl) AuthenticateUser(ctx context.Context, email, password
|
|||||||
}
|
}
|
||||||
|
|
||||||
licensePartner = partnerLicense.ToPartnerLicense()
|
licensePartner = partnerLicense.ToPartnerLicense()
|
||||||
if licensePartner.LicenseStatus == "EXPIRED" {
|
if licensePartner.LicenseStatus == "EXPIRED"
|
||||||
|
|| licensePartner.LicenseStatus == "INACTIVE" {
|
||||||
return nil, errors.ErrorInvalidLicense
|
return nil, errors.ErrorInvalidLicense
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user