private PayPalAccountStatusInfo InternalGetVerifiedStatus(string userFirstName, string userLastName, string userEMail) { var aa = InternalCreateService(); var request = new GetVerifiedStatusRequest { requestEnvelope = GetRequestEnvelope(), emailAddress = userEMail, firstName = userFirstName, lastName = userLastName, matchCriteria = "NAME", }; GetVerifiedStatusResponse response = aa.GetVerifiedStatus(request); if (aa.isSuccess.ToUpper() == "FAILURE") { _log.Error("GetVerifiedStatus Failed"); _log.Error(aa.LastError.ErrorDetails); throw new PayPalException(aa.LastError.ErrorDetails); } return(new PayPalAccountStatusInfo { AccountStatus = response.accountStatus, AccountType = response.userInfo == null ? string.Empty : response.userInfo.accountType }); }
/** * All countries are supported. * * * * * */ public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest getVerifiedStatusRequest, string apiUserName) { string response = Call("GetVerifiedStatus", getVerifiedStatusRequest.ToNVPString(""), apiUserName); NVPUtil util = new NVPUtil(); return(GetVerifiedStatusResponse.CreateInstance(util.ParseNVPString(response), "", -1)); }
/** * * All countries are supported. * */ public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest GetVerifiedStatusRequest, string apiUsername) { string resp = call("GetVerifiedStatus", GetVerifiedStatusRequest.toNVPString(""), apiUsername); NVPUtil util = new NVPUtil(); return(new GetVerifiedStatusResponse(util.parseNVPString(resp), "")); }
public static bool Validate(string email, string firstName, string lastName, User user) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; if (HaveEmail(email)) { throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь"); } try { if (profile == null) { profile = CreateProfile(); } var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) { return(false); } if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification() { Email = email, FirstName = firstName, LastName = lastName, VerificationDate = DateTime.Now, User = user }); DataService.PerThread.SaveChanges(); return(true); } return(false); }
/// <summary> /// All countries are supported. /// /// /// /// /// /// </summary> ///<param name="getVerifiedStatusRequest"></param> ///<param name="credential">An explicit ICredential object that you want to authenticate this call against</param> public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest getVerifiedStatusRequest, ICredential credential) { IAPICallPreHandler apiCallPreHandler = new PlatformAPICallPreHandler(this.config, getVerifiedStatusRequest.ToNVPString(string.Empty), ServiceName, "GetVerifiedStatus", credential); ((PlatformAPICallPreHandler)apiCallPreHandler).SDKName = SDKName; ((PlatformAPICallPreHandler)apiCallPreHandler).SDKVersion = SDKVersion; ((PlatformAPICallPreHandler)apiCallPreHandler).PortName = "AdaptiveAccounts"; NVPUtil util = new NVPUtil(); return(GetVerifiedStatusResponse.CreateInstance(util.ParseNVPString(Call(apiCallPreHandler)), string.Empty, -1)); }
public static bool Validate(string email, string firstName, string lastName, User user) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; if (HaveEmail(email)) throw new ValidationException("На данную электропочту PayPal уже зарегестирован на Д2 пользователь"); try { if (profile == null) profile = CreateProfile(); var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) return false; if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { DataService.PerThread.PayPalVerificationSet.AddObject(new PayPalVerification() { Email = email, FirstName = firstName, LastName = lastName, VerificationDate = DateTime.Now, User = user }); DataService.PerThread.SaveChanges(); return true; } return false; }
/// <summary> /// Handle GetVerifiedStatus API call /// </summary> /// <param name="context"></param> private void GetVerifiedStatus(HttpContext context) { NameValueCollection parameters = context.Request.Params; GetVerifiedStatusRequest req = new GetVerifiedStatusRequest( new RequestEnvelope(), parameters["emailAddress"], parameters["matchCriteria"]); // set optional parameters if (parameters["firstName"] != "") { req.firstName = parameters["firstName"]; } if (parameters["lastName"] != "") { req.lastName = parameters["lastName"]; } // All set. Fire the request AdaptiveAccountsService service = new AdaptiveAccountsService(); GetVerifiedStatusResponse resp = null; try { resp = service.GetVerifiedStatus(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("Account status", resp.accountStatus); if (resp.userInfo != null) { keyResponseParams.Add("Account Id", resp.userInfo.accountId); keyResponseParams.Add("Account type", resp.userInfo.accountType); //Selenium Test Case keyResponseParams.Add("Acknowledgement", resp.responseEnvelope.ack.ToString()); } } displayResponse(context, "GetVerifiedStatus", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }
/// <summary> /// Checks the account verification. /// </summary> /// <param name="userFirstName">First name of the user.</param> /// <param name="userLastName">Last name of the user.</param> /// <param name="userEmailAddress">The user email address.</param> /// <returns></returns> public GetVerifiedStatusResponse CheckAccountVerification(string userFirstName, string userLastName, string userEmailAddress) { //AdaptiveAccounts SDK GetVerifiedStatusRequest verifiedStatusRequest = new GetVerifiedStatusRequest { emailAddress = userEmailAddress, firstName = userFirstName, lastName = userLastName, matchCriteria = "NAME" }; var service = new AdaptiveAccountsService(Config.ToDictionary()); return(service.GetVerifiedStatus(verifiedStatusRequest)); }
public static bool ValidateTest(string email, string firstName, string lastName) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; try { if (profile == null) { profile = CreateProfile(); } var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) { return(false); } if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { return(true); } return(false); }
public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest GetVerifiedStatusRequest) { return(GetVerifiedStatus(GetVerifiedStatusRequest, null)); }
/// <summary> /// All countries are supported. /// /// /// /// /// /// </summary> ///<param name="getVerifiedStatusRequest"></param> public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest getVerifiedStatusRequest) { return(GetVerifiedStatus(getVerifiedStatusRequest, (string)null)); }
public GetVerifiedStatusResponse GetVerifiedStatus(GetVerifiedStatusRequest request) { GetVerifiedStatusResponse GetVerifiedStatusResponse = null; PayLoad = null; try { APIProfile.EndPointAppend = Endpoint + "GetVerifiedStatus"; 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.AA.GetVerifiedStatusResponse)); if (obj.GetType() == typeof(PayPal.Services.Private.AA.GetVerifiedStatusResponse)) { GetVerifiedStatusResponse = (PayPal.Services.Private.AA.GetVerifiedStatusResponse)obj; } string name = Enum.GetName(GetVerifiedStatusResponse.responseEnvelope.ack.GetType(), GetVerifiedStatusResponse.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") { GetVerifiedStatusResponse = (PayPal.Services.Private.AA.GetVerifiedStatusResponse)SoapEncoder.Decode(res.ToString(), typeof(PayPal.Services.Private.AA.GetVerifiedStatusResponse)); } else if (APIProfile.RequestDataformat == "XML") { GetVerifiedStatusResponse = (PayPal.Services.Private.AA.GetVerifiedStatusResponse)XMLEncoder.Decode(res.ToString(), typeof(PayPal.Services.Private.AA.GetVerifiedStatusResponse)); } else { object obj = JSONSerializer.JsonDecode(res.ToString(), typeof(PayPal.Services.Private.AA.CreateAccountResponse)); if (obj.GetType() == typeof(PayPal.Services.Private.AA.GetVerifiedStatusResponse)) { GetVerifiedStatusResponse = (PayPal.Services.Private.AA.GetVerifiedStatusResponse)obj; } } this.result = "SUCCESS"; } } catch (FATALException) { throw; } catch (Exception ex) { throw new FATALException("Error occurred in AdapativePayments -> method.", ex); } return(GetVerifiedStatusResponse); }
/// <summary> /// Handle GetVerifiedStatus API call /// </summary> /// <param name="context"></param> private void GetVerifiedStatus(HttpContext context) { // # GetVerifiedStatus API // The GetVerifiedStatus API operation lets you determine whether the specified PayPal account's status is verified or unverified. NameValueCollection parameters = context.Request.Params; GetVerifiedStatusRequest req = new GetVerifiedStatusRequest(new RequestEnvelope(), parameters["matchCriteria"]); //(Required) The first name of the PayPal account holder. // Required if matchCriteria is NAME. if (parameters["firstName"] != string.Empty) { req.firstName = parameters["firstName"]; } // (Required) The last name of the PayPal account holder. // Required if matchCriteria is NAME. if (parameters["lastName"] != string.Empty) { req.lastName = parameters["lastName"]; } if (parameters["emailAddress"] != string.Empty) { // (Optional - must be present if the emailAddress field above // is not) The identifier of the PayPal account holder. If // present, must be one (and only one) of these account // identifier types: 1. emailAddress 2. mobilePhoneNumber 3. // accountId AccountIdentifierType accntIdentifierType = new AccountIdentifierType(); // (Required)Email address associated with the PayPal account: // one of the unique identifiers of the account. accntIdentifierType.emailAddress = parameters["emailAddress"]; req.accountIdentifier = accntIdentifierType; } // Create the AdaptiveAccounts service object to make the API call AdaptiveAccountsService service = null; GetVerifiedStatusResponse 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.GetVerifiedStatus(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("Account status", resp.accountStatus); if (resp.userInfo != null) { keyResponseParams.Add("Account Id", resp.userInfo.accountId); keyResponseParams.Add("Account type", resp.userInfo.accountType); //Selenium Test Case keyResponseParams.Add("Acknowledgement", resp.responseEnvelope.ack.ToString()); } } displayResponse(context, "GetVerifiedStatus", keyResponseParams, service.getLastRequest(), service.getLastResponse(), resp.error, redirectUrl); }
public static bool ValidateTest(string email, string firstName, string lastName) { GetVerifiedStatusResponse getVerifiedStatusResponse = null; try { if (profile == null) profile = CreateProfile(); var getVerifiedStatusRequest = new GetVerifiedStatusRequest(); getVerifiedStatusRequest.emailAddress = email; getVerifiedStatusRequest.firstName = firstName; getVerifiedStatusRequest.lastName = lastName; getVerifiedStatusRequest.matchCriteria = "NAME"; // or optional! (name/none) var aa = new AdaptiveAccounts(); aa.APIProfile = profile; getVerifiedStatusResponse = aa.GetVerifiedStatus(getVerifiedStatusRequest); } catch (FATALException FATALEx) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", FATALEx); } catch (Exception ex) { throw new BusinessLogicException("Ошибка в модуле работы с PayPal", ex); } if (getVerifiedStatusResponse == null) return false; if (getVerifiedStatusResponse.accountStatus.ToUpper() == "VERIFIED") { return true; } return false; }