Exemplo n.º 1
0
        /**
         *		 * Countries Supported:
         * AU - Australia
         * AT - Austria
         * CA - Canada
         * CZ - Czech Republic
         * EU - European Union *
         * FR - France
         * DE - Germany
         * GB - Great Britain
         * GR - Greece
         * IE - Ireland
         * IL - Israel
         * IT - Italy
         * JP - Japan
         * NL - Netherlands
         * NZ - New Zealand (Aotearoa)
         * PL - Poland
         * PT - Portugal
         * RU - Russian Federation
         * SG - Singapore
         * ZA - South Africa
         * ES - Spain
         * CH - Switzerland
         * US - United States
         * * technically a group of countries

         */
        public GetUserAgreementResponse GetUserAgreement(GetUserAgreementRequest GetUserAgreementRequest, string apiUsername)
        {
            string resp = call("GetUserAgreement", GetUserAgreementRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();
            return new GetUserAgreementResponse(util.parseNVPString(resp), "");
        }
Exemplo n.º 2
0
 public GetUserAgreementResponse GetUserAgreement(GetUserAgreementRequest GetUserAgreementRequest)
 {
     return GetUserAgreement(GetUserAgreementRequest, null);
 }
        /// <summary>
        /// Handle GetUserAgreement API call
        /// </summary>
        /// <param name="context"></param>
        private void GetUserAgreement(HttpContext context)
        {
            // #GetUserAgreement API
            // The GetUserAgreement API operation lets you retrieve the user agreement for the customer to approve the new PayPal account.
            NameValueCollection parameters = context.Request.Params;
            GetUserAgreementRequest req = new GetUserAgreementRequest(new RequestEnvelope());

            // (Optional) The key returned for this account in the
            // CreateAccountResponse message in the createAccountKey field.
            // If you specify this key, do not pass a country code or
            // language code. Doing so will result in an error.
            if (parameters["createAccountKey"] != string.Empty)
            {
                req.createAccountKey = parameters["createAccountKey"];
            }

            // (Optional) The code for the country in which the user account
            // is located. You do not need to provide this country code if
            // you are passing the createAccount key.
            if (parameters["countryCode"] != string.Empty)
            {
                req.countryCode = parameters["countryCode"];
            }

            // (Optional) The code indicating the language to be used for
            // the agreement.
            if (parameters["languageCode"] != string.Empty)
            {
                req.languageCode = parameters["languageCode"];
            }

            // Create the AdaptiveAccounts service object to make the API call
            AdaptiveAccountsService service = null;
            GetUserAgreementResponse resp = null;
            try
            {
                // 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 and loading
                // configuration map for your credentials and endpoint
                service = new AdaptiveAccountsService(configurationMap);

                // # API call
                // Invoke the CreateAccount method in service wrapper object
                resp = service.GetUserAgreement(req);
            }
            catch (System.Exception e)
            {
                context.Response.Write(e.Message);
                return;
            }

            // Display response values.
            Dictionary<string, string> keyResponseParams = new Dictionary<string, string>();
            string redirectUrl = null;
            if (!(resp.responseEnvelope.ack == AckCode.FAILURE) &&
                !(resp.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
            {
                keyResponseParams.Add("Agreement", resp.agreement.Substring(0, 100) + "....");

                //Selenium Test Case
                keyResponseParams.Add("Acknowledgement", resp.responseEnvelope.ack.ToString());
            }
            displayResponse(context, "GetUserAgreement", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Handle GetUserAgreement API call
        /// </summary>
        /// <param name="context"></param>
        private void GetUserAgreement(HttpContext context)
        {
            NameValueCollection parameters = context.Request.Params;
            GetUserAgreementRequest req = new GetUserAgreementRequest(new RequestEnvelope());
            // set optional parameters
            if (parameters["createAccountKey"] != "")
                req.createAccountKey = parameters["createAccountKey"];
            if (parameters["countryCode"] != "")
                req.countryCode = parameters["countryCode"];
            if (parameters["languageCode"] != "")
                req.languageCode = parameters["languageCode"];

            // All set. Fire the request
            AdaptiveAccountsService service = new AdaptiveAccountsService();
            GetUserAgreementResponse resp = null;
            try
            {
                resp = service.GetUserAgreement(req);
            }
            catch (System.Exception e)
            {
                context.Response.Write(e.Message);
                return;
            }

            // Display response values.
            Dictionary<string, string> keyResponseParams = new Dictionary<string, string>();
            string redirectUrl = null;
            if (!(resp.responseEnvelope.ack == AckCode.FAILURE) &&
                !(resp.responseEnvelope.ack == AckCode.FAILUREWITHWARNING))
            {
                keyResponseParams.Add("Agreement", resp.agreement.Substring(0, 100) + "....");
            }
            displayResponse(context, "GetUserAgreement", keyResponseParams, service.getLastRequest(), service.getLastResponse(),
                resp.error, redirectUrl);
        }
        /// <summary>
        /// Countries Supported:
        /// AU - Australia
        /// AT - Austria
        /// CA
        /// - Canada
        /// CZ - Czech Republic
        /// EU - European Union *
        /// FR - France
        /// DE -
        /// Germany
        /// GB - Great Britain
        /// GR - Greece
        /// IE - Ireland
        /// IL - Israel
        /// IT -
        /// Italy
        /// JP - Japan
        /// NL - Netherlands
        /// NZ - New Zealand (Aotearoa)
        /// PL -
        /// Poland
        /// PT - Portugal
        /// RU - Russian Federation
        /// SG - Singapore
        /// ZA - South
        /// Africa
        /// ES - Spain
        /// CH - Switzerland
        /// US - United States
        /// * technically a
        /// group of countries
        /// 
        /// 
        /// 
        /// 
        /// 
        /// </summary>
        ///<param name="getUserAgreementRequest"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> 
        public GetUserAgreementResponse GetUserAgreement(GetUserAgreementRequest getUserAgreementRequest, ICredential credential)
        {
            IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getUserAgreementRequest.ToNVPString(string.Empty), ServiceName, "GetUserAgreement", credential);
               	 	((PlatformAPICallPreHandler) apiCallPreHandler).SDKName = SDKName;
            ((PlatformAPICallPreHandler) apiCallPreHandler).SDKVersion = SDKVersion;
            ((PlatformAPICallPreHandler) apiCallPreHandler).PortName = "AdaptiveAccounts";

            NVPUtil util = new NVPUtil();
            return GetUserAgreementResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1);
        }
 /// <summary> 
 /// Countries Supported:
 /// AU - Australia
 /// AT - Austria
 /// CA
 /// - Canada
 /// CZ - Czech Republic
 /// EU - European Union *
 /// FR - France
 /// DE -
 /// Germany
 /// GB - Great Britain
 /// GR - Greece
 /// IE - Ireland
 /// IL - Israel
 /// IT -
 /// Italy
 /// JP - Japan
 /// NL - Netherlands
 /// NZ - New Zealand (Aotearoa)
 /// PL -
 /// Poland
 /// PT - Portugal
 /// RU - Russian Federation
 /// SG - Singapore
 /// ZA - South
 /// Africa
 /// ES - Spain
 /// CH - Switzerland
 /// US - United States
 /// * technically a
 /// group of countries
 /// 
 /// 
 /// 
 /// 
 /// 
 /// </summary>
 ///<param name="getUserAgreementRequest"></param>
 public GetUserAgreementResponse GetUserAgreement(GetUserAgreementRequest getUserAgreementRequest)
 {
     return GetUserAgreement(getUserAgreementRequest,(string) null);
 }
Exemplo n.º 7
0
 /**
   * Countries Supported:
   *     AU - Australia
   *     AT - Austria
   *     CA - Canada
   *     CZ - Czech Republic
   *     EU - European Union *
   *     FR - France
   *     DE - Germany
   *     GB - Great Britain
   *     GR - Greece
   *     IE - Ireland
   *     IL - Israel
   *     IT - Italy
   *     JP - Japan
   *     NL - Netherlands
   *     NZ - New Zealand (Aotearoa)
   *     PL - Poland
   *     PT - Portugal
   *     RU - Russian Federation
   *     SG - Singapore
   *     ZA - South Africa
   *     ES - Spain
   *     CH - Switzerland
   *     US - United States
   *     * technically a group of countries
   *
   *
   *
   *
   *
  	  */
 public GetUserAgreementResponse GetUserAgreement(GetUserAgreementRequest getUserAgreementRequest, string apiUserName)
 {
     string response = Call("GetUserAgreement", getUserAgreementRequest.ToNVPString(""), apiUserName);
     NVPUtil util = new NVPUtil();
     return GetUserAgreementResponse.CreateInstance(util.ParseNVPString(response), "", -1);
 }