Webiant Logo Webiant Logo
  1. No results found.

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

PaymentToken.cs

using Newtonsoft.Json;
using Nop.Plugin.Payments.PayPalCommerce.Services.Api.Models.Enums;

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

/// 
/// Represents the payment method token
/// 
public class PaymentToken : IWebhookResource
{
    #region Properties

    /// 
    /// Gets or sets the unique ID for the vault token.
    /// 
    [JsonProperty(PropertyName = "id")]
    public string Id { get; set; }

    /// 
    /// Gets or sets the status of the payment token.
    /// 
    [JsonProperty(PropertyName = "status")]
    public string Status { get; set; }

    /// 
    /// Gets or sets the vaulted payment method details.
    /// 
    [JsonProperty(PropertyName = "payment_source")]
    public PaymentSource PaymentSource { get; set; }

    /// 
    /// Gets or sets the array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links). To complete payer approval, use the `approve` link with the `GET` method.
    /// 
    [JsonProperty(PropertyName = "links")]
    public List Links { get; set; }

    /// 
    /// Gets or sets the customer in merchant's or partner's system of records.
    /// 
    [JsonProperty(PropertyName = "customer")]
    public Payer Customer { get; set; }

    /// 
    /// Gets or sets the ordinal number of customers' payment source for sorting.
    /// 
    [JsonProperty(PropertyName = "ordinal")]
    public int? Ordinal { get; set; }

    /// 
    /// Gets or sets the unique ID for the owner ID.
    /// 
    [JsonProperty(PropertyName = "owner_id")]
    public string OwnerId { get; set; }

    /// 
    /// Gets or sets the metadata.
    /// 
    [JsonProperty(PropertyName = "metadata")]
    public PaymentTokenMetadata Metadata { get; set; }

    /// 
    /// Gets or sets the API caller-provided external ID.
    /// 
    [JsonIgnore]
    public string CustomId { get; set; }

    /// 
    /// Gets the payer-action URL.
    /// 
    [JsonIgnore]
    public string PayerActionUrl => Status?.ToUpper() == PaymentTokenStatusType.PAYER_ACTION_REQUIRED.ToString()
        ? Links?.FirstOrDefault(link => string.Equals(link.Rel, "approve", StringComparison.InvariantCultureIgnoreCase))?.Href
        : null;

    #endregion
}