/// <summary> /// Updates the payment details to admin123. /// </summary> /// <param name="paymentInfo">The payment information.</param> /// <param name="memberExternalId">The member external identifier.</param> /// <param name="memberId">The member identifier.</param> /// <param name="memberDetailId">The member detail identifier.</param> /// <returns></returns> public async Task <string> UpdatePaymentDetailsToAdmin123(PaymentInformationBO paymentInfo, string memberExternalId, long memberId, long memberDetailId) { if (paymentInfo != null && memberExternalId != string.Empty && memberId > 0 && memberDetailId > 0) { var memberID = Convert.ToString(memberId); var memberDetails = await _unitOfWork.GetRepository <MemberDetail>().GetFirstOrDefaultAsync(a => a, b => b.MemberDetailId == memberDetailId); var admin123 = new Admin123Mapper(_unitOfWork); var admin123BO = new Admin123BO { CORPID = _appSettings.Value.CorpId, AGENT = _appSettings.Value.AgentId, LASTNAME = memberDetails.LastName, PAYMENT = new PAYMENT { PAYMENTTYPE = paymentInfo.PaymentMethodType.ToLower().Equals(PaymentType.CC.ToString().ToLower()) ? PaymentType.CC.ToString() : PaymentType.ACH.ToString(), TOKEN = AppSettings.Environment == Utilities.Enumerations.Environment.Production.ToString() ? memberID : string.Concat(memberID, "-", AppSettings.Environment) } }; var memberDetailsObject = JsonConvert.SerializeObject(admin123BO); var uri = new Uri(_appSettings.Value.Admin123Url); var stringContent = new StringContent(memberDetailsObject, UnicodeEncoding.UTF8, "application/json"); var task = Task.Run(() => admin123.PostURIAsync(uri, stringContent, _appSettings.Value.Admin123User, _appSettings.Value.Admin123Password, memberDetailsObject, memberExternalId)); task.Wait(); return(task.Result); } return(string.Empty); }
/// <summary> /// Upates the email and phone number to admin123. /// </summary> /// <param name="memberRegistration">The member registration.</param> /// <returns></returns> private async Task <string> UpateEmailAndPhoneNumberToAdmin123(MemberRegistrationBO memberRegistration) { var admin123 = new Admin123Mapper(_unitOfWork); try { var memberDetails = await this.GetMemberDetailsForUpdateAsync(memberRegistration); if (!string.IsNullOrEmpty(memberDetails.Item1)) { var admin123BO = new Admin123BO { CORPID = _appSettings.Value.CorpId, AGENT = _appSettings.Value.AgentId, //UNIQUEID = $"{memberDetails.Item1}-{AppSettings.Environment}", LASTNAME = memberRegistration.LastName }; if (memberRegistration.UpdateToAdmin123 || (memberRegistration.EmailNotFound && memberRegistration.PhoneNumberNotFound)) { admin123BO.PHONE1 = memberRegistration.PhoneNumber; admin123BO.EMAIL = memberRegistration.Email; } else if (memberRegistration.EmailNotFound) { admin123BO.EMAIL = memberRegistration.Email; } else if (memberRegistration.PhoneNumberNotFound) { admin123BO.EMAIL = memberRegistration.PhoneNumber; } var memberDetailsObject = JsonConvert.SerializeObject(admin123BO); var uri = new Uri(_appSettings.Value.Admin123Url); var stringContent = new StringContent(memberDetailsObject, UnicodeEncoding.UTF8, "application/json"); var task = Task.Run(() => admin123.PostURIAsync(uri, stringContent, _appSettings.Value.Admin123User, _appSettings.Value.Admin123Password, memberDetailsObject, memberDetails.Item1)); task.Wait(); return(task.Result); } return(string.Empty); } catch (Exception ex) { await admin123.InsertAdmin123LogAsync(ex.StackTrace, ex.Message.ToString()); throw; } }
private async Task <string> InvokeAdmin123Async(MemberDemographicsBO memberDemographics) { var admin123 = new Admin123Mapper(_unitOfWork); try { //Bind data to Admin123BO var admin123BO = new Admin123BO { CORPID = _appSettings.Value.CorpId, AGENT = _appSettings.Value.AgentId, //UAT or demo replace with this code//memberSummary.BrokerId, //UNIQUEID = $"{memberDemographics.ExternalMemberId}-{AppSettings.Environment}", LASTNAME = memberDemographics.LastName, ADDRESS1 = memberDemographics.Address1, ADDRESS2 = string.IsNullOrEmpty(memberDemographics.Address2.Trim()) ? " " : memberDemographics.Address2, CITY = memberDemographics.City, STATE = memberDemographics.StateProvince, ZIPCODE = memberDemographics.ZipCode, EMAIL = memberDemographics.Email, PHONE1 = memberDemographics.PhoneNumber }; var memberId = memberDemographics.ExternalMemberId; var memberObject = JsonConvert.SerializeObject(admin123BO); var uri = new Uri(_appSettings.Value.Admin123Url); var stringContent = new StringContent(memberObject, UnicodeEncoding.UTF8, "application/json"); var t = Task.Run(() => admin123.PostURIAsync(uri, stringContent, _appSettings.Value.Admin123User, _appSettings.Value.Admin123Password, memberObject, memberId)); t.Wait(); return(t.Result); } catch (Exception ex) { await admin123.InsertAdmin123LogAsync(ex.StackTrace, ex.Message.ToString()); throw; } }