Skip to content

Commit

Permalink
refactor(merchant-sdk): Removed unused code from Session
Browse files Browse the repository at this point in the history
EC-74
  • Loading branch information
danicretu committed Aug 15, 2024
1 parent 5f96267 commit 64aae54
Showing 1 changed file with 0 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.gini.android.merchant.sdk.api.authorization.model

import net.gini.android.core.api.authorization.apimodels.SessionToken
import java.util.Date

class Session(
Expand All @@ -11,23 +10,4 @@ class Session(
) {
/** The expiration date of the access token. */
val expirationDate: Date = Date(expirationDate.time)

/**
* Uses the current locale's time to check whether or not this session has already expired.
*
* @return Whether or not the session has already expired.
*/
fun hasExpired(): Boolean {
val now = Date()
return now.after(expirationDate)
}

companion object {
fun fromAPIResponse(apiResponse: SessionToken): Session {
val accessToken = apiResponse.accessToken
val now = Date()
val expirationTime = now.time + apiResponse.expiresIn * 1000
return Session(accessToken, Date(expirationTime))
}
}
}

0 comments on commit 64aae54

Please sign in to comment.