コード例 #1
0
        public static Dictionary <string, string> GenerateParamters(this OnPayPaymentWindow pw)
        {
            // Setup parameter list
            var windowParams = new Dictionary <string, string>
            {
                { "onpay_gatewayid", pw.GatewayId },
                { "onpay_currency", pw.Currency },
                { "onpay_amount", pw.Amount.ToString() },
                { "onpay_reference", pw.Reference },
                { "onpay_accepturl", pw.AcceptUrl },
                { "onpay_callbackurl", pw.CallbackUrl },
                { "onpay_declineurl", pw.DeclineUrl },
                { "onpay_type", pw.Type },
                { "onpay_method", pw.Method },
                { "onpay_language", pw.Language },
                { "onpay_design", pw.Design },
                { "onpay_testmode", pw.TestMode ? "1" : "0" },
                { "onpay_3dsecure", pw.SecureEnabled ? "forced" : "" }
            };

            // Generate HMAC
            var hmac = GenerateSHA1(windowParams, pw.WindowSecret);

            windowParams.Add("onpay_hmac_sha1", hmac);

            // Add custom parameters
            foreach (var item in pw.CustomKeys)
            {
                windowParams.Add(item.Key, item.Value);
            }

            return(windowParams);
        }
コード例 #2
0
        public static OnPayPaymentWindow AddCustomParameter(this OnPayPaymentWindow pw, string key, string value)
        {
            if (pw.CustomKeys == null)
            {
                pw.CustomKeys = new Dictionary <string, string>();
            }

            pw.CustomKeys.Add(key, value);

            return(pw);
        }
コード例 #3
0
 public static OnPayPaymentWindow Enable3DSecure(this OnPayPaymentWindow pw)
 {
     pw.SecureEnabled = true;
     return(pw);
 }
コード例 #4
0
 public static OnPayPaymentWindow SetLanguage(this OnPayPaymentWindow pw, OnPayLanguage language)
 {
     pw.Language = language.ToString().ToLower();
     return(pw);
 }
コード例 #5
0
 public static OnPayPaymentWindow EnableTestMode(this OnPayPaymentWindow pw)
 {
     pw.TestMode = true;
     return(pw);
 }
コード例 #6
0
 public static OnPayPaymentWindow SetMethod(this OnPayPaymentWindow pw, OnPayMethod method)
 {
     pw.Method = method.ToString().ToLower();
     return(pw);
 }
コード例 #7
0
 public static OnPayPaymentWindow SetType(this OnPayPaymentWindow pw, OnPayType type)
 {
     pw.Type = type.ToString().ToLower();
     return(pw);
 }
コード例 #8
0
 public static OnPayPaymentWindow SetReference(this OnPayPaymentWindow pw, string reference)
 {
     pw.Reference = reference;
     return(pw);
 }
コード例 #9
0
 public static OnPayPaymentWindow SetDesign(this OnPayPaymentWindow pw, string design)
 {
     pw.Design = design;
     return(pw);
 }
コード例 #10
0
 public static OnPayPaymentWindow SetDeclineUrl(this OnPayPaymentWindow pw, string declineUrl)
 {
     pw.DeclineUrl = declineUrl;
     return(pw);
 }
コード例 #11
0
 public static OnPayPaymentWindow SetAcceptUrl(this OnPayPaymentWindow pw, string acceptUrl)
 {
     pw.AcceptUrl = acceptUrl;
     return(pw);
 }
コード例 #12
0
 public static OnPayPaymentWindow SetCallbackUrl(this OnPayPaymentWindow pw, string callbackUrl)
 {
     pw.CallbackUrl = callbackUrl;
     return(pw);
 }
コード例 #13
0
 public static OnPayPaymentWindow SetAmount(this OnPayPaymentWindow pw, decimal amount)
 {
     pw.Amount = Convert.ToInt32(amount * 100);
     return(pw);
 }
コード例 #14
0
 public static OnPayPaymentWindow SetCurrency(this OnPayPaymentWindow pw, string currency)
 {
     pw.Currency = currency;
     return(pw);
 }