public void GetCreatePaymentProfileForm <TPaymentMethodType>(PXGraph graph,
                                                              PXSelectBase <TPaymentMethodType> customerPaymentMethodView,
                                                              TPaymentMethodType currentCustomerPaymentMethod)
     where TPaymentMethodType : CustomerPaymentMethod, new()
 {
     CCCustomerInformationManager.GetCreatePaymentProfileForm(graph, customerPaymentMethodView, currentCustomerPaymentMethod);
 }
Exemplo n.º 2
0
        public static void GetCreatePaymentProfileForm(PXGraph graph, ICCPaymentProfileAdapter paymentProfileAdapter)
        {
            if (graph == null || paymentProfileAdapter == null)
            {
                return;
            }
            ICCPaymentProfile            ccPaymentProfile = paymentProfileAdapter.Current;
            PXCache                      cache            = paymentProfileAdapter.Cache;
            ProcessingCardsPluginFactory pluginFactory    = GetProcessingCardsPluginFactory(ccPaymentProfile.CCProcessingCenterID);
            CCCustomerInformationManager cim     = GetCustomerInformationManager(pluginFactory);
            CCProcessingContext          context = new CCProcessingContext()
            {
                processingCenter = pluginFactory.GetProcessingCenter(),
                aCustomerID      = ccPaymentProfile.BAccountID,
                aPMInstanceID    = ccPaymentProfile.PMInstanceID,
                callerGraph      = graph
            };
            CardProcessingReadersProvider readersProvider = new CardProcessingReadersProvider(context);

            cim.SetReadersProvider(readersProvider);
            string id = ccPaymentProfile.CustomerCCPID;

            if (id == null)
            {
                id = cim.CreateCustomerProfile();
                ICCPaymentProfile cpm = cache.CreateCopy(ccPaymentProfile) as ICCPaymentProfile;
                cpm.CustomerCCPID = id;
                cache.Update(cpm);
            }
            var processingCenter = pluginFactory.GetProcessingCenter();

            if (processingCenter.CreateAdditionalCustomerProfiles == true)
            {
                int customerProfileCount = CCProcessingHelper.CustomerProfileCountPerCustomer(graph,
                                                                                              ccPaymentProfile.BAccountID,
                                                                                              ccPaymentProfile.CCProcessingCenterID); // Total customer profile count per customer

                var cardLimit = processingCenter.CreditCardLimit;
                if (cardLimit != null && cardLimit > 0)
                {
                    int allPaymentProfileCount = cim.GetAllPaymentProfiles().Count();
                    if (CCProcessingHelper.IsCreditCardCountEnough(allPaymentProfileCount, cardLimit.Value))
                    {
                        context.PrefixForCustomerCD = CCProcessingHelper.BuildPrefixForCustomerCD(customerProfileCount, processingCenter);
                        id = cim.CreateCustomerProfile();
                        ICCPaymentProfile cpm = cache.CreateCopy(ccPaymentProfile) as ICCPaymentProfile;
                        cpm.CustomerCCPID = id;
                        cache.Update(cpm);
                    }
                }
            }
            cim.GetCreatePaymentProfileForm();
        }
        public static void GetCreatePaymentProfileForm <TPaymentMethodType>(PXGraph graph,
                                                                            PXSelectBase <TPaymentMethodType> customerPaymentMethodView,
                                                                            TPaymentMethodType currentCustomerPaymentMethod)
            where TPaymentMethodType : CustomerPaymentMethod, new()
        {
            if (graph == null || customerPaymentMethodView == null || currentCustomerPaymentMethod == null)
            {
                return;
            }
            CCCustomerInformationManager cim = new CCCustomerInformationManager(currentCustomerPaymentMethod.CCProcessingCenterID, CCProcessingFeature.HostedForm)
            {
                CustomerID   = currentCustomerPaymentMethod.BAccountID,
                PMInstanceID = currentCustomerPaymentMethod.PMInstanceID,
                CallerGraph  = graph
            };

            string id = currentCustomerPaymentMethod.CustomerCCPID;

            if (currentCustomerPaymentMethod.CustomerCCPID == null)
            {
                id = cim.CreateCustomerProfile();
                TPaymentMethodType cpm = (TPaymentMethodType)customerPaymentMethodView.Cache.CreateCopy(currentCustomerPaymentMethod);
                cpm.CustomerCCPID = id;
                customerPaymentMethodView.Update(cpm);
            }
            var processingCenter = cim._context.processingCenter;

            if (processingCenter.CreateAdditionalCustomerProfiles == true)
            {
                int customerProfileCount = CCProcessingHelper.CustomerProfileCountPerCustomer(graph,
                                                                                              currentCustomerPaymentMethod.BAccountID,
                                                                                              currentCustomerPaymentMethod.CCProcessingCenterID); // Total customer profile count per customer

                var cardLimit = processingCenter.CreditCardLimit;
                if (cardLimit != null && cardLimit > 0)
                {
                    int allPaymentProfileCount = cim.GetAllPaymentProfiles().Count();
                    if (CCProcessingHelper.IsCreditCardCountEnough(allPaymentProfileCount, cardLimit.Value))
                    {
                        cim.PrefixForCustomerCD = CCProcessingHelper.BuildPrefixForCustomerCD(customerProfileCount, processingCenter);
                        id = cim.CreateCustomerProfile();
                        TPaymentMethodType cpm = (TPaymentMethodType)customerPaymentMethodView.Cache.CreateCopy(currentCustomerPaymentMethod);
                        cpm.CustomerCCPID = id;
                        customerPaymentMethodView.Update(cpm);
                    }
                }
            }
            cim.GetCreatePaymentProfileForm();
        }
Exemplo n.º 4
0
 public virtual void GetCreatePaymentProfileForm(PXGraph graph, ICCPaymentProfileAdapter ccPaymentProfileAdapter)
 {
     CCCustomerInformationManager.GetCreatePaymentProfileForm(graph, ccPaymentProfileAdapter);
 }