コード例 #1
0
        public CurrencyCode Create(CurrencyCode currencyCode)
        {
            ECurrencyCode eCurrencyCode = ECurrencyCode(currencyCode);

            eCurrencyCode = _iDCurrencyCode.Create(eCurrencyCode);
            return(CurrencyCode(eCurrencyCode));
        }
コード例 #2
0
 public static CultureInfo?GetCultureInfo(this ECurrencyCode eCurrencyCode)
 {
     if (eCurrencyCode == ECurrencyCode.Invalid)
     {
         return(null);
     }
     return(CultureInfo.GetCultures(CultureTypes.SpecificCultures)
            .FirstOrDefault(culture => new RegionInfo(culture.LCID).ISOCurrencySymbol == eCurrencyCode.ToString()));
 }
コード例 #3
0
        /// <summary>
        /// Renders a 'Buy Now' or 'Pay Now' PayPal button.
        /// </summary>
        /// <param name="helper">Renders HTML controls in a view.</param>
        /// <param name="useSandbox">True to use the PayPal test environment as a form action, otherwise false.</param>
        /// <param name="buttonType">The type of button to render.</param>
        /// <returns>The HTML that renders a PayPal button.</returns>
        public static MvcHtmlString PayPalButton(this HtmlHelper helper,
            bool useSandbox, EButtonType buttonType, string email,
            string itemName, string itemNumber, float amount, ECurrencyCode currency,
            string completeUrl, string cancelUrl, string ipnUrl)
        {
            string action = useSandbox ?
                "https://www.sandbox.paypal.com/cgi-bin/webscr" :
                "https://www.paypal.com/cgi-bin/webscr";
            StringBuilder html = new StringBuilder("\r\n<form action=\"").Append(action).Append("\">");
            string cmd;
            string buttonImageUrl;
            string pixelImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" :
                "https://www.paypal.com/en_US/i/scr/pixel.gif";

            switch (buttonType)
            {
                case EButtonType.BuyNow:
                    cmd = "_xclick";
                    buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" :
                        "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif";
                    break;
                case EButtonType.PayNow:
                    cmd = "_xclick";
                    buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" :
                      "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif";
                    break;
                default:
                    cmd = "_xclick";
                    buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" :
                      "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif";
                    break;
            }

            html.Append("\r\n<input type=\"hidden\" name=\"cmd\" value=\"").Append(cmd).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"business\" value=\"").Append(email).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"item_name\" value=\"").Append(itemName).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"item_number\" value=\"").Append(itemNumber).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"amount\" value=\"").Append(amount.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"currency_code\" value=\"").Append(currency).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"return\" value=\"").Append(completeUrl).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"cancel_return\" value=\"").Append(cancelUrl).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"notify_url\" value=\"").Append(ipnUrl).Append("\" />");

            // By default do not prompt customers to include a note with their payment.
            // Remove this line or set the value to 0 to enable notes.
            html.Append("\r\n<input type=\"hidden\" name=\"no_note\" value=\"1\" />");

            // Render the payment button.
            html.Append("\r\n<input type=\"image\" src=\"").Append(buttonImageUrl).Append("\" name=\"submit\" alt=\"PayPal — The safer, easier way to pay online.\" />");

            // Renders a one-pixel image that should probably be there for tracking purposes.
            html.Append("\r\n<input type=\"image\" src=\"").Append(pixelImageUrl).Append("\" width=\"1\" height=\"1\" alt=\"\" />");

            html.Append("\r\n</form>");

            return new MvcHtmlString(html.ToString());
        }
コード例 #4
0
        public static CurrencyCode Convert(this ECurrencyCode eCurrencyCode)
        {
            var value = eCurrencyCode.ToString();

            if (Enum.TryParse <CurrencyCode>(value, out var result))
            {
                return(result);
            }
            throw new ArgumentOutOfRangeException(nameof(eCurrencyCode), eCurrencyCode, null);
        }
コード例 #5
0
        private CurrencyCode CurrencyCode(ECurrencyCode eCurrencyCode)
        {
            CurrencyCode returnCurrencyCode = new CurrencyCode
            {
                CurrencyId    = eCurrencyCode.CurrencyId,
                CurrencyCodes = eCurrencyCode.CurrencyCodes
            };

            return(returnCurrencyCode);
        }
コード例 #6
0
        private ECurrencyCode ECurrencyCode(CurrencyCode currencyCode)
        {
            ECurrencyCode returnECurrencyCode = new ECurrencyCode
            {
                CurrencyId    = currencyCode.CurrencyId,
                CurrencyCodes = currencyCode.CurrencyCodes
            };

            return(returnECurrencyCode);
        }
コード例 #7
0
ファイル: IClientBilling.cs プロジェクト: bmk10/hl2sb-src-1
 public bool GetReceiptLineItemInfo(UInt32 nReceiptIndex, UInt32 nLineItemIndex, ref UInt32 nPackageID, ref UInt32 nBaseCost, ref UInt32 nDiscount, ref UInt32 nTax, ref UInt32 nShipping, ref ECurrencyCode eCurrencyCode)
 {
     return(this.GetFunction <NativeGetReceiptLineItemInfoUUUUUUUE>(this.Functions.GetReceiptLineItemInfo38)(this.ObjectAddress, nReceiptIndex, nLineItemIndex, ref nPackageID, ref nBaseCost, ref nDiscount, ref nTax, ref nShipping, ref eCurrencyCode));
 }
コード例 #8
0
        public CurrencyCode Read(int currencyId)
        {
            ECurrencyCode eCurrencyCode = _iDCurrencyCode.Read <ECurrencyCode>(a => a.CurrencyId == currencyId);

            return(CurrencyCode(eCurrencyCode));
        }
コード例 #9
0
 public bool GetReceiptLineItemInfo(UInt32 nReceiptIndex, UInt32 nLineItemIndex, ref UInt32 nPackageID, ref UInt32 nBaseCost, ref UInt32 nDiscount, ref UInt32 nTax, ref UInt32 nShipping, ref ECurrencyCode eCurrencyCode, ref UInt32 punAppId, StringBuilder pchDescription, StringBuilder pchCouponInfoURL)
 {
     return(this.GetFunction <NativeGetReceiptLineItemInfoUUUUUUUEUSS>(this.Functions.GetReceiptLineItemInfo35)(this.ObjectAddress, nReceiptIndex, nLineItemIndex, ref nPackageID, ref nBaseCost, ref nDiscount, ref nTax, ref nShipping, ref eCurrencyCode, ref punAppId, pchDescription, pchCouponInfoURL));
 }
コード例 #10
0
        /// <summary>
        /// Renders a 'Buy Now' or 'Pay Now' PayPal button.
        /// </summary>
        /// <param name="helper">Renders HTML controls in a view.</param>
        /// <param name="useSandbox">True to use the PayPal test environment as a form action, otherwise false.</param>
        /// <param name="buttonType">The type of button to render.</param>
        /// <returns>The HTML that renders a PayPal button.</returns>
        public static MvcHtmlString PayPalButton(this HtmlHelper helper,
                                                 bool useSandbox, EButtonType buttonType, string email,
                                                 string itemName, string itemNumber, float amount, ECurrencyCode currency,
                                                 string completeUrl, string cancelUrl, string ipnUrl)
        {
            string action = useSandbox ?
                            "https://www.sandbox.paypal.com/cgi-bin/webscr" :
                            "https://www.paypal.com/cgi-bin/webscr";
            StringBuilder html = new StringBuilder("\r\n<form action=\"").Append(action).Append("\">");
            string        cmd;
            string        buttonImageUrl;
            string        pixelImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" :
                                          "https://www.paypal.com/en_US/i/scr/pixel.gif";

            switch (buttonType)
            {
            case EButtonType.BuyNow:
                cmd            = "_xclick";
                buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" :
                                 "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif";
                break;

            case EButtonType.PayNow:
                cmd            = "_xclick";
                buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif" :
                                 "https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif";
                break;

            default:
                cmd            = "_xclick";
                buttonImageUrl = useSandbox ? "https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" :
                                 "https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif";
                break;
            }

            html.Append("\r\n<input type=\"hidden\" name=\"cmd\" value=\"").Append(cmd).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"business\" value=\"").Append(email).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"item_name\" value=\"").Append(itemName).Append("\" />");
            //html.Append("\r\n<input type=\"hidden\" name=\"item_number\" value=\"").Append(itemNumber).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"amount\" value=\"").Append(amount.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"currency_code\" value=\"").Append(currency).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"return\" value=\"").Append(completeUrl).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"cancel_return\" value=\"").Append(cancelUrl).Append("\" />");
            html.Append("\r\n<input type=\"hidden\" name=\"notify_url\" value=\"").Append(ipnUrl).Append("\" />");

            // By default do not prompt customers to include a note with their payment.
            // Remove this line or set the value to 0 to enable notes.
            html.Append("\r\n<input type=\"hidden\" name=\"no_note\" value=\"1\" />");

            // Render the payment button.
            html.Append("\r\n<input type=\"image\" src=\"").Append(buttonImageUrl).Append("\" name=\"submit\" alt=\"PayPal — The safer, easier way to pay online.\" />");

            // Renders a one-pixel image that should probably be there for tracking purposes.
            html.Append("\r\n<input type=\"image\" src=\"").Append(pixelImageUrl).Append("\" width=\"1\" height=\"1\" alt=\"\" />");

            html.Append("\r\n</form>");

            return(new MvcHtmlString(html.ToString()));
        }