Skip to content

Commit

Permalink
Refactor cert.go and fiskalhr.go to add methods for retrieving certif…
Browse files Browse the repository at this point in the history
…icate information
  • Loading branch information
arvvoid committed Sep 22, 2024
1 parent d631b27 commit 077bf20
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
30 changes: 30 additions & 0 deletions cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,33 @@ func (cm *certManager) displayCertInfoKeyPoints() [][2]string {

return result
}

// getCertORG returns the organization name from the certificate.
// The organization name is typically included in the certificate's subject field.
func (cm *certManager) getCertORG() string {
return cm.certORG
}

// getCertSERIAL returns the serial number from the certificate.
// The serial number is a unique identifier assigned by the certificate issuer.
func (cm *certManager) getCertSERIAL() string {
return cm.certSERIAL
}

// isExpired returns whether the certificate is expired.
// This indicates if the certificate's validity period has ended.
func (cm *certManager) isExpired() bool {
return cm.expired
}

// isExpiringSoon returns whether the certificate is expiring soon.
// This indicates if the certificate is approaching its expiration date.
func (cm *certManager) isExpiringSoon() bool {
return cm.expire_soon
}

// daysUntilExpire returns the number of days until the certificate expires.
// This provides a countdown of days remaining before the certificate becomes invalid.
func (cm *certManager) daysUntilExpire() uint16 {
return cm.expire_days
}
30 changes: 30 additions & 0 deletions fiskalhr.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,36 @@ func (fe *FiskalEntity) DisplayCertInfoKeyPoints() [][2]string {
return fe.cert.displayCertInfoKeyPoints()
}

// GetCertORG returns the organization name from the certificate.
// The organization name is typically included in the certificate's subject field.
func (fe *FiskalEntity) GetCertORG() string {
return fe.cert.certORG
}

// GetCertSERIAL returns the serial number from the certificate.
// The serial number is a unique identifier assigned by the certificate issuer.
func (fe *FiskalEntity) GetCertSERIAL() string {
return fe.cert.certSERIAL
}

// IsExpired returns whether the certificate is expired.
// This indicates if the certificate's validity period has ended.
func (fe *FiskalEntity) IsExpired() bool {
return fe.cert.expired
}

// IsExpiringSoon returns whether the certificate is expiring soon.
// This indicates if the certificate is approaching its expiration date.
func (fe *FiskalEntity) IsExpiringSoon() bool {
return fe.cert.expire_soon
}

// DaysUntilExpire returns the number of days until the certificate expires.
// This provides a countdown of days remaining before the certificate becomes invalid.
func (fe *FiskalEntity) DaysUntilExpire() uint16 {
return fe.cert.expire_days
}

// GenerateZKI generates the ZKI (Zaštitni Kod Izdavatelja) based on the given data.
// The ZKI is a unique identifier for the invoice, generated by signing the concatenated
// invoice data with the taxpayer's private key and hashing the signature.
Expand Down

0 comments on commit 077bf20

Please sign in to comment.