+sub translate_payby {
+ my ($payby,$payinfo) = (shift,shift);
+ my %payby = (
+ BILL => $payinfo ? emt('Check #') : '',
+ CHEK => emt('Electronic check '),
+ PREP => emt('Prepaid card '),
+ CARD => emt('Credit card #'),
+ COMP => emt('Complimentary by '),
+ CASH => emt('Cash'),
+ WEST => emt('Western Union'),
+ MCRD => emt('Manual credit card'),
+ );
+ $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby;
+ $payby;
+};
+
+sub translate_payby_refund {
+ my ($payby,$payinfo) = (shift,shift);
+ my %payby = (
+ BILL => $payinfo ? emt('Check #') : emt('Check'),
+ CHEK => emt('Electronic check '),
+ CARD => emt('Credit card #'),
+ COMP => emt('Complimentary by '),
+ );
+ $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby;
+ $payby;
+};
+
+sub translate_payinfo {
+ my $object = shift;
+ my $payby = $object->payby;
+ my $payinfo = $object->payinfo;
+
+ my $conf = new FS::Conf;
+
+ if ( $payby eq 'CARD' ) {
+ $payinfo = $object->paymask;
+ } elsif ( $payby eq 'CHEK' ) {
+ my( $account, $aba ) = split('@', $object->paymask );
+ if ( $conf->exists('echeck-no_routing') ) {
+ $payinfo = emt("Acct #[_1]", $account);
+ } else {
+ $payinfo = emt("ABA [_1], Acct #[_2]",$aba,$account);
+ }
+ }
+
+ ($payby,$payinfo);
+}
+
+sub areyousure_link {
+ my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
+ ' (<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>)';
+}
+