当前位置: 首页>>代码示例>>C#>>正文


C# NVPCodec类代码示例

本文整理汇总了C#中NVPCodec的典型用法代码示例。如果您正苦于以下问题:C# NVPCodec类的具体用法?C# NVPCodec怎么用?C# NVPCodec使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NVPCodec类属于命名空间,在下文中一共展示了NVPCodec类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ECGetExpressCheckout

        public PayPalResponse ECGetExpressCheckout(string token)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = getProfile();
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] = "84.0";
            encoder["METHOD"] = "GetExpressCheckoutDetails";

            // Add request-specific fields to the request.
            encoder["TOKEN"] = token; // Pass the token returned in SetExpressCheckout.

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            PayPalResponse response = new PayPalResponse {
                token = (decoder["TOKEN"] != null) ? decoder["TOKEN"] : "",
                acknowledgement = decoder["ACK"],
                first = decoder["FIRSTNAME"],
                last = decoder["LASTNAME"],
                email = decoder["EMAIL"],
                amount = decoder["PAYMENTREQUEST_0_AMT"],
                payerID = decoder["PAYERID"]
            };
            return response;
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:30,代码来源:Paypal.cs

示例2: DoCheckoutPayment

    public bool DoCheckoutPayment(string finalPaymentAmount, string token, string PayerID, ref NVPCodec decoder, ref string retMsg)
    {
        if (bSandbox)
        {
            pEndPointURL = pEndPointURL_SB;
        }

        NVPCodec encoder = new NVPCodec();
        encoder["METHOD"] = "DoExpressCheckoutPayment";
        encoder["TOKEN"] = token;
        encoder["PAYERID"] = PayerID;
        encoder["PAYMENTREQUEST_0_AMT"] = finalPaymentAmount;
        encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
        encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";

        string pStrrequestforNvp = encoder.Encode();
        string pStresponsenvp = HttpCall(pStrrequestforNvp);

        decoder = new NVPCodec();
        decoder.Decode(pStresponsenvp);

        string strAck = decoder["ACK"].ToLower();
        if (strAck != null && (strAck == "success" || strAck == "successwithwarning"))
        {
            return true;
        }
        else
        {
            retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" +
                "Desc=" + decoder["L_SHORTMESSAGE0"] + "&" +
                "Desc2=" + decoder["L_LONGMESSAGE0"];

            return false;
        }
    }
开发者ID:w0270771,项目名称:projects_for_portfolio,代码行数:35,代码来源:PayPalFunctions.cs

示例3: GetTransactionDetailsCode

        public string GetTransactionDetailsCode(string transactionID)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment="sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "51.0";
            encoder["METHOD"] =  "GetTransactionDetails";

            // Add request-specific fields to the request.
            encoder["TRANSACTIONID"] =  transactionID;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:Goldcap,项目名称:Constellation,代码行数:34,代码来源:GetTransactionDetails.cs

示例4: GetBalanceCode

        public string GetBalanceCode()
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment="sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "51.0";
            encoder["METHOD"] =  "GetBalance";
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:Goldcap,项目名称:Constellation,代码行数:27,代码来源:GetBalance.cs

示例5: ECSetExpressCheckout_PayLaterCode

        public string ECSetExpressCheckout_PayLaterCode(string returnURL,string cancelURL,string amount,string paymentType,string currencyCode)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment="sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "51.0";
            encoder["METHOD"] =  "SetExpressCheckout";
            encoder["RETURNURL"] =  returnURL;
            encoder["CANCELURL"] =  cancelURL;
            encoder["AMT"] =  amount;
            encoder["PAYMENTACTION"] =  paymentType;
            encoder["CURRENCYCODE"] =  currencyCode;
            encoder["L_PROMOCODE0"] = "101";
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:Goldcap,项目名称:Constellation,代码行数:33,代码来源:ECSetExpressCheckout_PayLater.cs

示例6: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Request.QueryString["Code"].ToLower() == "Cancel".ToLower())
         {
             return;
         }
         else if (Request.QueryString["Code"].ToLower() == "Sucess".ToLower())
         {
             lblAppName.InnerHtml = Session["AppName"].ToString();
             imgApp.Src = Session["AppIcon"].ToString();
             lblValidationCode.Text = Session.SessionID;
             return;
         }
         else if (Request.QueryString["Code"].ToLower() == "Error".ToLower())
         {
             lblAppName.InnerHtml = Session["AppIcon"].ToString();
             imgApp.Src = Session["AppIcon"].ToString();
             lblValidationCode.Text = Session["errorresult"].ToString();
             return;
         }
         Session["AppName"] = Request.QueryString["AppName"].ToString();
         Session["AppIcon"] = Request.QueryString["AppIcon"].ToString();
         string url = Request.Url.Scheme + "://" + Request.Url.Host + ":" + Request.Url.Port + "";
         string cancelURL = url + ResolveUrl("paypal.aspx") + "?Code=Cancel";
         string returnURL = url + ResolveUrl("paypal.aspx") + "?Code=Sucess";
         ECSetExpressCheckout objset = new ECSetExpressCheckout();
         NVPCodec decoder = new NVPCodec();
         decoder = objset.ECSetExpressCheckoutCode(returnURL, Request.QueryString["AppName"].ToString(), System.Configuration.ConfigurationManager.AppSettings["AppCode"].ToString(), cancelURL, Request.QueryString["Price"].ToString(), "Sale", Request.QueryString["Currency"].ToString());
         string strAck = decoder["ACK"];
         if (strAck != null && (strAck == "Success" || strAck == "SuccessWithWarning"))
         {
             Session["TOKEN"] = decoder["TOKEN"];
             string host1 = "www." + ASPDotNetSamples.AspNet.Constants.ENVIRONMENT + ".paypal.com";
             //
             string ECURL = string.Empty;
             if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
             {
                 ECURL = "https://" + host1 + "/cgi-bin/webscr?cmd=_express-checkout" + "&token=" + decoder["TOKEN"];
             }
             else
             {
                 ECURL = "https://www.paypal.com/webscr?cmd=_express-checkout" + "&token=" + decoder["TOKEN"];
             }
             Response.Redirect(ECURL, false);
         }
         else
         {
             Session["errorresult"] = decoder;
             string pStrResQue = "API=" + ASPDotNetSamples.AspNet.Util.BuildResponse(decoder, "Set", "");
             Response.Redirect("paypal.aspx?Code=Error");
         }
     }
     catch (Exception ex)
     {
         Session["errorresult"] = "API=" + ex.Message;
         Response.Redirect("paypal.aspx?Code=Error");
     }
 }
开发者ID:Esri,项目名称:tax-parcel-viewer,代码行数:60,代码来源:paypal.aspx.cs

示例7: CancelAuthorization

    public NVPCodec CancelAuthorization(string transactionID, string note)
    {
        NVPCallerServices caller = new NVPCallerServices();
        IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
        /*
         WARNING: Do not embed plaintext credentials in your application code.
         Doing so is insecure and against best practices.
         Your API credentials must be handled securely. Please consider
         encrypting them for use in any production environment, and ensure
         that only authorized individuals may view or modify them.
         */

        // Set up your API credentials, PayPal end point, API operation and version.
        caller.APIProfile = profile;

        NVPCodec encoder = new NVPCodec();
        encoder["VERSION"] = "51.0";
        encoder["METHOD"] = "DoVoid";

        // Add request-specific fields to the request.
        encoder["AUTHORIZATIONID"] = transactionID;
        encoder["NOTE"] = note;
        encoder["TRXTYPE"] = "V";

        // Execute the API operation and obtain the response.
        string pStrrequestforNvp = encoder.Encode();
        string pStresponsenvp = caller.Call(pStrrequestforNvp);

        NVPCodec decoder = new NVPCodec();
        return decoder;
    }
开发者ID:aleksczajka,项目名称:Hippo-Code---OLD,代码行数:31,代码来源:AuthorizePayPal.cs

示例8: ShortcutExpressCheckout

 public bool ShortcutExpressCheckout(string amt, ref string token, ref string 
retMsg) 
 { if (bSandbox)
 { 
 pEndPointURL = pEndPointURL_SB; 
 host = host_SB; 
 } 
 
 string returnURL = "http://localhost:1234/Checkout/CheckoutReview.aspx"; 
 string cancelURL = "http://localhost:1234/Checkout/CheckoutCancel.aspx"; 
 
 NVPCodec encoder = new NVPCodec(); 
 encoder["METHOD"] = "SetExpressCheckout"; 
 encoder["RETURNURL"] = returnURL; 
 encoder["CANCELURL"] = cancelURL; 
 encoder["BRANDNAME"] = "Wingtip Toys Sample Application"; 
 encoder["PAYMENTREQUEST_0_AMT"] = amt; 
 encoder["PAYMENTREQUEST_0_ITEMAMT"] = amt; 
 encoder["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale"; 
 encoder["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD"; 
 
 // Get the Shopping Cart Products 
 using (ClassiqWheels.Logic.ShoppingCartActions myCartOrders = new
ClassiqWheels.Logic.ShoppingCartActions()) 
 { 
 List<CartItem> myOrderList = myCartOrders.GetCartItems(); 
 
 for (int i = 0; i < myOrderList.Count; i++) 
 { 
 encoder["L_PAYMENTREQUEST_0_NAME" + i] = 
myOrderList[i].Product.ProductName.ToString(); 
 encoder["L_PAYMENTREQUEST_0_AMT" + i] = 
myOrderList[i].Product.UnitPrice.ToString(); 
 encoder["L_PAYMENTREQUEST_0_QTY" + i] = 
myOrderList[i].Quantity.ToString(); 
 } 
 } 
string pStrrequestforNvp = encoder.Encode(); 
 string pStresponsenvp = HttpCall(pStrrequestforNvp); 
 
 NVPCodec decoder = new NVPCodec(); 
 decoder.Decode(pStresponsenvp); 
 
 string strAck = decoder["ACK"].ToLower(); 
 if (strAck != null && (strAck == "success" || strAck == 
"successwithwarning")) 
 { 
 token = decoder["TOKEN"];
     string ECURL = "https://" + host + "/cgi-bin/webscr?cmd=_express-checkout"+"&token="+ token;
     retMsg = ECURL; 
 return true; 
     } 
 else 
 { 
 retMsg = "ErrorCode=" + decoder["L_ERRORCODE0"] + "&" + 
 "Desc=" + decoder["L_SHORTMESSAGE0"] + "&" + 
 "Desc2=" + decoder["L_LONGMESSAGE0"]; 
 return false; 
 } 
开发者ID:nvernooy,项目名称:ClassiqWheels,代码行数:59,代码来源:PayPalFunctions.cs

示例9: ECSetExpressCheckoutCode

        public NVPCodec ECSetExpressCheckoutCode(string returnURL, string appName,string appCode, string cancelURL, string appAMT, string paymentType, string currencyCode)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
            {
                profile.APIUsername = "sdk-three_api1.sdk.com";
                profile.APIPassword = "QFZCWN5HZM8VBG7Q";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment = "sandbox";
            }
            else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
            {

                profile.APIUsername = "murty.korada_api1.cybertech.com";
                profile.APIPassword = "KKKC8PY8E4R9LN48";
                profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
                profile.Environment = "live";
            }
            else
            {
                profile.APIUsername = "sdk-three_api1.sdk.com";
                profile.APIPassword = "QFZCWN5HZM8VBG7Q";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment = "sandbox";
            }
            caller.APIProfile = profile;
            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "65.1";
            encoder["METHOD"] =  "SetExpressCheckout";
            // Add request-specific fields to the request.
            encoder["RETURNURL"] =  returnURL;
            encoder["CANCELURL"] =  cancelURL;
            encoder["AMT"] = appAMT;
            encoder["ITEMCATEGORY"] = "Digital";
            encoder["L_NAME0"] = appName;
            encoder["L_NUMBER0"] = appCode;
            encoder["L_AMT0"] = appAMT;
            encoder["L_QTY0"] ="1";
            encoder["PAYMENTACTION"] =  paymentType;
            encoder["CURRENCYCODE"] =  currencyCode;
            encoder["SOLUTIONTYPE"] = "Sole";
            // Execute the API operation and obtain the response.
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder;
        }
开发者ID:tonyfaby,项目名称:tax-parcel-viewer,代码行数:59,代码来源:ECSetExpressCheckout.cs

示例10: ConfirmPayment

    /// <summary>
    /// ConfirmPayment: The method that calls DoExpressCheckoutPayment, invoked from the 
    /// Billing Page EC placement
    /// </summary>
    /// <param name="token"></param>
    /// <param ref name="retMsg"></param>
    /// <returns></returns>
    public bool ConfirmPayment(string finalPaymentAmount, string token, string PayerId, ref NVPCodec decoder, ref string retMsg )
    {
        if (Env == "pilot")
        {
            pendpointurl = "https://pilot-payflowpro.paypal.com";
        }

        NVPCodec encoder = new NVPCodec();

        encoder["TOKEN"] = token;
        encoder["TENDER"] = "P";
        encoder["ACTION"] = "D";
        if ("Authorization" == "Sale")
        {
            encoder["TRXTYPE"] = "A";
        }
        else /* sale */
        {
            encoder["TRXTYPE"] = "S";
        }
        encoder["PAYERID"] = PayerId;
        encoder["AMT"] = finalPaymentAmount;

        // unique request ID
        string unique_id;

        if (HttpContext.Current.Session["unique_id"] == null)
        {
            System.Guid uid = System.Guid.NewGuid();
            unique_id = uid.ToString();
            HttpContext.Current.Session["unique_id"] = unique_id;
        }
        else
        {
            unique_id = (string)HttpContext.Current.Session["unique_id"];
        }

        string pStrrequestforNvp = encoder.Encode();
        string pStresponsenvp = HttpCall(pStrrequestforNvp,unique_id);

        decoder = new NVPCodec();
        decoder.Decode(pStresponsenvp);

        string strAck = decoder["RESULT"].ToLower();
        if (strAck != null && strAck == "0")
        {
            return true;
        }
        else
        {
            retMsg = "ErrorCode=" + strAck + "&" +
                "Desc=" + decoder["RESPMSG"];

            return false;
        }
    }
开发者ID:rajalekshminovasoft,项目名称:CJ,代码行数:63,代码来源:paypalfunctions.cs

示例11: MassPayCode

        public string MassPayCode(string emailSubject,string receiverType,string currencyCode,string ReceiverEmail0,string amount0,string UniqueID0,string Note0,string ReceiverEmail1,string amount1,string UniqueID1,string Note1)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment="sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "51.0";
            encoder["METHOD"] =  "MassPay";

            // Add request-specific fields to the request.
            encoder["EMAILSUBJECT"] =  emailSubject;
            encoder["RECEIVERTYPE"] =  receiverType;
            encoder["CURRENCYCODE"]=currencyCode;

            if(ReceiverEmail0.Length>0)
            {
                encoder["L_EMAIL0"] =  ReceiverEmail0;
                encoder["L_Amt0"] =  amount0;
                encoder["L_UNIQUEID0"] =  UniqueID0;
                encoder["L_NOTE0"] =  Note0;
            }

            if(ReceiverEmail1.Length>0)
            {
                encoder["L_EMAIL1"] =  ReceiverEmail1;
                encoder["L_Amt1"] =  amount1;
                encoder["L_UNIQUEID1"] =  UniqueID1;
                encoder["L_NOTE1"] =  Note1;
            }

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:Goldcap,项目名称:Constellation,代码行数:52,代码来源:MassPay.cs

示例12: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            // Verify user has completed the checkout process.
            if (Session["userCheckoutCompleted"] != "true")
            {
                Session["userCheckoutCompleted"] = "";
                Response.Redirect("CheckoutError.aspx?" + "Desc=Unvalidated%20Checkout.");
            }

            NVPAPICaller payPalCaller = new NVPAPICaller();

            string retMsg = "";
            string token = "";
            string finalPaymentAmount = "";
            string PayerID = "";
            NVPCodec decoder = new NVPCodec();

            token = Session["token"].ToString();
            PayerID = Session["payerId"].ToString();
            finalPaymentAmount = Session["payment_amt"].ToString();

            bool ret = payPalCaller.DoCheckoutPayment(finalPaymentAmount, token, PayerID, ref decoder, ref retMsg);
            if (ret)
            {
                // Retrieve PayPal confirmation value.
                string PaymentConfirmation = decoder["PAYMENTINFO_0_TRANSACTIONID"].ToString();
                TransactionId.Text = PaymentConfirmation;

                // Get dataaccess context.
                DataAccess da = new DataAccess();
                Customer aCustomer = (Customer)Session["Customer"];
                aCustomer.Orders[0].OrderID = PaymentConfirmation;
                aCustomer = CartFunctions.setOrderId(aCustomer, PaymentConfirmation);
                // Add order to DB.

                da.addCustomer(aCustomer);
                da.addOrder(aCustomer);
                da.addOrderline(aCustomer);

                // Clear Order

                aCustomer = CartFunctions.clearOrder(aCustomer);

            }
            else
            {
                Response.Redirect("CheckoutError.aspx?" + retMsg);
            }
        }
    }
开发者ID:nelson9,项目名称:LidiFlu,代码行数:52,代码来源:CheckoutComplete.aspx.cs

示例13: ECGetExpressCheckoutCode

        public NVPCodec ECGetExpressCheckoutCode(string token)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "T")
            {
                profile.APIUsername = "sdk-three_api1.sdk.com";
                profile.APIPassword = "QFZCWN5HZM8VBG7Q";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment = "sandbox";
            }
            else if (System.Configuration.ConfigurationManager.AppSettings["ENVIRONMENT"].ToString() == "L")
            {
                profile.APIUsername = "murty.korada_api1.cybertech.com";
                profile.APIPassword = "KKKC8PY8E4R9LN48";
                profile.APISignature = "AFcWxV21C7fd0v3bYYYRCpSSRl31Ab5GxWPc-1XSb8rJctwNCFHIYb84";
                profile.Environment = "live";
            }
            else
            {
                profile.APIUsername = "sdk-three_api1.sdk.com";
                profile.APIPassword = "QFZCWN5HZM8VBG7Q";
                profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
                profile.Environment = "sandbox";
            }
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "65.1";
            encoder["METHOD"] =  "GetExpressCheckoutDetails";

            // Add request-specific fields to the request.
            encoder["TOKEN"] =  token; // Pass the token returned in SetExpressCheckout.

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder;
        }
开发者ID:tonyfaby,项目名称:tax-parcel-viewer,代码行数:51,代码来源:ECGetExpressCheckout.cs

示例14: ECDoExpressCheckout

        public string ECDoExpressCheckout(string token, string payerID, string amount, Cart cart)
        {
            Settings settings = new Settings();
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = getProfile();
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder.Add("VERSION","84.0");
            encoder.Add("METHOD","DoExpressCheckoutPayment");

            // Add request-specific fields to the request.
            encoder.Add("TOKEN",token);
            encoder.Add("PAYERID",payerID);
            encoder.Add("RETURNURL",getSiteURL() + "Payment/PayPalCheckout");
            encoder.Add("CANCELURL",getSiteURL() + "Payment");
            encoder.Add("PAYMENTREQUEST_0_AMT",amount);
            encoder.Add("PAYMENTREQUEST_0_PAYMENTACTION","Sale");
            encoder.Add("PAYMENTREQUEST_0_CURRENCYCODE","USD");
            encoder.Add("BRANDNAME",settings.Get("SiteName"));
            encoder.Add("LOGIN","Login");
            encoder.Add("HDRIMG",settings.Get("EmailLogo"));
            encoder.Add("CUSTOMERSERVICENUMBER",settings.Get("PhoneNumber"));
            encoder.Add("PAYMENTREQUEST_0_SHIPPINGAMT",cart.shipping_price.ToString());
            encoder.Add("PAYMENTREQUEST_0_DESC","Your " + settings.Get("SiteName") + " Order");
            encoder.Add("ALLOWNOTE","0");
            encoder.Add("NOSHIPPING","1");
            int count = 0;
            decimal total = 0;
            foreach (CartItem item in cart.CartItems) {
                encoder.Add("L_PAYMENTREQUEST_0_NUMBER" + count, item.partID.ToString());
                encoder.Add("L_PAYMENTREQUEST_0_NAME" + count, item.shortDesc);
                encoder.Add("L_PAYMENTREQUEST_0_AMT" + count, String.Format("{0:N2}", item.price));
                encoder.Add("L_PAYMENTREQUEST_0_QTY" + count, item.quantity.ToString());
                encoder.Add("L_PAYMENTREQUEST_0_ITEMCATEGORY" + count, "Physical");
                encoder.Add("L_PAYMENTREQUEST_0_ITEMURL" + count, settings.Get("SiteURL") + "part/" + item.partID);
                total += item.price * item.quantity;
                count++;
            }
            encoder.Add("PAYMENTREQUEST_0_TAXAMT", String.Format("{0:N2}", cart.tax));
            encoder.Add("PAYMENTREQUEST_0_ITEMAMT", String.Format("{0:N2}", total));
            // Execute the API operation and obtain the response.
            string pStrrequestforNvp = encoder.Encode();
            string pStresponsenvp = caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:meganmcchesney,项目名称:CURTeCommerce,代码行数:49,代码来源:Paypal.cs

示例15: DoDirectPaymentCode

        public string DoDirectPaymentCode(string paymentAction,string amount,string creditCardType,string creditCardNumber,string expdate_month,string cvv2Number,string firstName,string lastName,string address1,string city,string state,string zip,string countryCode,string currencyCode)
        {
            NVPCallerServices caller = new NVPCallerServices();
            IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();
            /*
             WARNING: Do not embed plaintext credentials in your application code.
             Doing so is insecure and against best practices.
             Your API credentials must be handled securely. Please consider
             encrypting them for use in any production environment, and ensure
             that only authorized individuals may view or modify them.
             */

            // Set up your API credentials, PayPal end point, API operation and version.
            profile.APIUsername = "sdk-three_api1.sdk.com";
            profile.APIPassword = "QFZCWN5HZM8VBG7Q";
            profile.APISignature = "AVGidzoSQiGWu.lGj3z15HLczXaaAcK6imHawrjefqgclVwBe8imgCHZ";
            profile.Environment="sandbox";
            caller.APIProfile = profile;

            NVPCodec encoder = new NVPCodec();
            encoder["VERSION"] =  "51.0";
            encoder["METHOD"] =  "DoDirectPayment";

            // Add request-specific fields to the request.
            encoder["PAYMENTACTION"] =  paymentAction;
            encoder["AMT"] =  amount;
            encoder["CREDITCARDTYPE"] =  creditCardType;
            encoder["ACCT"] =  creditCardNumber;
            encoder["EXPDATE"] =  expdate_month;
            encoder["CVV2"] =  cvv2Number;
            encoder["FIRSTNAME"] =  firstName;
            encoder["LASTNAME"] =  lastName;
            encoder["STREET"] =  address1;
            encoder["CITY"] =  city;
            encoder["STATE"] =  state;
            encoder["ZIP"] =  zip;
            encoder["COUNTRYCODE"] = countryCode;
            encoder["CURRENCYCODE"] =  currencyCode;

            // Execute the API operation and obtain the response.
            string pStrrequestforNvp= encoder.Encode();
            string pStresponsenvp=caller.Call(pStrrequestforNvp);

            NVPCodec decoder = new NVPCodec();
            decoder.Decode(pStresponsenvp);
            return decoder["ACK"];
        }
开发者ID:Goldcap,项目名称:Constellation,代码行数:47,代码来源:DoDirectPayment.cs


注:本文中的NVPCodec类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。