public static bool ImportPayments(string distributorID, string locale, PaymentInfoItemList paymentInfo, HttpSessionState session) { if (string.IsNullOrEmpty(distributorID)) { return(false); } else { string country = (locale.Length > 2) ? locale.Substring(3) : locale; var proxy = ServiceClientProvider.GetOrderServiceProxy(); var request = new InsertPaymentInfoRequest_V01(); foreach (PaymentInformation payment in paymentInfo) { request.PaymentInfo = payment; request.DistributorID = distributorID; request.CountryCode = country; var response = proxy.InsertPaymentInfo(new InsertPaymentInfoRequest1(request)).InsertPaymentInfoResult as InsertPaymentInfoResponse_V01; if (response != null && response.Status != ServiceResponseStatusType.Success) { ExceptionPolicy.HandleException(new Exception(response.Message), ProviderPolicies.SYSTEM_EXCEPTION); } } //savePaymentInfoToCache(getCacheKey(distributorID, locale), ReloadPaymentInfo(distributorID, locale, session), session); } return(true); }
public static int SavePaymentInfo(string distributorID, string locale, PaymentInformation paymentInfo) { if (string.IsNullOrEmpty(distributorID)) { return(0); } if (paymentInfo.IsTemporary) { Trace.TraceWarning("Method: SavePaymentInfo Distributor:'{0}' Locate: '{1}'", distributorID, locale); var payments = getGetPaymentInfoFromCache(distributorID, locale); if (null == payments) { payments = new PaymentInfoItemList(); savePaymentInfoToCache(getCacheKey(distributorID, locale), payments); } PaymentInformation existing = null; try { existing = payments.Find(p => p.ID == paymentInfo.ID); } catch (Exception ex) { ExceptionPolicy.HandleException(ex, ProviderPolicies.SYSTEM_EXCEPTION); } if (null != existing) { payments.Remove(existing); } payments.Add(paymentInfo); return(0); } else { var proxy = ServiceClientProvider.GetOrderServiceProxy(); try { string country = (locale.Length > 2) ? locale.Substring(3) : locale; if (HLConfigManager.Configurations.DOConfiguration.IsChina) { var request = new InsertPaymentInfoRequest_V02(); request.PaymentInfo = paymentInfo; request.DistributorID = distributorID; request.CountryCode = country; var response = proxy.InsertPaymentInfo(new InsertPaymentInfoRequest1(request)).InsertPaymentInfoResult as InsertPaymentInfoResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { ReloadPaymentInfo(distributorID, locale); return(response.ID); } } else { var request = new InsertPaymentInfoRequest_V01(); request.PaymentInfo = paymentInfo; request.DistributorID = distributorID; request.CountryCode = country; var response = proxy.InsertPaymentInfo(new InsertPaymentInfoRequest1(request)).InsertPaymentInfoResult as InsertPaymentInfoResponse_V01; if (response != null && response.Status == ServiceResponseStatusType.Success) { ReloadPaymentInfo(distributorID, locale); return(response.ID); } } } catch (Exception ex) { WebUtilities.LogServiceExceptionWithContext <ServiceProvider.OrderSvc.IOrderService>(ex, proxy); } } return(0); }