private bool ProcCenterSupportTokenizing(string procCenterId) { var query = new PXSelect<CCProcessingCenter, Where<CCProcessingCenter.processingCenterID, Equal<Required<CCProcessingCenter.processingCenterID>>>>(this); CCProcessingCenter procCenter = query.Select(procCenterId); string typeName = procCenter.ProcessingTypeName; if (typeName == AuthnetConstants.AIMPluginFullName) { return false; } if (typeName == AuthnetConstants.CIMPluginFullName || typeName == AuthnetConstants.APIPluginFullName) { return true; } Type type = CCPluginTypeHelper.GetPluginType(procCenter.ProcessingTypeName); if (CCPluginTypeHelper.CheckImplementInterface(type, PluginConstants.V1TokenizedInterface)) { return true; } if (CCProcessingFeatureHelper.IsFeatureSupported(type, CCProcessingFeature.ProfileManagement)) { return true; } return false; }
private CCProcessingCenter GetProcessingCenterById(string id) { CCProcessingCenter procCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, id); return(procCenter); }
private bool CheckPluginType(CCProcessingCenter procCenter) { string pluginTypeName = procCenter.ProcessingTypeName; bool res = pluginTypeNames.Contains(pluginTypeName); if (res) { return(true); } try { Type pluginType = CCPluginTypeHelper.GetPluginType(pluginTypeName); foreach (string typeName in pluginTypeNames) { res = CCPluginTypeHelper.CheckParentClass(pluginType, typeName, 0, 3) || CCPluginTypeHelper.CheckImplementInterface(pluginType, typeName); if (res) { return(true); } } } catch { } return(false); }
protected virtual void Filter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) return; Filter row = (Filter)e.Row; bool allDataIsFilled = !string.IsNullOrEmpty(row.OldPaymentMethodID) && !string.IsNullOrEmpty(row.OldCCProcessingCenterID) && !string.IsNullOrEmpty(row.NewCCProcessingCenterID); CustomerPaymentMethodList.SetProcessEnabled(allDataIsFilled); CustomerPaymentMethodList.SetProcessAllEnabled(allDataIsFilled); if (allDataIsFilled) { CCProcessingCenter newCCPC = NewProcessingCenter.Select(); string oldProcCenterId = OldProcessingCenter.SelectSingle()?.ProcessingCenterID; string newProcCenterId = NewProcessingCenter.SelectSingle()?.ProcessingCenterID; CustomerPaymentMethodList.SetParametersDelegate(cpm => { WebDialogResult result = filter.Ask(PXMessages.LocalizeFormatNoPrefix(Messages.PaymentMethodConverterWarning, oldProcCenterId, newProcCenterId), MessageButtons.OKCancel); return result == WebDialogResult.OK ? true : false; }); CustomerPaymentMethodList.SetProcessDelegate(cpm => ConvertCustomerPaymentMethod(row, cpm, newCCPC)); } ShowUnknownPluginWarningIfNeeded(row, OldProcessingCenter.Select(), nameof(Filter.OldCCProcessingCenterID)); ShowUnknownPluginWarningIfNeeded(row, NewProcessingCenter.Select(), nameof(Filter.NewCCProcessingCenterID)); }
private static void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { if (newCCPC == null) { throw new PXException(Messages.NotSetProcessingCenter); } PaymentMethodUpdater updaterGraph = PXGraph.CreateInstance <PaymentMethodUpdater>(); updaterGraph.ConvertCustomerPaymentMethod(cpm, newCCPC); }
public IEnumerable GetRecords() { BqlCommand command = BqlCommand.CreateInstance(search); PXView view = new PXView(_Graph, false, command); foreach (object obj in view.SelectMulti()) { CCProcessingCenter procCenter = PXResult.Unwrap <CCProcessingCenter>(obj); if (CheckPluginType(procCenter)) { yield return(obj); } } }
private void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { if (newCCPC == null) { throw new PXException(Messages.NotSetProcessingCenter); } if (!CCProcessingFeatureHelper.IsFeatureSupported(newCCPC, CCProcessingFeature.ProfileManagement)) { throw new PXException(Messages.ProcessingCenterShouldTokenization); } PaymentMethodUpdater updaterGraph = PXGraph.CreateInstance <PaymentMethodUpdater>(); updaterGraph.ConvertCustomerPaymentMethod(cpm, newCCPC); }
private void ShowUnknownPluginWarningIfNeeded(Filter row, CCProcessingCenter procCenter, string fName) { if (procCenter != null) { if (procCenter != null && !IsKnownPlugun(procCenter.ProcessingTypeName)) { filter.Cache.RaiseExceptionHandling(fName, row, row.OldCCProcessingCenterID, new PXSetPropertyException(Messages.IncompatiblePluginForCardProcessing, PXErrorLevel.Warning)); } else { filter.Cache.RaiseExceptionHandling(fName, row, row.OldCCProcessingCenterID, null); } } }
private void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { if (newCCPC == null) { throw new PXException("New Processing Center is not set!"); } if (!CCPaymentProcessing.IsFeatureSupported(newCCPC, CCProcessingFeature.Tokenization)) { throw new PXException("New processing center should support tokenization!"); } PaymentMethodUpdater updaterGreph = PXGraph.CreateInstance <PaymentMethodUpdater>(); updaterGreph.ConvertCustomerPaymentMethod(cpm, newCCPC); }
protected virtual void CCProcessingCenterPmntMethod_RowInserting(PXCache cache, PXRowInsertingEventArgs e) { if (errorKey) { errorKey = false; e.Cancel = true; } else { CCProcessingCenterPmntMethod row = e.Row as CCProcessingCenterPmntMethod; string detID = row.ProcessingCenterID; bool isExist = false; foreach (CCProcessingCenterPmntMethod it in this.ProcessingCenters.Select()) { if (!Object.ReferenceEquals(it, row) && it.ProcessingCenterID == row.ProcessingCenterID) { isExist = true; } } if (isExist) { cache.RaiseExceptionHandling <CCProcessingCenterPmntMethod.processingCenterID>(e.Row, detID, new PXException(Messages.ProcessingCenterIsAlreadyAssignedToTheCard)); e.Cancel = true; } else { CCProcessingCenter procCenter = GetProcessingCenterById(row.ProcessingCenterID); bool supported = CCProcessingFeatureHelper.IsFeatureSupported(procCenter, CCProcessingFeature.PaymentHostedForm); if (supported) { if (row.IsDefault == false) { WebDialogResult result = ProcessingCenters.Ask(Messages.DefaultProcessingCenterConfirmation, MessageButtons.YesNo); if (result == WebDialogResult.Yes) { row.IsDefault = true; } } } } } }
protected virtual void Filter_OldCCProcessingCenterID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { Filter filter = e.Row as Filter; if (filter == null) { return; } if (!string.IsNullOrEmpty(filter.OldCCProcessingCenterID)) { CCProcessingCenter procCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, filter.OldCCProcessingCenterID); if (CCPaymentProcessing.IsFeatureSupported(procCenter, CCProcessingFeature.Tokenization)) { throw new PXSetPropertyException("Old processing center should not support tokenization!"); } } }
protected virtual void Filter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } Filter row = (Filter)e.Row; bool allDataIsFilled = !string.IsNullOrEmpty(row.OldPaymentMethodID) && !string.IsNullOrEmpty(row.OldCCProcessingCenterID) && !string.IsNullOrEmpty(row.NewCCProcessingCenterID); CustomerPaymentMethodList.SetProcessEnabled(allDataIsFilled); CustomerPaymentMethodList.SetProcessAllEnabled(allDataIsFilled); if (allDataIsFilled) { CCProcessingCenter newCCPC = ProcessingCenters.Select(); CustomerPaymentMethodList.SetProcessDelegate(cpm => ConvertCustomerPaymentMethod(cpm, newCCPC)); } }
protected virtual void Filter_NewCCProcessingCenterID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e) { Filter filter = e.Row as Filter; if (filter == null) { return; } if (!string.IsNullOrEmpty(filter.NewCCProcessingCenterID)) { CCProcessingCenter procCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, filter.NewCCProcessingCenterID); if (!CCProcessingFeatureHelper.IsFeatureSupported(procCenter, CCProcessingFeature.ProfileManagement)) { throw new PXSetPropertyException(Messages.ProcessingCenterShouldTokenization); } } }
protected virtual void CCProcessingCenterPmntMethod_RowPersisting(PXCache sender, PXRowPersistingEventArgs e) { CCProcessingCenterPmntMethod row = (CCProcessingCenterPmntMethod)e.Row; CCProcessingCenter processingCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, row.ProcessingCenterID); if (processingCenter != null) { if (CCProcessingFeatureHelper.IsFeatureSupported(processingCenter, CCProcessingFeature.ProfileManagement)) { PaymentMethodDetail ccpid = PXSelect <PaymentMethodDetail, Where <PaymentMethodDetail.paymentMethodID, Equal <Current <PaymentMethod.paymentMethodID> >, And <PaymentMethodDetail.isCCProcessingID, Equal <True> > > > .Select(this); if (ccpid == null) { throw new PXException(Messages.CCPaymentProfileIDNotSetUp); } } } }
protected virtual void Filter_RowSelected(PXCache sender, PXRowSelectedEventArgs e) { if (e.Row == null) { return; } Filter row = (Filter)e.Row; PXUIFieldAttribute.SetEnabled <Filter.oldCCProcessingCenterID>(sender, e.Row, (!string.IsNullOrEmpty(row.OldPaymentMethodID))); PXUIFieldAttribute.SetEnabled <Filter.newCCProcessingCenterID>(sender, e.Row, (!string.IsNullOrEmpty(row.OldCCProcessingCenterID))); bool newDataIsFilled = !string.IsNullOrEmpty(row.NewCCProcessingCenterID); CustomerPaymentMethodList.SetProcessEnabled(newDataIsFilled); CustomerPaymentMethodList.SetProcessAllEnabled(newDataIsFilled); if (newDataIsFilled) { // PaymentMethod newPM = PaymentMethods.Select(); CCProcessingCenter newCCPC = ProcessingCenters.Select(); CustomerPaymentMethodList.SetProcessDelegate(cpm => ConvertCustomerPaymentMethod(cpm, newCCPC)); } }
private void DoConvert(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { CCProcessingCenterPmntMethod newProcessingCenterPM = PXSelect<CCProcessingCenterPmntMethod, Where<CCProcessingCenterPmntMethod.paymentMethodID, Equal<Required<CCProcessingCenterPmntMethod.paymentMethodID>>, And<CCProcessingCenterPmntMethod.processingCenterID, Equal<Required<CCProcessingCenterPmntMethod.processingCenterID>>>>>.Select(this, cpm.PaymentMethodID, newCCPC.ProcessingCenterID); if (newProcessingCenterPM == null) { newProcessingCenterPM = (CCProcessingCenterPmntMethod)ProcessingCenterPM.Cache.CreateInstance(); newProcessingCenterPM.PaymentMethodID = cpm.PaymentMethodID; newProcessingCenterPM.ProcessingCenterID = newCCPC.ProcessingCenterID; ProcessingCenterPM.Insert(newProcessingCenterPM); } CustomerPaymentMethod currCPM = (CustomerPaymentMethod)CustomerPM.Cache.CreateCopy(cpm); var oldCCProcessingCenterID = currCPM.CCProcessingCenterID; currCPM.CCProcessingCenterID = newCCPC.ProcessingCenterID; if (currCPM.CustomerCCPID == null) { CustomerPM.Cache.SetDefaultExt<CustomerPaymentMethod.customerCCPID>(currCPM); } currCPM.Selected = true; currCPM = CustomerPM.Update(currCPM); CustomerPM.Current = currCPM; PXResultset<PaymentMethodDetail> oldDetails = PMDetails.Select(currCPM.PaymentMethodID); foreach (PaymentMethodDetail oldDetail in oldDetails) { PaymentMethodDetail newDetail = (PaymentMethodDetail)PMDetails.Cache.CreateCopy(oldDetail); newDetail.ValidRegexp = null; PMDetails.Update(newDetail); } PaymentMethod CurrPM = PM.Select(); PaymentMethodDetail CCPID = FindCCPID(CurrPM); if (CCPID == null) { using (PXTransactionScope ts = new PXTransactionScope()) { PaymentMethodDetail res; CCPID = (PaymentMethodDetail)PMDetails.Cache.CreateInstance(); CCPID.PaymentMethodID = currCPM.PaymentMethodID; CCPID.UseFor = PaymentMethodDetailUsage.UseForARCards; CCPID.DetailID = "CCPID"; CCPID.Descr = Messages.PaymentProfileID; CCPID.IsCCProcessingID = true; CCPID.IsRequired = true; res = PMDetails.Insert(CCPID); if (res == null) { throw new PXException(Messages.CouldNotInsertPMDetail); } else { PMDetails.Cache.Persist(PXDBOperation.Insert); } ts.Complete(); } } CCProcessingCenter procCenter = PXSelect<CCProcessingCenter, Where<CCProcessingCenter.processingCenterID, Equal<Required<CCProcessingCenter.processingCenterID>>>> .Select(this, oldCCProcessingCenterID); bool oldProcCenterSupportTokenizing = ProcCenterSupportTokenizing(oldCCProcessingCenterID); bool newProcCenterSupportTokenizing = ProcCenterSupportTokenizing(newCCPC.ProcessingCenterID); if (!oldProcCenterSupportTokenizing && newProcCenterSupportTokenizing) { CustomerPaymentMethodDetail newCCPIDPM = PXSelect<CustomerPaymentMethodDetail, Where<CustomerPaymentMethodDetail.pMInstanceID, Equal<Required<CustomerPaymentMethodDetail.pMInstanceID>>, And<CustomerPaymentMethodDetail.paymentMethodID, Equal<Required<CustomerPaymentMethodDetail.paymentMethodID>>, And<CustomerPaymentMethodDetail.detailID, Equal<Required<CustomerPaymentMethodDetail.detailID>>>>>> .Select(this, currCPM.PMInstanceID, currCPM.PaymentMethodID, CCPID.DetailID); if (newCCPIDPM != null) { newCCPIDPM.Value = null; CustomerPMDetails.Update(newCCPIDPM); } else { newCCPIDPM = new CustomerPaymentMethodDetail { PMInstanceID = currCPM.PMInstanceID, PaymentMethodID = currCPM.PaymentMethodID, DetailID = CCPID.DetailID }; CustomerPMDetails.Insert(newCCPIDPM); } var graph = PXGraph.CreateInstance<CCCustomerInformationManagerGraph>(); ICCPaymentProfileAdapter paymentProfile = new GenericCCPaymentProfileAdapter<CustomerPaymentMethod>(CustomerPM); ICCPaymentProfileDetailAdapter profileDetail = new GenericCCPaymentProfileDetailAdapter<CustomerPaymentMethodDetail, PaymentMethodDetail>(CustomerPMDetails, PMDetails); DateTime expiredDate; if (CheckCardIsExpired(currCPM, out expiredDate)) { Customer cust = new PXSelect<Customer, Where<Customer.bAccountID, Equal<Required<Customer.bAccountID>>>>(this) .SelectSingle(currCPM.BAccountID); throw new PXException(AR.Messages.ERR_CCCreditCardHasExpired, expiredDate.ToString("d"), cust.AcctCD); } graph.GetOrCreatePaymentProfile(this, paymentProfile, profileDetail); } if (newProcCenterSupportTokenizing) { if (currCPM.CustomerCCPID == null) { currCPM.CustomerCCPID = cpm.CustomerCCPID; } CustomerProcessingCenterID newCustomerProcessingCenterID = new CustomerProcessingCenterID { CCProcessingCenterID = newCCPC.ProcessingCenterID, BAccountID = cpm.BAccountID, CustomerCCPID = currCPM.CustomerCCPID }; AddCustomerProcessingCenterIfNeeded(newCustomerProcessingCenterID); } currCPM = CustomerPM.Update(currCPM); }
public void ConvertCustomerPaymentMethod(bool processExpiredCards, CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { CustomerPM.Current = cpm; DateTime expiredDate; if (processExpiredCards && CheckCardIsExpired(cpm, out expiredDate) && !ProcCenterSupportTokenizing(cpm.CCProcessingCenterID)) { foreach (CustomerPaymentMethodDetail cpmd in CustomerPMDetails.Select().RowCast<CustomerPaymentMethodDetail>()) { CustomerPMDetails.Delete(cpmd); } cpm.IsActive = false; CustomerPM.Update(cpm); } else { DoConvert(cpm, newCCPC); } this.Save.Press(); }
private static void ConvertCustomerPaymentMethod(Filter filter, CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { if (newCCPC == null) { throw new PXException(Messages.NotSetProcessingCenter); } PaymentMethodUpdater updaterGraph = PXGraph.CreateInstance<PaymentMethodUpdater>(); updaterGraph.ConvertCustomerPaymentMethod(filter.ProcessExpiredCards.GetValueOrDefault(), cpm, newCCPC); }
public void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { CCProcessingCenterPmntMethod newProcessingCenterPM = PXSelect <CCProcessingCenterPmntMethod, Where <CCProcessingCenterPmntMethod.paymentMethodID, Equal <Required <CCProcessingCenterPmntMethod.paymentMethodID> >, And <CCProcessingCenterPmntMethod.processingCenterID, Equal <Required <CCProcessingCenterPmntMethod.processingCenterID> > > > > .Select(this, cpm.PaymentMethodID, newCCPC.ProcessingCenterID); if (newProcessingCenterPM == null) { newProcessingCenterPM = (CCProcessingCenterPmntMethod)ProcessingCenterPM.Cache.CreateInstance(); newProcessingCenterPM.PaymentMethodID = cpm.PaymentMethodID; newProcessingCenterPM.ProcessingCenterID = newCCPC.ProcessingCenterID; ProcessingCenterPM.Insert(newProcessingCenterPM); } CustomerPaymentMethod currCPM = (CustomerPaymentMethod)CustomerPM.Cache.CreateCopy(cpm); var oldCCProcessingCenterID = currCPM.CCProcessingCenterID; currCPM.CCProcessingCenterID = newCCPC.ProcessingCenterID; if (currCPM.CustomerCCPID == null) { CustomerPM.Cache.SetDefaultExt <CustomerPaymentMethod.customerCCPID>(currCPM); } currCPM.Selected = true; currCPM = CustomerPM.Update(currCPM); CustomerPM.Current = currCPM; PXResultset <PaymentMethodDetail> oldDetails = PMDetails.Select(currCPM.PaymentMethodID); foreach (PaymentMethodDetail oldDetail in oldDetails) { PaymentMethodDetail newDetail = (PaymentMethodDetail)PMDetails.Cache.CreateCopy(oldDetail); newDetail.ValidRegexp = null; PMDetails.Update(newDetail); } PaymentMethod CurrPM = PM.Select(); PaymentMethodDetail CCPID = FindCCPID(CurrPM); if (CCPID == null) { using (PXTransactionScope ts = new PXTransactionScope()) { PaymentMethodDetail res; CCPID = (PaymentMethodDetail)PMDetails.Cache.CreateInstance(); CCPID.PaymentMethodID = currCPM.PaymentMethodID; CCPID.UseFor = PaymentMethodDetailUsage.UseForARCards; CCPID.DetailID = "CCPID"; CCPID.Descr = Messages.PaymentProfileID; CCPID.IsCCProcessingID = true; CCPID.IsRequired = true; res = PMDetails.Insert(CCPID); if (res == null) { throw new PXException(Messages.CouldNotInsertPMDetail); } else { PMDetails.Cache.Persist(PXDBOperation.Insert); } ts.Complete(); } } CCProcessingCenter procCenter = PXSelect <CCProcessingCenter, Where <CCProcessingCenter.processingCenterID, Equal <Required <CCProcessingCenter.processingCenterID> > > > .Select(this, oldCCProcessingCenterID); bool doesOldProcCenterSupportTokenizing = CCProcessingFeatureHelper.IsFeatureSupported(procCenter, CCProcessingFeature.ProfileManagement); bool doesNewProcCenterSupportTokenizing = CCProcessingFeatureHelper.IsFeatureSupported(newCCPC, CCProcessingFeature.ProfileManagement); if (!doesOldProcCenterSupportTokenizing && doesNewProcCenterSupportTokenizing) { CustomerPaymentMethodDetail newCCPIDPM = PXSelect <CustomerPaymentMethodDetail, Where <CustomerPaymentMethodDetail.pMInstanceID, Equal <Required <CustomerPaymentMethodDetail.pMInstanceID> >, And <CustomerPaymentMethodDetail.paymentMethodID, Equal <Required <CustomerPaymentMethodDetail.paymentMethodID> >, And <CustomerPaymentMethodDetail.detailID, Equal <Required <CustomerPaymentMethodDetail.detailID> > > > > > .Select(this, currCPM.PMInstanceID, currCPM.PaymentMethodID, CCPID.DetailID); if (newCCPIDPM != null) { newCCPIDPM.Value = null; CustomerPMDetails.Update(newCCPIDPM); } else { newCCPIDPM = new CustomerPaymentMethodDetail { PMInstanceID = currCPM.PMInstanceID, PaymentMethodID = currCPM.PaymentMethodID, DetailID = CCPID.DetailID }; CustomerPMDetails.Insert(newCCPIDPM); } var graph = PXGraph.CreateInstance <CCCustomerInformationManagerGraph>(); graph.GetOrCreatePaymentProfile(this, new GenericCustomerPaymentMethodAdaper <CustomerPaymentMethod>(CustomerPM), new GenericCustomerPaymentMethodDetailAdapter <CustomerPaymentMethodDetail>(CustomerPMDetails)); } if (doesNewProcCenterSupportTokenizing) { if (currCPM.CustomerCCPID == null) { currCPM.CustomerCCPID = cpm.CustomerCCPID; } CustomerProcessingCenterID newCustomerProcessingCenterID = new CustomerProcessingCenterID { CCProcessingCenterID = newCCPC.ProcessingCenterID, BAccountID = cpm.BAccountID, CustomerCCPID = currCPM.CustomerCCPID }; AddCustomerProcessingCenterIfNeeded(newCustomerProcessingCenterID); } currCPM = CustomerPM.Update(currCPM); this.Save.Press(); }
public void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC) { CCProcessingCenterPmntMethod newProcessingCenterPM = PXSelect <CCProcessingCenterPmntMethod, Where <CCProcessingCenterPmntMethod.paymentMethodID, Equal <Required <CCProcessingCenterPmntMethod.paymentMethodID> >, And <CCProcessingCenterPmntMethod.processingCenterID, Equal <Required <CCProcessingCenterPmntMethod.processingCenterID> > > > > .Select(this, cpm.PaymentMethodID, newCCPC.ProcessingCenterID); if (newProcessingCenterPM == null) { newProcessingCenterPM = (CCProcessingCenterPmntMethod)ProcessingCenterPM.Cache.CreateInstance(); newProcessingCenterPM.PaymentMethodID = cpm.PaymentMethodID; newProcessingCenterPM.ProcessingCenterID = newCCPC.ProcessingCenterID; ProcessingCenterPM.Insert(newProcessingCenterPM); } CustomerPaymentMethod currCPM = (CustomerPaymentMethod)CustomerPM.Cache.CreateCopy(cpm); currCPM.CCProcessingCenterID = newCCPC.ProcessingCenterID; CustomerPM.Cache.SetDefaultExt <CustomerPaymentMethod.customerCCPID>(currCPM); currCPM.Selected = true; currCPM = CustomerPM.Update(currCPM); CustomerPM.Current = currCPM; PXResultset <PaymentMethodDetail> oldDetails = PMDetails.Select(currCPM.PaymentMethodID); foreach (PaymentMethodDetail oldDetail in oldDetails) { PaymentMethodDetail newDetail = (PaymentMethodDetail)PMDetails.Cache.CreateCopy(oldDetail); newDetail.ValidRegexp = null; PMDetails.Update(newDetail); } PaymentMethod CurrPM = PM.Select(); PaymentMethodDetail CCPID = FindCCPID(CurrPM); if (CCPID == null) { using (PXTransactionScope ts = new PXTransactionScope()) { PaymentMethodDetail res; CCPID = (PaymentMethodDetail)PMDetails.Cache.CreateInstance(); CCPID.PaymentMethodID = currCPM.PaymentMethodID; CCPID.UseFor = PaymentMethodDetailUsage.UseForARCards; CCPID.DetailID = "CCPID"; CCPID.Descr = "Payment Profile ID"; CCPID.IsCCProcessingID = true; CCPID.IsRequired = true; res = PMDetails.Insert(CCPID); if (res == null) { throw new PXException(Messages.CouldNotInsertPMDetail); } else { PMDetails.Cache.Persist(PXDBOperation.Insert); } ts.Complete(); } } CustomerPaymentMethodDetail newCCPIDPM = PXSelect <CustomerPaymentMethodDetail, Where <CustomerPaymentMethodDetail.pMInstanceID, Equal <Required <CustomerPaymentMethodDetail.pMInstanceID> >, And <CustomerPaymentMethodDetail.paymentMethodID, Equal <Required <CustomerPaymentMethodDetail.paymentMethodID> >, And <CustomerPaymentMethodDetail.detailID, Equal <Required <CustomerPaymentMethodDetail.detailID> > > > > > .Select(this, currCPM.PMInstanceID, currCPM.PaymentMethodID, CCPID.DetailID); if (newCCPIDPM != null) { newCCPIDPM.Value = null; CustomerPMDetails.Update(newCCPIDPM); } else { newCCPIDPM = new CustomerPaymentMethodDetail(); newCCPIDPM.PMInstanceID = currCPM.PMInstanceID; newCCPIDPM.PaymentMethodID = currCPM.PaymentMethodID; newCCPIDPM.DetailID = CCPID.DetailID; CustomerPMDetails.Insert(newCCPIDPM); } CustomerPaymentMethodMaint.SyncNewPMI(this, CustomerPM, CustomerPMDetails); currCPM.Converted = true; currCPM = CustomerPM.Update(currCPM); this.Save.Press(); }