public Dictionary <string, CustomerCreditCard> GetPaymentProfilesFromService() { IEnumerable <SettingsValue> settings = settingsGenerator.GetSettings(); ICCProfileProcessor processor = processingPlugin.CreateProcessor <ICCProfileProcessor>(settings); List <CreditCardReceiver> syncCards = customerProfileIds.Select(i => receiverFactory.GetCreditCardReceiver(processingPlugin.CreateProcessor <ICCProfileProcessor>(settings), i)).ToList(); try { Parallel.ForEach(syncCards, (CreditCardReceiver task) => { task.DoAction(); }); } catch (AggregateException ex) { Exception innerEx = ex.InnerExceptions[0]; throw new PXException(innerEx.Message); } Dictionary <string, CustomerCreditCard> ret = syncCards.Select(i => new CustomerCreditCard() { CreditCards = i.Result, CustomerProfileId = i.CustomerProfileId }) .ToDictionary(i => i.CustomerProfileId); return(ret); }
public Dictionary <string, CustomerData> GetCustomerProfilesFromService() { IEnumerable <SettingsValue> settings = settingsGenerator.GetSettings(); ICCProfileProcessor profileProcessor = processingPlugin.CreateProcessor <ICCProfileProcessor>(settings); Dictionary <string, CustomerData> ret = profileProcessor.GetAllCustomerProfiles().ToDictionary(i => i.CustomerProfileID); return(ret); }
public CreditCardReceiver GetCreditCardReceiver(ICCProfileProcessor profileProcessor, string customerProfileId) { CreditCardReceiver receiver = new CreditCardReceiver(profileProcessor, customerProfileId) { AttempsCnt = 3 }; if (filter.LoadExpiredCards.GetValueOrDefault() != true) { receiver.ProcessFilter = (CreditCardData item) => { bool ret = true; if (item.CardExpirationDate.HasValue) { DateTime dt = item.CardExpirationDate.Value.Date.AddMonths(1); ret = DateTime.Now.Date < dt ? true : false; } return(ret); }; } return(receiver); }
public CreditCardReceiver(ICCProfileProcessor profileProcessor, string customerProfileId) { this.profileProcessor = profileProcessor; this.CustomerProfileId = customerProfileId; }