Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

IdentityToken.cs

using Newtonsoft.Json;

namespace Nop.Plugin.Payments.PayPalCommerce.Services.Api.Models;

/// 
/// Represents the client token to uniquely identify the customer
/// 
public class IdentityToken
{
    #region Properties

    /// 
    /// Gets or sets the client token.
    /// 
    [JsonProperty(PropertyName = "client_token")]
    public string ClientToken { get; set; }

    /// 
    /// Gets or sets the time (in seconds) until the client 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 client token is expired
    /// 
    [JsonIgnore]
    public bool IsExpired => DateTime.UtcNow > CreateDate.Add(TimeSpan.FromSeconds(ExpiresIn));

    #endregion
}