Webiant Logo Webiant Logo
  1. No results found.

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

Order.cs

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

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

/// 
/// Represents the order details
/// 
public class Order : IWebhookResource
{
    #region Properties

    /// 
    /// Gets or sets the date and time when the transaction occurred, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6).
    /// 
    [JsonProperty(PropertyName = "create_time")]
    public string CreateTime { get; set; }

    /// 
    /// Gets or sets the date and time when the transaction was last updated, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6).
    /// 
    [JsonProperty(PropertyName = "update_time")]
    public string UpdateTime { get; set; }

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

    /// 
    /// Gets or sets the instruction to process an order.
    /// 
    [JsonProperty(PropertyName = "processing_instruction")]
    public string ProcessingInstruction { get; set; }

    /// 
    /// Gets or sets the array of purchase units. Each purchase unit establishes a contract between a customer and merchant. Each purchase unit represents either a full or partial order that the customer intends to purchase from the merchant.
    /// 
    [JsonProperty(PropertyName = "purchase_units")]
    public List PurchaseUnits { 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 payment source used to fund the payment.
    /// 
    [JsonProperty(PropertyName = "payment_source")]
    public PaymentSource PaymentSource { get; set; }

    /// 
    /// Gets or sets the intent to either capture payment immediately or authorize a payment for an order after order creation.
    /// 
    [JsonProperty(PropertyName = "intent")]
    public string Intent { get; set; }

    /// 
    /// Gets or sets the customer who approves and pays for the order. The customer is also known as the payer.
    /// 
    [JsonProperty(PropertyName = "payer")]
    public Payer Payer { get; set; }

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

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

    /// 
    /// Gets or sets the API caller-provided external ID.
    /// 
    [JsonIgnore]
    public string CustomId
    {
        get => PurchaseUnits?.FirstOrDefault()?.CustomId;
        set { }
    }

    #endregion
}