// This function is added for the accounting software 'Xero'
This function is added for the accounting software 'Xero'
// This function is added for the accounting software ' Xero '
func parseAdditionalTokenDataFromAccessTokenResponse(responseValues url.Values) *TokenAdditionalData {
	additionData := TokenAdditionalData{}
	expiresInValue := responseValues.Get(ExpiresInParam)
	if expiresInValue != "" {
		expiresInSeconds, err := strconv.ParseInt(expiresInValue, 10, 64)
		if err == nil {
			expiresInTime := time.Now().UTC().Add(time.Second * time.Duration(expiresInSeconds))
			additionData.ExpireTimestamp = &expiresInTime
		}
	}
	authorizationExpiresInValue := responseValues.Get(AuthorizationExpiresInParam)
	if authorizationExpiresInValue != "" {
		authorizationExpiresInSeconds, err := strconv.ParseInt(authorizationExpiresInValue, 10, 64)
		if err == nil {
			authorizationExpiresInTime := time.Now().UTC().Add(time.Second * time.Duration(authorizationExpiresInSeconds))
			additionData.AuthorizationExpireTimestamp = &authorizationExpiresInTime
		}
	}
	sessionHandle := responseValues.Get(SessionHandleParam)
	if sessionHandle != "" {
		additionData.SessionHandle = sessionHandle
	}
	if additionData.SessionHandle == "" || additionData.ExpireTimestamp == nil || additionData.AuthorizationExpireTimestamp == nil {
		return nil
	}
	return &additionData
}
func parseAdditionalTokenDataFromAccessTokenResponse ( responseValues url . Values ) * TokenAdditionalData { additionData := TokenAdditionalData { } expiresInValue := responseValues . Get ( ExpiresInParam ) if expiresInValue != " " { expiresInSeconds , err := strconv . ParseInt ( expiresInValue , 10 , 64 ) if err == nil { expiresInTime := time . Now ( ) . UTC ( ) . Add ( time . Second * time . Duration ( expiresInSeconds ) ) additionData . ExpireTimestamp = & expiresInTime } } authorizationExpiresInValue := responseValues . Get ( AuthorizationExpiresInParam ) if authorizationExpiresInValue != " " { authorizationExpiresInSeconds , err := strconv . ParseInt ( authorizationExpiresInValue , 10 , 64 ) if err == nil { authorizationExpiresInTime := time . Now ( ) . UTC ( ) . Add ( time . Second * time . Duration ( authorizationExpiresInSeconds ) ) additionData . AuthorizationExpireTimestamp = & authorizationExpiresInTime } } sessionHandle := responseValues . Get ( SessionHandleParam ) if sessionHandle != " " { additionData . SessionHandle = sessionHandle } if additionData . SessionHandle == " " || additionData . ExpireTimestamp == nil || additionData . AuthorizationExpireTimestamp == nil { return nil } return & additionData }
This function is added for the accounting software 'Xero'
This function is added for the accounting software ' Xero '