Ejemplo n.º 1
0
 public virtual CCPaymentProcessing GetPaymentProcessing()
 {
     if (paymentProcessing == null)
     {
         paymentProcessing = new CCPaymentProcessing(Base);
     }
     return(paymentProcessing);
 }
Ejemplo n.º 2
0
        private ICCPaymentProcessing CreateAndInitProcessor(CCProcessingCenter row)
        {
            ICCPaymentProcessing processor = CCPaymentProcessing.CreateCCPaymentProcessorInstance(row);

            if (processor == null)
            {
                throw new PXException(Messages.InstanceOfTheProcessingTypeCanNotBeCreated, row.ProcessingTypeName);
            }
            processor.Initialize(this, null, null);
            return(processor);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        private void ConvertCustomerPaymentMethod(CustomerPaymentMethod cpm, CCProcessingCenter newCCPC)
        {
            if (newCCPC == null)
            {
                throw new PXException(Messages.NotSetProcessingCenter);
            }
            if (!CCPaymentProcessing.IsFeatureSupported(newCCPC, CCProcessingFeature.Tokenization))
            {
                throw new PXException(Messages.ProcessingCenterShouldTokenization);
            }
            PaymentMethodUpdater updaterGreph = PXGraph.CreateInstance <PaymentMethodUpdater>();

            updaterGreph.ConvertCustomerPaymentMethod(cpm, newCCPC);
        }
        protected virtual void CCProcessingCenterDetail_Value_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }
            CCProcessingCenter       processingCenter = ProcessingCenter.Current;
            CCProcessingCenterDetail procCenterDetail = (CCProcessingCenterDetail)e.Row;
            CCPaymentProcessing      processingGraph  = PXGraph.CreateInstance <CCPaymentProcessing>();
            ISettingsDetail          idetail          = new procDetail()
            {
                DetailID = procCenterDetail.DetailID, Value = (string)e.NewValue
            };

            processingGraph.ValidateSettings(this, processingCenter.ProcessingCenterID, idetail);
        }
Ejemplo n.º 6
0
        protected virtual void CCProcessingCenter_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled <CCProcessingCenter.processingTypeName>(sender, e.Row, (bool)((CCProcessingCenter)e.Row).IsActive);
            PXUIFieldAttribute.SetRequired <CCProcessingCenter.processingTypeName>(sender, (bool)((CCProcessingCenter)e.Row).IsActive);
            CCProcessingCenter row = (CCProcessingCenter)e.Row;
            bool isTokenized       = CCPaymentProcessing.IsFeatureSupported(row, CCProcessingFeature.HostedForm);

            PXUIFieldAttribute.SetVisible <CCProcessingCenter.allowDirectInput>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncronizeDeletion>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncRetryAttemptsNo>(sender, row, isTokenized);
            PXUIFieldAttribute.SetVisible <CCProcessingCenter.syncRetryDelayMs>(sender, row, isTokenized);
            this.testCredentials.SetEnabled((row != null) && !string.IsNullOrEmpty(row.ProcessingCenterID) && !string.IsNullOrEmpty(row.ProcessingTypeName));
            this.updateExpirationDate.SetVisible(row != null && row.NeedsExpDateUpdate == true);
            this.ProcessingCenter.Cache.AllowDelete = !HasTransactions((CCProcessingCenter)e.Row);
            PaymentMethods.AllowInsert = false;
            PaymentMethods.AllowDelete = false;
        }
Ejemplo n.º 7
0
        protected virtual void CCProcessingCenter_ProcessingTypeName_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
        {
            CCProcessingCenter row = e.Row as CCProcessingCenter;

            if (row == null)
            {
                return;
            }
            bool isTokenized = CCPaymentProcessing.IsFeatureSupported(row, CCProcessingFeature.Tokenization);
            bool isHF        = CCPaymentProcessing.IsFeatureSupported(row, CCProcessingFeature.HostedForm);

            sender.SetValue <CCProcessingCenter.allowDirectInput>(row, isTokenized && !isHF);
            foreach (CCProcessingCenterDetail detail in Details.Select())
            {
                Details.Delete(detail);
            }
            this.ImportSettings();
        }
Ejemplo n.º 8
0
        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 (!CCPaymentProcessing.IsFeatureSupported(procCenter, CCProcessingFeature.Tokenization))
                {
                    throw new PXSetPropertyException("New processing center should support tokenization!");
                }
            }
        }
Ejemplo n.º 9
0
        public virtual IEnumerable TestCredentials(PXAdapter adapter)
        {
            CCProcessingCenter row = this.ProcessingCenter.Current;

            if (string.IsNullOrEmpty(row.ProcessingCenterID))
            {
                throw new PXException(Messages.ProcessingCenterNotSelected);
            }
            if (string.IsNullOrEmpty(row.ProcessingTypeName))
            {
                throw new PXException(Messages.ProcessingPluginNotSelected);
            }
            CCPaymentProcessing paymentProcessing = PXGraph.CreateInstance <CCPaymentProcessing>();

            if (paymentProcessing.TestCredentials(this, row.ProcessingCenterID))
            {
                ProcessingCenter.Ask(Messages.Result, Messages.CredentialsAccepted, MessageButtons.OK);
            }
            return(adapter.Get());
        }
Ejemplo n.º 10
0
        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 (CCPaymentProcessing.IsFeatureSupported(processingCenter, CCProcessingFeature.Tokenization))
                {
                    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);
                    }
                }
            }
        }
        public virtual IEnumerable TestCredentials(PXAdapter adapter)
        {
            CCProcessingCenter row = this.ProcessingCenter.Current;

            if (string.IsNullOrEmpty(row.ProcessingCenterID))
            {
                throw new PXException("Processing Center is not selected!");
            }
            if (string.IsNullOrEmpty(row.ProcessingTypeName))
            {
                throw new PXException("Processing plugin is not selected!");
            }
            CCPaymentProcessing paymentProcessing = PXGraph.CreateInstance <CCPaymentProcessing>();

            if (paymentProcessing.TestCredentials(this, row.ProcessingCenterID))
            {
                ProcessingCenter.Ask("Result", "Credentials were accepted by processing center!", MessageButtons.OK);
            }
            return(adapter.Get());
        }
Ejemplo n.º 12
0
        protected virtual void CCProcessingCenterDetail_Value_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (e.NewValue == null)
            {
                return;
            }

            CCProcessingCenter       processingCenter = ProcessingCenter.Current;
            CCProcessingCenterDetail procCenterDetail = (CCProcessingCenterDetail)e.Row;

            //skip validation for special values - plugins don't know about this detail ids
            if (!InterfaceConstants.SpecialDetailIDs.Contains(procCenterDetail.DetailID))
            {
                CCPaymentProcessing processingGraph = PXGraph.CreateInstance <CCPaymentProcessing>();
                ISettingsDetail     idetail         = new procDetail()
                {
                    DetailID = procCenterDetail.DetailID, Value = (string)e.NewValue
                };
                processingGraph.ValidateSettings(this, processingCenter.ProcessingCenterID, idetail);
            }
        }
        public virtual IEnumerable ImportSettings(PXAdapter adapter)
        {
            CCProcessingCenter row = this.ProcessingCenter.Current;

            if (string.IsNullOrEmpty(row.ProcessingCenterID))
            {
                throw new PXException(string.Format(Messages.ProcessingCenterIDIsRequiredForImport));
            }
            if (string.IsNullOrEmpty(row.ProcessingTypeName))
            {
                throw new PXException(string.Format(Messages.ProcessingObjectTypeIsNotSpecified, row.ProcessingTypeName));
            }

            ICCPaymentProcessing processor = CCPaymentProcessing.CreateCCPaymentProcessorInstance(row);

            if (processor == null)
            {
                throw new PXException(string.Format(Messages.InstanceOfTheProcessingTypeCanNotBeCreated, row.ProcessingTypeName));
            }
            processor.Initialize(this, null, null);
            this.ImportSettingsFromPC(processor);
            return(adapter.Get());
        }