/// <summary> 
 /// 
 /// </summary>
 ///<param name="bMUpdateButtonReq"></param>
 public BMUpdateButtonResponseType BMUpdateButton(BMUpdateButtonReq bMUpdateButtonReq)
 {
     return BMUpdateButton(bMUpdateButtonReq,(string) null);
 }
        /// <summary>
        /// 
        /// </summary>
        ///<param name="bMUpdateButtonReq"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public BMUpdateButtonResponseType BMUpdateButton(BMUpdateButtonReq bMUpdateButtonReq, ICredential credential)
        {
            setStandardParams(bMUpdateButtonReq.BMUpdateButtonRequest);
            DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, bMUpdateButtonReq.ToXMLString(null, "BMUpdateButtonReq"), null, null);
            IAPICallPreHandler apiCallPreHandler = new MerchantAPICallPreHandler(this.config, defaultHandler, credential);
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((MerchantAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((MerchantAPICallPreHandler) apiCallPreHandler).PortName = "PayPalAPI";

            XmlDocument xmlDocument = new XmlDocument();
            xmlDocument.LoadXml(Call(apiCallPreHandler));
            return new BMUpdateButtonResponseType(
                xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMUpdateButtonResponse']")
            );
        }
コード例 #3
0
 /**
   *AUTO_GENERATED
  	  */
 public BMUpdateButtonResponseType BMUpdateButton(BMUpdateButtonReq BMUpdateButtonReq)
 {
     return BMUpdateButton(BMUpdateButtonReq, null);
 }
コード例 #4
0
        /**
          *AUTO_GENERATED
         	  */
        public BMUpdateButtonResponseType BMUpdateButton(BMUpdateButtonReq BMUpdateButtonReq, string apiUsername)
        {
            setStandardParams(BMUpdateButtonReq.BMUpdateButtonRequest);

            string resp = call("BMUpdateButton", BMUpdateButtonReq.toXMLString(), apiUsername);
            return new BMUpdateButtonResponseType(resp);
        }
コード例 #5
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            BMUpdateButtonRequestType request = new BMUpdateButtonRequestType();

            // (Required) The kind of button you want to update. It is one of the following values:
            //    BUYNOW - Buy Now button
            //    CART - Add to Cart button
            //    GIFTCERTIFICATE - Gift Certificate button
            //    SUBSCRIBE - Subscribe button
            //    DONATE - Donate button
            //    UNSUBSCRIBE - Unsubscribe button
            //    VIEWCART - View Cart button
            //    PAYMENTPLAN - Installment Plan button; since version 63.0
            //    AUTOBILLING - Automatic Billing button; since version 63.0
            // Note:
            // You cannot change the kind of button after the button has been created.
            ButtonTypeType selectedButtonType = (ButtonTypeType)
                Enum.Parse(typeof(ButtonTypeType), buttonType.SelectedValue);
            request.ButtonType = selectedButtonType;

            //(Optional) The kind of button code to create. It is one of the following values:
            // HOSTED - A secure button stored on PayPal; default for all buttons except View Cart
            // and Unsubscribe
            // ENCRYPTED - An encrypted button, not stored on PayPal; default for View Cart button
            // CLEARTEXT - An unencrypted button, not stored on PayPal; default for Unsubscribe button
            // Note:
            // You cannot change the kind of button code after after the button has been created.
            request.ButtonCode = (ButtonCodeType)
                Enum.Parse(typeof(ButtonCodeType), buttonCode.SelectedValue);

            //Selenium Test Case
            //(Required) The ID of the hosted button you want to modify.
            request.HostedButtonID = hostedID.Value.ToString();

            /* Add HTML standard button variables that control what is posted to
             * PayPal when a user clicks on the created button. Refer the
             * "HTML Variables for Website Payments Standard" guide for more.
             */
            List<string> buttonVars = new List<string>();
            buttonVars.Add("item_name=" + itemName.Value);
            buttonVars.Add("return=" + returnURL.Value);
            buttonVars.Add("business=" + businessMail.Value);
            buttonVars.Add("amount=" + amount.Value);
            buttonVars.Add("notify_url=" +  notifyURL.Value.Trim());

            request.ButtonVar = buttonVars;

            /* Construct rest of the request values according to the buttontype
             * that the user chose. Consult the ButtonManager documentation
             * for a complete list of supported arguments for the different
             * button types
             */
            if (selectedButtonType.Equals(ButtonTypeType.PAYMENTPLAN))
            {
                InstallmentDetailsType insType = new InstallmentDetailsType();

                //(Optional) The total number of billing cycles,
                // regardless of the duration of a cycle; 1 is the default
                insType.TotalBillingCycles = Convert.ToInt32(billingCycles.Value);

                // (Optional) The base amount to bill for the cycle.
                insType.Amount = installmentAmt.Value;

                // (Optional) The installment cycle frequency in units, e.g.
                // if the billing frequency is 2 and the billing period is Month,
                // the billing cycle is every 2 months. The default billing frequency is 1.
                insType.BillingFrequency = Convert.ToInt32(billingFreq.Value);

                 //(Optional) The installment cycle unit, which is one of the following values:
                 //   NoBillingPeriodType - None (default)
                 //   Day
                 //   Week
                 //   SemiMonth
                 //   Month
                 //   Year
                insType.BillingPeriod = (BillingPeriodType)
                        Enum.Parse(typeof(BillingPeriodType), billingPeriod.SelectedValue);
                List<InstallmentDetailsType> insList = new List<InstallmentDetailsType>();
                insList.Add(insType);

                OptionSelectionDetailsType detailsType = new OptionSelectionDetailsType("CreateButton");

                // (Optional) The installment option type for an OPTIONnNAME,
                // which is one of the following values:
                //  FULL - Payment in full
                //  VARIABLE - Variable installments
                //  EMI - Equal installments
                // Note:
                // Only available for Installment Plan buttons.
                detailsType.OptionType = (OptionTypeListType)
                    Enum.Parse(typeof(OptionTypeListType), optionType.SelectedValue);

                // (Optional) Information about an installment option
                detailsType.PaymentPeriod = insList;

                List<OptionSelectionDetailsType> optSelectList = new List<OptionSelectionDetailsType>();
                optSelectList.Add(detailsType);

                OptionDetailsType optType = new OptionDetailsType("CreateButton");
                optType.OptionSelectionDetails = optSelectList;

                List<OptionDetailsType> optList = new List<OptionDetailsType>();
                optList.Add(optType);

                request.OptionDetails = optList;

            }
            else if (selectedButtonType.Equals(ButtonTypeType.AUTOBILLING))
            {
                // (Optional) HTML standard button variables
                //It is a list of variables, in which n is a digit between 0 and 999,
                // inclusive; do not include leading zeros.
                //Character length and limitations: 63 single-byte alphanumeric characters each
                buttonVars.Add("min_amount=" + minAmt.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.GIFTCERTIFICATE))
            {
                //(Optional) HTML standard button variables
                //It is a list of variables, in which n is a digit between 0 and 999,
                // inclusive; do not include leading zeros.
                //Character length and limitations: 63 single-byte alphanumeric characters each
                buttonVars.Add("shopping_url=" + shoppingUrl.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.PAYMENT))
            {
                // (Optional) HTML standard button variables
                //It is a list of variables, in which n is a digit between 0 and 999,
                // inclusive; do not include leading zeros.
                //Character length and limitations: 63 single-byte alphanumeric characters each
                buttonVars.Add("subtotal=" + subTotal.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.SUBSCRIBE))
            {
                // (Optional) HTML standard button variables
                //It is a list of variables, in which n is a digit between 0 and 999,
                // inclusive; do not include leading zeros.
                //Character length and limitations: 63 single-byte alphanumeric characters each
                buttonVars.Add("a3=" + subAmt.Value);
                buttonVars.Add("p3=" + subPeriod.Value);
                buttonVars.Add("t3=" + subInterval.SelectedValue);
            }

            // Invoke the API
            BMUpdateButtonReq wrapper = new BMUpdateButtonReq();
            wrapper.BMUpdateButtonRequest = request;

            // Configuration map containing signature credentials and other required configuration.
            // For a full list of configuration parameters refer in wiki page
            // (https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters)
            Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig();

            // Creating service wrapper object to make an API call by loading configuration map.
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            BMUpdateButtonResponseType response = service.BMUpdateButton(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, response);
        }
コード例 #6
0
ファイル: BMUpdateButton.aspx.cs プロジェクト: kashyapkk/SDKs
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            BMUpdateButtonRequestType request = new BMUpdateButtonRequestType();
            ButtonTypeType selectedButtonType = (ButtonTypeType)
                Enum.Parse(typeof(ButtonTypeType), buttonType.SelectedValue);
            request.ButtonType = selectedButtonType;
            request.ButtonCode = (ButtonCodeType)
                Enum.Parse(typeof(ButtonCodeType), buttonCode.SelectedValue);

            /* Add HTML standard button variables that control what is posted to
             * PayPal when a user clicks on the created button. Refer the
             * "HTML Variables for Website Payments Standard" guide for more.
             */
            List<String> buttonVars = new List<String>();
            buttonVars.Add("item_name=" + itemName.Value);
            buttonVars.Add("return=" + returnURL.Value);
            buttonVars.Add("business=" + businessMail.Value);
            buttonVars.Add("amount=" + amount.Value);
            request.ButtonVar = buttonVars;

            /* Construct rest of the request values according to the buttontype
             * that the user chose. Consult the ButtonManager documentation
             * for a complete list of supported arguments for the different
             * button types
             */
            if (selectedButtonType.Equals(ButtonTypeType.PAYMENTPLAN))
            {
                InstallmentDetailsType insType = new InstallmentDetailsType();
                insType.TotalBillingCycles = Int32.Parse(billingCycles.Value);
                insType.Amount = installmentAmt.Value;
                insType.BillingFrequency = Int32.Parse(billingFreq.Value);
                insType.BillingPeriod = (BillingPeriodType)
                        Enum.Parse(typeof(BillingPeriodType), billingPeriod.SelectedValue);
                List<InstallmentDetailsType> insList = new List<InstallmentDetailsType>();
                insList.Add(insType);

                OptionSelectionDetailsType detailsType = new OptionSelectionDetailsType("CreateButton");
                detailsType.OptionType = (OptionTypeListType)
                    Enum.Parse(typeof(OptionTypeListType), optionType.SelectedValue);
                detailsType.PaymentPeriod = insList;

                List<OptionSelectionDetailsType> optSelectList = new List<OptionSelectionDetailsType>();
                optSelectList.Add(detailsType);

                OptionDetailsType optType = new OptionDetailsType("CreateButton");
                optType.OptionSelectionDetails = optSelectList;

                List<OptionDetailsType> optList = new List<OptionDetailsType>();
                optList.Add(optType);

                request.OptionDetails = optList;

            }
            else if (selectedButtonType.Equals(ButtonTypeType.AUTOBILLING))
            {
                buttonVars.Add("min_amount=" + minAmt.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.GIFTCERTIFICATE))
            {
                buttonVars.Add("shopping_url=" + shoppingUrl.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.PAYMENT))
            {
                buttonVars.Add("subtotal=" + subTotal.Value);
            }
            else if (selectedButtonType.Equals(ButtonTypeType.SUBSCRIBE))
            {
                buttonVars.Add("a3=" + subAmt.Value);
                buttonVars.Add("p3=" + subPeriod.Value);
                buttonVars.Add("t3=" + subInterval.SelectedValue);
            }

            // Invoke the API
            BMUpdateButtonReq wrapper = new BMUpdateButtonReq();
            wrapper.BMUpdateButtonRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            BMUpdateButtonResponseType response = service.BMUpdateButton(wrapper);

            // Check for API return status
            setKeyResponseObjects(service, response);
        }
コード例 #7
0
 /**
   *AUTO_GENERATED
  	  */
 public BMUpdateButtonResponseType BMUpdateButton(BMUpdateButtonReq bMUpdateButtonReq, string apiUserName)
 {
     setStandardParams(bMUpdateButtonReq.BMUpdateButtonRequest);
     string response = Call("BMUpdateButton", bMUpdateButtonReq.ToXMLString(), apiUserName);
     XmlDocument xmlDocument = new XmlDocument();
     xmlDocument.LoadXml(response);
     XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMUpdateButtonResponse']");
     return new BMUpdateButtonResponseType(xmlNode);
 }