本文整理匯總了C#中PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.BMSetInventory方法的典型用法代碼示例。如果您正苦於以下問題:C# PayPalAPIInterfaceServiceService.BMSetInventory方法的具體用法?C# PayPalAPIInterfaceServiceService.BMSetInventory怎麽用?C# PayPalAPIInterfaceServiceService.BMSetInventory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService
的用法示例。
在下文中一共展示了PayPalAPIInterfaceServiceService.BMSetInventory方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
BMSetInventoryRequestType request = new BMSetInventoryRequestType();
request.HostedButtonID = hostedID.Value;
request.TrackInv = trackInv.Value;
request.TrackPnl = trackPnl.Value;
if (soldoutURL.Value != "")
{
request.SoldoutURL = soldoutURL.Value;
}
request.ItemTrackingDetails = new ItemTrackingDetailsType();
if(itemNumber.Value != "")
{
request.ItemTrackingDetails.ItemNumber = itemNumber.Value;
}
if (trackInv.Value == "1" && itemQty.Value != "")
{
request.ItemTrackingDetails.ItemQty = itemQty.Value;
}
if(trackPnl.Value == "1" && itemCost.Value != "")
{
request.ItemTrackingDetails.ItemCost = itemCost.Value;
}
if(itemAlert.Value != "")
{
request.ItemTrackingDetails.ItemAlert = itemAlert.Value;
}
// Invoke the API
BMSetInventoryReq wrapper = new BMSetInventoryReq();
wrapper.BMSetInventoryRequest = request;
PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
BMSetInventoryResponseType response = service.BMSetInventory(wrapper);
// Check for API return status
setKeyResponseObjects(service, response);
}
示例2: Submit_Click
protected void Submit_Click(object sender, EventArgs e)
{
// Create request object
BMSetInventoryRequestType request = new BMSetInventoryRequestType();
// (Required) The ID of the hosted button whose inventory you want to set.
request.HostedButtonID = hostedID.Value;
// (Required) Whether to track inventory levels associated with the button.
// It is one of the following values:
// 0 - do not track inventory
// 1 - track inventory
request.TrackInv = trackInv.Value;
// (Required) Whether to track the gross profit associated with inventory changes.
// It is one of the following values:
// 0 - do not track the gross profit
// 1 - track the gross profit
//Note: The gross profit is calculated as the price of the item less its cost,
// multiplied by the change in the inventory level since the last call to BMSetInventory
request.TrackPnl = trackPnl.Value;
if (soldoutURL.Value != string.Empty)
{
//(Optional) The URL to which the buyer's browser is redirected when the inventory drops to 0.
// Note: Specifying a URL in this field also prevents a sale when the inventory drops to 0;
// otherwise, sales can continue even when inventory is unavailable.
// Character length and limitations: 127 single-byte alphanumeric characters
request.SoldoutURL = soldoutURL.Value;
}
request.ItemTrackingDetails = new ItemTrackingDetailsType();
if(itemNumber.Value != string.Empty)
{
// (Optional) The ID for an item associated with this button
request.ItemTrackingDetails.ItemNumber = itemNumber.Value;
}
if (trackInv.Value == "1" && itemQty.Value != string.Empty)
{
// The quantity you want to specify for the item associated with this button.
// Specify either the absolute quantity in this field or the change in quantity in the quantity delta field
request.ItemTrackingDetails.ItemQty = itemQty.Value;
}
if(trackPnl.Value == "1" && itemCost.Value != string.Empty)
{
// (Optional) The cost of the item associated with this button
request.ItemTrackingDetails.ItemCost = itemCost.Value;
}
if(itemAlert.Value != string.Empty)
{
// (Optional) The quantity of the item associated with this button below which
// PayPal sends you an email notification
request.ItemTrackingDetails.ItemAlert = itemAlert.Value;
}
// Invoke the API
BMSetInventoryReq wrapper = new BMSetInventoryReq();
wrapper.BMSetInventoryRequest = 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);
BMSetInventoryResponseType response = service.BMSetInventory(wrapper);
// Check for API return status
setKeyResponseObjects(service, response);
}