示例#1
0
        private PayPalPersonalData InternalGetAccountInfo(PayPalPermissionsGranted securityData)
        {
            var per = InternalCreateService(securityData, "GetAdvancedPersonalData");

            var getAdvancedPersonalDataRequest = new GetAdvancedPersonalDataRequest
            {
                requestEnvelope = GetRequestEnvelope(),
                attributeList   = Enum.GetValues(typeof(PersonalAttribute)).OfType <PersonalAttribute>().ToArray()
            };

            var responseAdvanced = per.getAdvancedPersonalData(getAdvancedPersonalDataRequest);

            if (per.isSuccess.ToUpper() == "FAILURE")
            {
                _log.Error("requestPermissions failed");
                _log.Error(per.LastError.ErrorDetails);
                throw new PayPalException(per.LastError.ErrorDetails);
            }

            var dict = responseAdvanced.response.ToDictionary(k => k.personalDataKey, v => v.personalDataValue);

            DateTime submitDate = responseAdvanced.responseEnvelope.timestamp.ToUniversalTime();

            return(ParcePersonalData(dict, submitDate));
        }
示例#2
0
        /**
         * AUTO_GENERATED
         */
        public GetAdvancedPersonalDataResponse GetAdvancedPersonalData(GetAdvancedPersonalDataRequest getAdvancedPersonalDataRequest, string apiUserName)
        {
            string  response = Call("GetAdvancedPersonalData", getAdvancedPersonalDataRequest.ToNVPString(""), apiUserName);
            NVPUtil util     = new NVPUtil();

            return(GetAdvancedPersonalDataResponse.CreateInstance(util.ParseNVPString(response), "", -1));
        }
示例#3
0
        /**
         *
         */
        public GetAdvancedPersonalDataResponse GetAdvancedPersonalData(GetAdvancedPersonalDataRequest GetAdvancedPersonalDataRequest, string apiUsername)
        {
            string resp = call("GetAdvancedPersonalData", GetAdvancedPersonalDataRequest.toNVPString(""), apiUsername);

            NVPUtil util = new NVPUtil();

            return(new GetAdvancedPersonalDataResponse(util.parseNVPString(resp), ""));
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        ///<param name="getAdvancedPersonalDataRequest"></param>
        ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param>
        public GetAdvancedPersonalDataResponse GetAdvancedPersonalData(GetAdvancedPersonalDataRequest getAdvancedPersonalDataRequest, ICredential credential)
        {
            IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getAdvancedPersonalDataRequest.ToNVPString(string.Empty), ServiceName, "GetAdvancedPersonalData", credential);

            ((PlatformAPICallPreHandler)apiCallPreHandler).SDKName    = SDKName;
            ((PlatformAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion;
            ((PlatformAPICallPreHandler)apiCallPreHandler).PortName   = "Permissions";

            NVPUtil util = new NVPUtil();

            return(GetAdvancedPersonalDataResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1));
        }
示例#5
0
        /// <summary>
        /// Gets personal data.
        /// </summary>
        /// <param name="accessToken">The access token.</param>
        /// <param name="accessTokenSecret">The access token secret.</param>
        /// <returns></returns>
        public Task <GetAdvancedPersonalDataResponse> GetPersonalData(string accessToken, string accessTokenSecret)
        {
            //Permissions SDK
            return(Task.Run(() => {
                GetAdvancedPersonalDataRequest personalDataRequest = new GetAdvancedPersonalDataRequest {
                    attributeList = new PersonalAttributeList {
                        attribute = Enum.GetValues(typeof(PersonalAttribute))
                                    .OfType <PersonalAttribute?>()
                                    .ToList()
                    }
                };

                var permissionsService = new PermissionsService(Config.ToDictionary());
                return permissionsService.GetAdvancedPersonalData(personalDataRequest, GetSignatureCredential(accessToken, accessTokenSecret));
            }));
        }
示例#6
0
        public GetAdvancedPersonalDataResponse getAdvancedPersonalData(GetAdvancedPersonalDataRequest request)
        {
            GetAdvancedPersonalDataResponse PResponse = null;

            PayLoad = null;

            try
            {
                APIProfile.EndPointAppend = Endpoint + "GetAdvancedPersonalData";
                if (APIProfile.RequestDataformat == "SOAP11")
                {
                    PayLoad = SoapEncoder.Encode(request);
                }
                else if (APIProfile.RequestDataformat == "XML")
                {
                    PayLoad = PayPal.Platform.SDK.XMLEncoder.Encode(request);
                }
                else
                {
                    PayLoad = PayPal.Platform.SDK.JSONSerializer.ToJavaScriptObjectNotation(request);
                }
                res = CallAPI();

                if (APIProfile.RequestDataformat == "JSON")
                {
                    object obj = JSONSerializer.JsonDecode(res.ToString(), typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse));
                    if (obj.GetType() == typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse))
                    {
                        PResponse = (PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse)obj;
                    }
                    string name = Enum.GetName(PResponse.responseEnvelope.ack.GetType(), PResponse.responseEnvelope.ack);

                    if (name == "Failure")
                    {
                        this.result = "FAILURE";
                        TransactionException tranactionEx = new TransactionException(PayLoadFromat.JSON, res.ToString());
                        this.lastError = tranactionEx;
                    }
                }

                else if (res.ToString().ToUpper().Replace("<ACK>FAILURE</ACK>", "").Length != res.ToString().Length)
                {
                    this.result = "FAILURE";

                    if (APIProfile.RequestDataformat == "SOAP11")
                    {
                        TransactionException tranactionEx = new TransactionException(PayLoadFromat.SOAP11, res.ToString());
                        this.lastError = tranactionEx;
                    }
                    else if (APIProfile.RequestDataformat == "XML")
                    {
                        TransactionException tranactionEx = new TransactionException(PayLoadFromat.XML, res.ToString());
                        this.lastError = tranactionEx;
                    }
                    else
                    {
                        TransactionException tranactionEx = new TransactionException(PayLoadFromat.JSON, res.ToString());
                        this.lastError = tranactionEx;
                    }
                }
                else
                {
                    if (APIProfile.RequestDataformat == "SOAP11")
                    {
                        PResponse = (PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse)SoapEncoder.Decode(res.ToString(), typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse));
                    }
                    else if (APIProfile.RequestDataformat == "XML")
                    {
                        PResponse = (PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse)XMLEncoder.Decode(res.ToString(), typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse));
                    }
                    else
                    {
                        object obj = JSONSerializer.JsonDecode(res.ToString(), typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse));
                        if (obj.GetType() == typeof(PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse))
                        {
                            PResponse = (PayPal.Services.Private.Permissions.GetAdvancedPersonalDataResponse)obj;
                        }
                    }
                    this.result = "SUCCESS";
                }
            }
            catch (FATALException)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw new FATALException("Error occurred in Permissions ->  GetAdvancedPersonalData method.", ex);
            }
            return(PResponse);
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        ///<param name="getAdvancedPersonalDataRequest"></param>

        public GetAdvancedPersonalDataResponse GetAdvancedPersonalData(GetAdvancedPersonalDataRequest getAdvancedPersonalDataRequest)
        {
            return(GetAdvancedPersonalData(getAdvancedPersonalDataRequest, (string)null));
        }
示例#8
0
 public GetAdvancedPersonalDataResponse GetAdvancedPersonalData(GetAdvancedPersonalDataRequest GetAdvancedPersonalDataRequest)
 {
     return(GetAdvancedPersonalData(GetAdvancedPersonalDataRequest, null));
 }