using Newtonsoft.Json; namespace Nop.Plugin.Payments.PayPalCommerce.Services.Api.Models; /// /// Represents the access token /// public class AccessToken { #region Properties /// /// Gets or sets the token /// [JsonProperty(PropertyName = "access_token")] public string Token { get; set; } /// /// Gets or sets the token type /// [JsonProperty(PropertyName = "token_type")] public string TokenType { get; set; } /// /// Gets or sets the application id /// [JsonProperty(PropertyName = "app_id")] public string AppId { get; set; } /// /// Gets or sets the user ID token /// [JsonProperty(PropertyName = "id_token")] public string UserIdToken { get; set; } /// /// Gets or sets the scope /// [JsonProperty(PropertyName = "scope")] public string Scope { get; set; } /// /// Gets or sets the nonce /// [JsonProperty(PropertyName = "nonce")] public string Nonce { get; set; } /// /// Gets or sets the time (in seconds) until the access token expires /// [JsonProperty(PropertyName = "expires_in")] public int ExpiresIn { get; set; } /// /// Gets or sets the creation date and time /// [JsonIgnore] private DateTime CreateDate { get; set; } = DateTime.UtcNow; /// /// Gets a value indicating whether the access token is expired /// [JsonIgnore] public bool IsExpired => DateTime.UtcNow > CreateDate.Add(TimeSpan.FromSeconds(ExpiresIn)); #endregion }