Webiant Logo Webiant Logo
  1. No results found.

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

PayPalCommerceDefaults.cs

using Nop.Core;

namespace Nop.Plugin.Payments.PayPalCommerce;

/// 
/// Represents plugin constants
/// 
public class PayPalCommerceDefaults
{
    /// 
    /// Gets the plugin system name
    /// 
    public static string SystemName => "Payments.PayPalCommerce";

    /// 
    /// Gets the user agent used to request third-party services
    /// 
    public static string UserAgent => $"nopCommerce-{NopVersion.CURRENT_VERSION}";

    /// 
    /// Gets the nopCommerce partner code
    /// 
    public static string PartnerCode => "NopCommerce_PPCP";

    /// 
    /// Gets the configuration route name
    /// 
    public static string ConfigurationRouteName => "Plugin.Payments.PayPalCommerce.Configure";

    /// 
    /// Gets the webhook route name
    /// 
    public static string WebhookRouteName => "Plugin.Payments.PayPalCommerce.Webhook";

    /// 
    /// Gets the one page checkout route name
    /// 
    public static string OnePageCheckoutRouteName => "CheckoutOnePage";

    /// 
    /// Gets the shopping cart route name
    /// 
    public static string ShoppingCartRouteName => "ShoppingCart";

    /// 
    /// Gets the session key to get process payment request
    /// 
    public static string PaymentRequestSessionKey => "OrderPaymentInfo";

    /// 
    /// Gets the name of a generic attribute to store the refund identifier
    /// 
    public static string RefundIdAttributeName => "PayPalCommerceRefundId";

    /// 
    /// Gets the service js script URL
    /// 
    public static string ServiceScriptUrl => "https://www.paypal.com/sdk/js";

    /// 
    /// Gets a default period (in seconds) before the request times out
    /// 
    public static int RequestTimeout => 10;

    /// 
    /// Gets webhook event names to subscribe
    /// 
    public static List WebhookEventNames =>
    [
    "CHECKOUT.ORDER.APPROVED",
    "CHECKOUT.ORDER.COMPLETED",
    "PAYMENT.AUTHORIZATION.CREATED",
    "PAYMENT.AUTHORIZATION.VOIDED",
    "PAYMENT.CAPTURE.COMPLETED",
    "PAYMENT.CAPTURE.DENIED",
    "PAYMENT.CAPTURE.PENDING",
    "PAYMENT.CAPTURE.REFUNDED"
    ];

    /// 
    /// Gets a list of currencies that do not support decimals. 
    /// Refer to https://developer.paypal.com/docs/integration/direct/rest/currency-codes/ for more information 
    /// 
    public static List CurrenciesWithoutDecimals => ["HUF", "JPY", "TWD"];

    #region Onboarding

    /// 
    /// Represents onboarding constants
    /// 
    public class Onboarding
    {
        /// 
        /// Gets the base URL of onboarding services
        /// 
        public static string ServiceUrl => "https://www.nopcommerce.com/";

        /// 
        /// Gets the onboarding js script URL
        /// 
        public static string ScriptUrl => "https://www.sandbox.paypal.com/webapps/merchantboarding/js/lib/lightbox/partner.js";

        /// 
        /// Gets a period (in seconds) before the onboarding request times out
        /// 
        public static int RequestTimeout => 20;
    }

    #endregion
}