+
+ my $search_paymask = $cgi->param('payinfo1') . '@' . $cgi->param('payinfo2');
+ $search_paymask .= '.' . $cgi->param('payinfo3')
+ if $conf->config('echeck-country') eq 'CA';
+
+ #paymask might not be saved in database, need to run paymask method for any potential match
+ foreach my $search_cust_payby ($cust_main->cust_payby('CHEK','DCHK')) {
+ if ($search_paymask eq $search_cust_payby->paymask) {
+ # if there are multiple matches, assume for now that it's the first one returned,
+ # since that's what auto-fills; it's unlikely a masked number would be entered by hand,
+ # but it's very likely users will just click-through what's been auto-filled
+ $loaded_cust_payby = $search_cust_payby;
+ last;
+ }
+ }
+ errorpage("Masked payinfo not found") unless $loaded_cust_payby;
+ $payinfo = $loaded_cust_payby->payinfo;
+ $paymask = $loaded_cust_payby->paymask;
+