public static bool?CCProcessingCenterNeedsExpDateUpdate(PXGraph graph, CCProcessingCenter ProcessingCenter)
        {
            if (CCPaymentProcessing.IsFeatureSupported(ProcessingCenter, CCProcessingFeature.UnmaskedExpirationDate))
            {
                PXResultset <CustomerPaymentMethod> unupdatedCpms = PXSelect <CustomerPaymentMethod, Where <CustomerPaymentMethod.cCProcessingCenterID,
                                                                                                            Equal <Required <CustomerPaymentMethod.cCProcessingCenterID> >, And <CustomerPaymentMethod.expirationDate, IsNull> > > .Select(graph, ProcessingCenter.ProcessingCenterID);

                return(unupdatedCpms.Count != 0);
            }
            return(null);
        }
        public static bool isFeatureSupported(PXGraph graph, int?PMInstanceID, CCProcessingFeature FeatureName)
        {
            CustomerPaymentMethod current = getCustomerPaymentMethod(graph, PMInstanceID);

            if (current == null)
            {
                return(false);
            }
            CCProcessingCenter processingCenter = getProcessingCenter(graph, current.CCProcessingCenterID);

            return(CCPaymentProcessing.IsFeatureSupported(processingCenter, FeatureName));
        }
        public static bool isHFPaymentMethod(PXGraph graph, int?PMInstanceID)
        {
            CustomerPaymentMethod current = getCustomerPaymentMethod(graph, PMInstanceID);

            if (current == null)
            {
                return(false);
            }
            CCProcessingCenter processingCenter = getProcessingCenter(graph, current.CCProcessingCenterID);

            return(CCPaymentProcessing.IsFeatureSupported(processingCenter, CCProcessingFeature.HostedForm) && (processingCenter.AllowDirectInput != true));
        }
        public static string GetTokenizedPMsString(PXGraph graph)
        {
            List <CCProcessingCenter> tokenizedPCs = new List <CCProcessingCenter>();
            HashSet <string>          pmSet        = new HashSet <string>();

            foreach (CCProcessingCenter pc in PXSelect <CCProcessingCenter, Where <CCProcessingCenter.isActive, Equal <True> > > .Select(graph))
            {
                if (CCPaymentProcessing.IsFeatureSupported(pc, CCProcessingFeature.Tokenization) &&
                    CCProcessingCenterNeedsExpDateUpdate(graph, pc) != false)
                {
                    tokenizedPCs.Add(pc);
                }
            }

            foreach (CCProcessingCenter pc in tokenizedPCs)
            {
                foreach (PXResult <CustomerPaymentMethod, PaymentMethod> tokenizedPM in PXSelectJoinGroupBy <CustomerPaymentMethod,
                                                                                                             InnerJoin <PaymentMethod, On <CustomerPaymentMethod.paymentMethodID, Equal <PaymentMethod.paymentMethodID> > >,
                                                                                                             Where <CustomerPaymentMethod.cCProcessingCenterID, Equal <Required <CustomerPaymentMethod.cCProcessingCenterID> > >,
                                                                                                             Aggregate <GroupBy <CustomerPaymentMethod.paymentMethodID, GroupBy <PaymentMethod.descr> > > > .Select(graph, pc.ProcessingCenterID))
                {
                    PaymentMethod pm = tokenizedPM;
                    pmSet.Add(pm.Descr);
                }
            }

            if (pmSet.Count == 0)
            {
                return(string.Empty);
            }

            StringBuilder sb = new StringBuilder();

            foreach (string descr in pmSet)
            {
                if (sb.Length > 0)
                {
                    sb.Append(", ");
                }
                sb.Append(descr);
            }

            return(sb.ToString());
        }