- 'hashref' => {
- 'payby' => $opt{payby},
- 'payinfo' => md5_base64($opt{payinfo}),
- },
- 'extra_sql' => 'AND ( end_date IS NULL OR end_date >= '. time. ' ) ',
+ '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. " ) ",