Inheritance: AbstractResponseType
        private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, BMUpdateButtonResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;
            CurrContext.Items.Add("Response_apiName", "BMUpdateButton");
            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);
                if (response.HostedButtonID != null)
                {
                    // (Required) The ID of the hosted button you want to modify.
                    responseParams.Add("Hosted button ID", response.HostedButtonID);
                }
                if (response.Website != null)
                {
                    // HTML code for web pages
                    responseParams.Add("Generated button", response.Website);
                    responseParams.Add("Website HTML code", HttpUtility.HtmlEncode(response.Website));
                }
                if (response.Email != string.Empty)
                {
                    // Code for email links and links in other documents that support external links
                    responseParams.Add("Code for email links", response.Email);
                }
            }
            CurrContext.Items.Add("Response_keyResponseObject", responseParams);
            Server.Transfer("../APIResponse.aspx");
        }
示例#2
0
        private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, BMUpdateButtonResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;
            CurrContext.Items.Add("Response_apiName", "BMUpdateButton");
            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);
                if (response.HostedButtonID != null)
                {
                    responseParams.Add("Hosted button ID", response.HostedButtonID);
                }
                if (response.Website != null)
                {
                    responseParams.Add("Generated button", response.Website);
                    responseParams.Add("Website HTML code", HttpUtility.HtmlEncode(response.Website));
                }
                if (response.Email != "")
                {
                    responseParams.Add("Code for email links", response.Email);
                }
            }
            CurrContext.Items.Add("Response_keyResponseObject", responseParams);
            Server.Transfer("../APIResponse.aspx");
        }