本文整理匯總了C#中PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.BMUpdateButton方法的典型用法代碼示例。如果您正苦於以下問題:C# PayPalAPIInterfaceServiceService.BMUpdateButton方法的具體用法?C# PayPalAPIInterfaceServiceService.BMUpdateButton怎麽用?C# PayPalAPIInterfaceServiceService.BMUpdateButton使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService
的用法示例。
在下文中一共展示了PayPalAPIInterfaceServiceService.BMUpdateButton方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Submit_Click
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");
//.........這裏部分代碼省略.........
示例2: Submit_Click
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);
}