public CurrencyCode Create(CurrencyCode currencyCode) { ECurrencyCode eCurrencyCode = ECurrencyCode(currencyCode); eCurrencyCode = _iDCurrencyCode.Create(eCurrencyCode); return(CurrencyCode(eCurrencyCode)); }
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())); }
/// <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()); }
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); }
private CurrencyCode CurrencyCode(ECurrencyCode eCurrencyCode) { CurrencyCode returnCurrencyCode = new CurrencyCode { CurrencyId = eCurrencyCode.CurrencyId, CurrencyCodes = eCurrencyCode.CurrencyCodes }; return(returnCurrencyCode); }
private ECurrencyCode ECurrencyCode(CurrencyCode currencyCode) { ECurrencyCode returnECurrencyCode = new ECurrencyCode { CurrencyId = currencyCode.CurrencyId, CurrencyCodes = currencyCode.CurrencyCodes }; return(returnECurrencyCode); }
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)); }
public CurrencyCode Read(int currencyId) { ECurrencyCode eCurrencyCode = _iDCurrencyCode.Read <ECurrencyCode>(a => a.CurrencyId == currencyId); return(CurrencyCode(eCurrencyCode)); }
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)); }
/// <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())); }