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); }
/// <summary> /// /// </summary> ///<param name="bMSetInventoryReq"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public BMSetInventoryResponseType BMSetInventory(BMSetInventoryReq bMSetInventoryReq, ICredential credential) { setStandardParams(bMSetInventoryReq.BMSetInventoryRequest); DefaultSOAPAPICallHandler defaultHandler = new DefaultSOAPAPICallHandler(this.config, bMSetInventoryReq.ToXMLString(null, "BMSetInventoryReq"), 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 BMSetInventoryResponseType( xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMSetInventoryResponse']") ); }
/// <summary> /// /// </summary> ///<param name="bMSetInventoryReq"></param> public BMSetInventoryResponseType BMSetInventory(BMSetInventoryReq bMSetInventoryReq) { return BMSetInventory(bMSetInventoryReq,(string) null); }
/** *AUTO_GENERATED */ public BMSetInventoryResponseType BMSetInventory(BMSetInventoryReq BMSetInventoryReq) { return BMSetInventory(BMSetInventoryReq, null); }
/** *AUTO_GENERATED */ public BMSetInventoryResponseType BMSetInventory(BMSetInventoryReq BMSetInventoryReq, string apiUsername) { setStandardParams(BMSetInventoryReq.BMSetInventoryRequest); string resp = call("BMSetInventory", BMSetInventoryReq.toXMLString(), apiUsername); return new BMSetInventoryResponseType(resp); }
/** *AUTO_GENERATED */ public BMSetInventoryResponseType BMSetInventory(BMSetInventoryReq bMSetInventoryReq, string apiUserName) { setStandardParams(bMSetInventoryReq.BMSetInventoryRequest); string response = Call("BMSetInventory", bMSetInventoryReq.ToXMLString(), apiUserName); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(response); XmlNode xmlNode = xmlDocument.SelectSingleNode("*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='BMSetInventoryResponse']"); return new BMSetInventoryResponseType(xmlNode); }
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); }