public static void SyncDeletePMI(PXGraph graph, PXSelectBase <CustomerPaymentMethod> customerPaymentMethodView, PXSelectBase <CustomerPaymentMethodDetail> detailsView) { IEnumerator cpmEnumerator = customerPaymentMethodView.Cache.Deleted.GetEnumerator(); if (cpmEnumerator.MoveNext()) { CustomerPaymentMethod current = (CustomerPaymentMethod)cpmEnumerator.Current; CCProcessingCenter processingCenter = CCProcessingUtils.getProcessingCenter(graph, current.CCProcessingCenterID); if (!string.IsNullOrEmpty(current.CCProcessingCenterID) && processingCenter.SyncronizeDeletion == true) { CCCustomerInformationManager cim = new CCCustomerInformationManager(current.CCProcessingCenterID, CCProcessingFeature.Tokenization, new ProcessingContext() { aCustomerID = current.BAccountID, aPMInstanceID = current.PMInstanceID }); CustomerPaymentMethodDetail ccpidCPMDet = null; PaymentMethodDetail ccpidPMDet = PXSelect <PaymentMethodDetail, Where <PaymentMethodDetail.paymentMethodID, Equal <Optional <CustomerPaymentMethod.paymentMethodID> >, And <PaymentMethodDetail.useFor, Equal <PaymentMethodDetailUsage.useForARCards>, And <PaymentMethodDetail.isCCProcessingID, Equal <True> > > > > .Select(graph, current.PaymentMethodID); foreach (CustomerPaymentMethodDetail deletedDet in detailsView.Cache.Deleted) { if (deletedDet.DetailID == ccpidPMDet.DetailID) { ccpidCPMDet = deletedDet; break; } } if (ccpidCPMDet != null && !string.IsNullOrEmpty(ccpidCPMDet.Value)) { cim.DeletePaymentMethod(); } } } }