Exemplo n.º 1
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            // GetPalDetails does not require you to pass any data other than your credentials
            GetPalDetailsRequestType request = new GetPalDetailsRequestType();

            // Invoke the API
            GetPalDetailsReq wrapper = new GetPalDetailsReq();

            wrapper.GetPalDetailsRequest = 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();

            // Create the PayPalAPIInterfaceServiceService service object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap);

            // # API call
            // Invoke the GetPalDetails method in service wrapper object
            GetPalDetailsResponseType palDetails = service.GetPalDetails(wrapper);

            // Check for API return status
            setKeyResponseParams(service, palDetails);
        }
Exemplo n.º 2
0
        private void setKeyResponseParams(PayPalAPIInterfaceServiceService service, GetPalDetailsResponseType response)
        {
            HttpContext CurrContext = HttpContext.Current;

            CurrContext.Items.Add("Response_apiName", "GetPalDetails");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

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

            keyResponseParameters.Add("Correlation Id", response.CorrelationID);
            keyResponseParameters.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);
                keyResponseParameters.Add("Pal Id", response.Pal);
            }
            CurrContext.Items.Add("Response_keyResponseObject", keyResponseParameters);
            Server.Transfer("../APIResponse.aspx");
        }
Exemplo n.º 3
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object
            // GetPalDetails does not require you to pass any data other than your credentials
            GetPalDetailsRequestType request = new GetPalDetailsRequestType();

            // Invoke the API
            GetPalDetailsReq wrapper = new GetPalDetailsReq();

            wrapper.GetPalDetailsRequest = request;
            PayPalAPIInterfaceServiceService service    = new PayPalAPIInterfaceServiceService();
            GetPalDetailsResponseType        palDetails = service.GetPalDetails(wrapper);

            // Check for API return status
            setKeyResponseParams(service, palDetails);
        }