Beispiel #1
0
        public static bool CheckSagePayProtocolVersion(Type type, string propertyName, ProtocolVersion protocolVersion)
        {
            var interfaces = type.GetInterfaces();

            foreach (var @interface in interfaces)
            {
                foreach (var interfaceProperty in @interface.GetProperties())
                {
                    if (interfaceProperty.Name != propertyName) continue;
                    if (!interfaceProperty.GetCustomAttributes(typeof(SagePayProtocolVersion), true).Any())
                        continue;

                    var sagepayProtocolVersion = (SagePayProtocolVersion)interfaceProperty.GetCustomAttributes(typeof(SagePayProtocolVersion), true).FirstOrDefault();
                    return sagepayProtocolVersion != null && (protocolVersion.VersionInt() >= sagepayProtocolVersion.Min.VersionInt());
                }
                return CheckSagePayProtocolVersion(@interface, propertyName, protocolVersion);
            }
            return true;
        }