+=head1 CLASS METHODS
+
+=item ban_search OPTION => VALUE ...
+
+Takes two parameters: payby and payinfo, and searches for an (un-expired) ban
+matching those items.
+
+Returns the ban, or false if no ban was found.
+
+=cut
+
+sub ban_search {
+ my( $class, %opt ) = @_;
+ qsearchs({
+ 'table' => 'banned_pay',
+ 'hashref' => { 'payby' => $opt{payby}, },
+ 'extra_sql' => "
+ AND (((payinfo_hash IS NULL OR payinfo_hash = '' OR payinfo_hash = 'MD5')
+ AND payinfo = ". dbh->quote( md5_base64($opt{payinfo}) ). "
+ )
+ OR
+ (payinfo_hash = 'SHA256'
+ AND payinfo = ". dbh->quote( sha512_base64($opt{payinfo}) ). "
+ )
+ )
+ AND ( end_date IS NULL OR end_date >= ". time. " ) ",
+ });
+}
+
+# Used by FS::Upgrade to migrate to a new database.
+sub _upgrade_data { # class method
+ my ($class, %opts) = @_;
+
+ die "Cannot upgrade md5 banned_pay entries"
+ if qsearch({
+ 'table' => 'banned_pay',
+ 'hashref' => {},
+ 'extra_sql' => "WHERE payinfo_hash IS NULL OR payinfo_hash = '' OR payinfo_hash = 'MD5'",
+ });
+
+ $class->_upgrade_otaker(%opts);
+}
+
+=back
+