private void ImportSettingsFromPC()
        {
            CCProcessingCenter row = this.ProcessingCenter.Current;
            Dictionary <string, CCProcessingCenterDetail> currentSettings = new Dictionary <string, CCProcessingCenterDetail>();

            ReadSettings(currentSettings);
            var graph = PXGraph.CreateInstance <CCPaymentProcessingGraph>();
            IList <ISettingsDetail> processorSettings = graph.ExportSettings(this, row.ProcessingCenterID);

            isExportingSettings = true;
            foreach (ISettingsDetail it in processorSettings)
            {
                if (!currentSettings.ContainsKey(it.DetailID))
                {
                    CCProcessingCenterDetail detail = new CCProcessingCenterDetail();
                    detail.Copy(it);
                    detail = this.Details.Insert(detail);
                }
                else
                {
                    CCProcessingCenterDetail detail = currentSettings[it.DetailID];
                    detail.Copy(it);
                    detail = this.Details.Update(detail);
                }
            }
            isExportingSettings = false;
        }
Ejemplo n.º 2
0
        private void ImportSettingsFromPC(ICCPaymentProcessing aProcessor)
        {
            CCProcessingCenter row = this.ProcessingCenter.Current;
            Dictionary <string, CCProcessingCenterDetail> currentSettings = new Dictionary <string, CCProcessingCenterDetail>();

            ReadSettings(currentSettings);
            List <ISettingsDetail> processorSettings = new List <ISettingsDetail>();

            aProcessor.ExportSettings(processorSettings);
            foreach (ISettingsDetail it in processorSettings)
            {
                if (!currentSettings.ContainsKey(it.DetailID))
                {
                    CCProcessingCenterDetail detail = new CCProcessingCenterDetail();
                    detail.Copy(it);
                    detail = this.Details.Insert(detail);
                }
                else
                {
                    CCProcessingCenterDetail detail = currentSettings[it.DetailID];
                    detail.Copy(it);
                    detail = this.Details.Update(detail);
                }
            }
        }
Ejemplo n.º 3
0
 private void ImportExpDateFromPC(ICCPaymentProcessing aProcessor)
 {
     if (aProcessor is ICCProcessingExpDateFormatting)
     {
         CCProcessingCenterDetail detail = GetExpFormatDetail((ICCProcessingExpDateFormatting)aProcessor);
         detail = this.Details.Insert(detail);
     }
 }
        protected virtual void CCProcessingCenterDetail_DetailID_ExceptionHandling(PXCache cache, PXExceptionHandlingEventArgs e)
        {
            CCProcessingCenterDetail a = e.Row as CCProcessingCenterDetail;

            if (a.DetailID != null)
            {
                errorKey = true;
            }
        }
Ejemplo n.º 5
0
        public CCProcessingCenterDetail GetExpFormatDetail(ICCProcessingExpDateFormatting provider)
        {
            CCProcessingCenterDetail detail = new CCProcessingCenterDetail();

            detail.DetailID = InterfaceConstants.ExpDateFormatDetailID;
            detail.Descr    = InterfaceConstants.ExpDateFormatDesc;
            detail.Value    = provider.GetExpirationDateFormat();
            return(detail);
        }
 public static void Copy(PluginSettingDetail src, CCProcessingCenterDetail dst)
 {
     dst.DetailID              = src.DetailID;
     dst.Value                 = src.Value;
     dst.Descr                 = src.Descr;
     dst.ControlType           = src.ControlType;
     dst.IsEncryptionRequired  = src.IsEncryptionRequired;
     dst.ComboValuesCollection = src.ComboValuesCollection;
 }
        protected virtual void CCProcessingCenterDetail_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
        {
            PXUIFieldAttribute.SetEnabled <CCProcessingCenterDetail.detailID>(cache, e.Row, false);
            PXUIFieldAttribute.SetEnabled <CCProcessingCenterDetail.descr>(cache, e.Row, false);
            CCProcessingCenterDetail row = e.Row as CCProcessingCenterDetail;

            if (row != null)
            {
                if (row.IsEncryptionRequired == true && row.IsEncrypted != true && Details.Cache.GetStatus(row) == PXEntryStatus.Notchanged)
                {
                    Details.Cache.SetStatus(row, PXEntryStatus.Updated);
                    Details.Cache.IsDirty = true;
                    PXUIFieldAttribute.SetWarning <CCProcessingCenterDetail.value>(Details.Cache, row, Messages.CryptoSettingsChanged);
                }
            }
        }
        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);
        }
        private static void SetComboValues(CCProcessingCenterDetail detail, ICollection <KeyValuePair <string, string> > collection)
        {
            if (collection != null)
            {
                StringBuilder sb = new StringBuilder();
                foreach (KeyValuePair <string, string> kv in collection)
                {
                    sb.AppendFormat("{0}|{1};", kv.Key, kv.Value);
                }

                detail.ComboValues = sb.ToString();
            }
            else
            {
                detail.ComboValues = null;
            }
        }
        protected virtual void CCProcessingCenterDetail_Value_FieldVerifying(PXCache sender, PXFieldVerifyingEventArgs e)
        {
            if (isExportingSettings)
            {
                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))
            {
                var             graph   = PXGraph.CreateInstance <CCPaymentProcessingGraph>();
                ISettingsDetail idetail = new procDetail()
                {
                    DetailID = procCenterDetail.DetailID, Value = (string)e.NewValue
                };
                graph.ValidateSettings(this, processingCenter.ProcessingCenterID, idetail);
            }
        }
        private static IList <KeyValuePair <string, string> > GetComboValues(CCProcessingCenterDetail detail)
        {
            List <KeyValuePair <string, string> > list = new List <KeyValuePair <string, string> >();

            if (detail.ComboValues != null)
            {
                string[] parts = detail.ComboValues.Split(';');
                foreach (string part in parts)
                {
                    if (!string.IsNullOrEmpty(part))
                    {
                        string[] keyval = part.Split('|');

                        if (keyval.Length == 2)
                        {
                            list.Add(new KeyValuePair <string, string>(keyval[0], keyval[1]));
                        }
                    }
                }
            }
            return(list);
        }
        protected virtual void CCProcessingCenterDetail_Value_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
        {
            CCProcessingCenterDetail row = e.Row as CCProcessingCenterDetail;

            if (row != null)
            {
                string fieldName = typeof(CCProcessingCenterDetail.value).Name;

                switch (row.ControlType)
                {
                case ControlTypeDefintion.Combo:
                    List <string> labels = new List <string>();
                    List <string> values = new List <string>();
                    foreach (KeyValuePair <string, string> kv in row.GetComboValues())
                    {
                        values.Add(kv.Key);
                        labels.Add(kv.Value);
                    }
                    e.ReturnState = PXStringState.CreateInstance(e.ReturnState, CCProcessingCenterDetail.ValueFieldLength, null, fieldName, false, 1, null,
                                                                 values.ToArray(), labels.ToArray(), true, null);
                    break;

                case ControlTypeDefintion.CheckBox:
                    e.ReturnState = PXFieldState.CreateInstance(e.ReturnState, typeof(Boolean), false, null, -1, null, null, null, fieldName,
                                                                null, null, null, PXErrorLevel.Undefined, null, null, null, PXUIVisibility.Undefined, null, null, null);
                    break;

                case ControlTypeDefintion.Password:
                    //handled by PXRSACryptStringWithConditional attribute
                    break;

                default:
                    break;
                }
            }
        }