Пример #1
0
        private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, BMGetInventoryResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;
            CurrContext.Items.Add("Response_apiName", "BMGetInventory");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

            Dictionary<string, string> responseParams = new Dictionary<string, string>();
            responseParams.Add("Correlation Id", response.CorrelationID);
            responseParams.Add("API Result", response.Ack.ToString());

            if (response.Ack.Equals(AckCodeType.FAILURE) ||
                (response.Errors != null && response.Errors.Count > 0))
            {
                CurrContext.Items.Add("Response_error", response.Errors);
            }
            else
            {
                CurrContext.Items.Add("Response_error", null);
                responseParams.Add("Is inventory tracked", response.TrackInv);
                responseParams.Add("Is Profit & Loss tracked", response.TrackPnl);
                responseParams.Add("Item Number", response.ItemTrackingDetails.ItemNumber);
                responseParams.Add("Item Quantity", response.ItemTrackingDetails.ItemQty);
                responseParams.Add("Item Cost", response.ItemTrackingDetails.ItemCost);
                responseParams.Add("Item Alert threshold quantity", response.ItemTrackingDetails.ItemAlert);
                responseParams.Add("Soldout URL", response.SoldoutURL);
            }
            CurrContext.Items.Add("Response_keyResponseObject", responseParams);
            Server.Transfer("../APIResponse.aspx");
        }
        private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, BMGetInventoryResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;
            CurrContext.Items.Add("Response_apiName", "BMGetInventory");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

            Dictionary<string, string> responseParams = new Dictionary<string, string>();

            // Correlation ID; it is used only by Developer Technical Support.
            // Note:
            // You must log and store this data for every response you receive.
            // PayPal Technical Support uses the information to assist with reported issues.
            responseParams.Add("Correlation Id", response.CorrelationID);
            responseParams.Add("API Result", response.Ack.ToString());

            if (response.Ack.Equals(AckCodeType.FAILURE) ||
                (response.Errors != null && response.Errors.Count > 0))
            {
                CurrContext.Items.Add("Response_error", response.Errors);
            }
            else
            {
                CurrContext.Items.Add("Response_error", null);

                // Whether to track inventory levels associated with the button.
                // It is one of the following values:
                // 0 - do not track inventory
                // 1 - track inventory
                responseParams.Add("Is inventory tracked", response.TrackInv);

                // 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.
                responseParams.Add("Is Profit & Loss tracked", response.TrackPnl);

                // The ID for an item associated with this button
                responseParams.Add("Item Number", response.ItemTrackingDetails.ItemNumber);

                // The current inventory level of the item associated with this button
                responseParams.Add("Item Quantity", response.ItemTrackingDetails.ItemQty);

                // The cost of the item associated with this button
                responseParams.Add("Item Cost", response.ItemTrackingDetails.ItemCost);

                // The quantity of the item associated with this button below which PayPal sends you an email notification
                responseParams.Add("Item Alert threshold quantity", response.ItemTrackingDetails.ItemAlert);
                responseParams.Add("Soldout URL", response.SoldoutURL);
            }
            CurrContext.Items.Add("Response_keyResponseObject", responseParams);
            Server.Transfer("../APIResponse.aspx");
        }