'section' => 'billing',
'description' => 'Available payment types.',
'type' => 'selectmultiple',
- 'select_enum' => [ qw(CARD DCRD CHEK DCHK BILL CASH WEST MCRD PPAL COMP) ],
+ 'select_enum' => [ qw(CARD DCRD CHEK DCHK BILL CASH WEST MCRD MCHK PPAL COMP) ],
},
{
package FS::cdr::cia;
use strict;
-use vars qw( @ISA %info );
+use vars qw( @ISA %info $date $tmp_mday $tmp_mon $tmp_year);
use FS::cdr qw(_cdr_date_parser_maker);
+use Time::Local;
@ISA = qw(FS::cdr);
'weight' => 510,
'header' => 1,
'type' => 'csv',
- 'sep_char' => "\t",
+ 'sep_char' => "|",
'import_fields' => [
- skip(2), # Reseller Account Number, Confirmation Number
- 'description', # Conference Name
- skip(3), # Organization Name, Bill Code, Q&A Active
- 'userfield', # Chairperson Name
- skip(2), # Conference Start Time, Conference End Time
- _cdr_date_parser_maker('startdate'), # Connect Time
- _cdr_date_parser_maker('enddate'), # Disconnect Time
- skip(1), # Duration
- sub { my($cdr, $data, $conf, $param) = @_;
- $cdr->duration($data);
- $cdr->billsec( $data);
- }, # Roundup Duration
- skip(1), # User Name
- 'dst', # DNIS
- 'src', # ANI
- skip(2), # Call Type, Toll Free,
- 'accountcode', # Chair Conference Entry Code
- skip(1), # Participant Conference Entry Code,
+ 'accountcode',
+ skip(2), # First and last name
+
+ sub { my($cdr, $date) = @_;
+ $date =~ /^(\d{1,2})\/(\d{1,2})\/(\d\d(\d\d)?)$/
+ or die "unparsable date: $date"; #maybe we shouldn't die...
+ ($tmp_mday, $tmp_mon, $tmp_year) = ( $2, $1-1, $3 );
+ }, #Date
+
+ sub { my($cdr, $time) = @_;
+ #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
+ $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
+ or die "unparsable time: $time"; #maybe we shouldn't die...
+ $cdr->startdate( timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year));
+ $cdr->answerdate( timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year));
+
+ }, # Start time
+
+ sub { my($cdr, $time) = @_;
+ #my($sec, $min, $hour, $mday, $mon, $year)= localtime($cdr->startdate);
+ $time =~ /^(\d{1,2}):(\d{1,2}):(\d{1,2})$/
+ or die "unparsable time: $time"; #maybe we shouldn't die...
+ #$cdr->startdate( timelocal($3, $2, $1 ,$mday, $mon, $year) );
+ $cdr->enddate(
+ timelocal($3, $2, $1 ,$tmp_mday, $tmp_mon, $tmp_year) );
+ }, # End time
+
+ 'disposition', # Disposition
+ 'dst', # PhoneNumber
+ skip(3), # Extension, Service Type, Filler
+ 'src', # ClientContactID
],
);
$payby = 'PREP' if $amount;
- } elsif ( $self->payby =~ /^(CASH|WEST|MCRD|PPAL)$/ ) {
+ } elsif ( $self->payby =~ /^(CASH|WEST|MCRD|MCHK|PPAL)$/ ) {
$payby = $1;
$self->payby('BILL');
=cut
+#super false laziness w/quotation::charge
sub charge {
my $self = shift;
my ( $amount, $setup_cost, $quantity, $start_date, $classnum );
=cut
my @methods = qw(PAYPAL CC);
-my %method2payby = ( 'PAYPAL' => 'PPAL', 'CC' => 'MCRD' );
+my %method2payby = ( 'PAYPAL' => 'PPAL',
+ 'CC' => 'MCRD', #? but doesn't MCRD mean _offline_
+ #card, not third-party card? but no
+ #one is doing non-paypal right now
+ );
sub create_payment {
my $self = shift;
if ( $self->paydate eq '' || $self->paydate eq '-' ) {
return "Expiration date required"
# shouldn't payinfo_check do this?
- unless $self->payby =~ /^(BILL|PREPAY|CHEK|DCHK|LECB|CASH|WEST|MCRD|PPAL)$/;
+ unless $self->payby =~ /^(BILL|PREPAY|CHEK|DCHK|LECB|CASH|WEST|MCRD|MCHK|PPAL)$/;
$self->paydate('');
} else {
my( $m, $y );
_date
_date_pretty
due_date
+ due_date2str
)],
#XXX not really thinking about cust_bill substitutions quite yet
longname => 'Manual credit card',
cust_main => 'BILL', #this is a payment type only, customers go to BILL...
},
+ 'MCHK' => { #not the same as DCHK
+ tinyname => 'card',
+ shortname => 'Manual electronic check', # initial payment, then billing
+ longname => 'Manual electronic check',
+ cust_main => 'BILL', #this is a payment type only, customers go to BILL...
+ },
'APPL' => {
tinyname => 'apple store',
shortname => 'Apple Store',
%payby2bop = (
'CARD' => 'CC',
'CHEK' => 'ECHECK',
- 'MCRD' => 'CC',
+ 'MCRD' => 'CC', #? but doesn't MCRD mean _offline_ card? i think it got
+ # overloaded for third-party card payments -- but no one is
+ # doing those other than paypal now
'PPAL' => 'PAYPAL',
);
For Refunds (cust_refund):
'CARD' (credit cards), 'CHEK' (electronic check/ACH),
'LECB' (Phone bill billing), 'BILL' (billing), 'CASH' (cash),
-'WEST' (Western Union), 'MCRD' (Manual credit card), 'CBAK' Chargeback, or 'COMP' (free)
+'WEST' (Western Union), 'MCRD' (Manual credit card), 'MCHK' (Manual electronic
+check), 'CBAK' Chargeback, or 'COMP' (free)
For Payments (cust_pay):
'CARD' (credit cards), 'CHEK' (electronic check/ACH),
'LECB' (phone bill billing), 'BILL' (billing), 'PREP' (prepaid card),
-'CASH' (cash), 'WEST' (Western Union), 'MCRD' (Manual credit card),
-'PPAL' (PayPal)
+'CASH' (cash), 'WEST' (Western Union), 'MCRD' (Manual credit card), 'MCHK'
+(Manual electronic check), 'PPAL' (PayPal)
'COMP' (free) is depricated as a payment type in cust_pay
=cut
return 'N/A (tokenized)'; #?
} else { # if not, mask it...
- if ($payby eq 'CARD' || $payby eq 'DCRD' || $payby eq 'MCRD') {
+ if ($payby eq 'CARD' || $payby eq 'DCRD') {
+ #|| $payby eq 'MCRD') {
+ #MCRD isn't a card in payinfo,
+ #its a record of an _offline_
+ #card
# Credit Cards
Checks payby and payinfo.
-For Customers (cust_main):
-'CARD' (credit card - automatic), 'DCRD' (credit card - on-demand),
-'CHEK' (electronic check - automatic), 'DCHK' (electronic check - on-demand),
-'LECB' (Phone bill billing), 'BILL' (billing), 'COMP' (free), or
-'PREPAY' (special billing type: applies a credit - see L<FS::prepay_credit> and sets billing type to I<BILL>)
-
-For Refunds (cust_refund):
-'CARD' (credit cards), 'CHEK' (electronic check/ACH),
-'LECB' (Phone bill billing), 'BILL' (billing), 'CASH' (cash),
-'WEST' (Western Union), 'MCRD' (Manual credit card), 'CBAK' (Chargeback), or 'COMP' (free)
-
-For Payments (cust_pay):
-'CARD' (credit cards), 'CHEK' (electronic check/ACH),
-'LECB' (phone bill billing), 'BILL' (billing), 'PREP' (prepaid card),
-'CASH' (cash), 'WEST' (Western Union), or 'MCRD' (Manual credit card)
-'COMP' (free) is depricated as a payment type in cust_pay
-
=cut
sub payinfo_check {
$lh->maketext('Western Union');
} elsif ( $self->payby eq 'MCRD' ) {
$lh->maketext('Manual credit card');
+ } elsif ( $self->payby eq 'MCHK' ) {
+ $lh->maketext('Manual electronic check');
} elsif ( $self->payby eq 'EDI' ) {
$lh->maketext('EDI') . ' ' . $self->paymask;
} elsif ( $self->payby eq 'PPAL' ) {
my $link = $cgi->param('popup') ? 'popup' : '';
my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD)$/;
+push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD|MCHK)$/;
push @rights, 'Post check refund' if $payby eq 'BILL';
push @rights, 'Post cash refund ' if $payby eq 'CASH';
push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
],
'cust_bill' => [
'$invnum' => 'Invoice#',
+ '$_date_pretty' => 'Invoice date',
+ '$due_date' => 'Invoice due date (timestamp)',
+ '$due_date2str' => 'Invoice due date (human readable)',
],
'cust_pkg' => [
'$pkgnum' => 'Package#',
my $payby = $cgi->param('payby');
my @rights = ();
-push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD)$/;
+push @rights, 'Post refund' if $payby =~ /^(BILL|CASH|MCRD|MCHK)$/;
push @rights, 'Post check refund' if $payby eq 'BILL';
push @rights, 'Post cash refund ' if $payby eq 'CASH';
push @rights, 'Refund payment' if $payby =~ /^(CARD|CHEK)$/;
foreach my $payby ( $cgi->param('payby') ) {
$payby =~
- /^(CARD|CHEK|BILL|CASH|PPAL|APPL|ANRD|PREP|WIRE|WEST|EDI|MCRD)(-(VisaMC|Amex|Discover|Maestro|Tokenized))?$/
+ /^(CARD|CHEK|BILL|CASH|PPAL|APPL|ANRD|PREP|WIRE|WEST|EDI|MCRD|MCHK)(-(VisaMC|Amex|Discover|Maestro|Tokenized))?$/
or die "illegal payby $payby";
my $payby_search = "$table.payby = '$1'";
<OPTION VALUE="WEST" SELECTED><% mt('Western Union') |h %></OPTION>
<OPTION VALUE="EDI" SELECTED><% mt('Electronic Debit (EDI)') |h %></OPTION>
<OPTION VALUE="MCRD" SELECTED><% mt('manual credit card') |h %></OPTION>
+ <OPTION VALUE="MCHK" SELECTED><% mt('manual electronic check') |h %></OPTION>
</SELECT>
</TD>
</TR>
<OPTION VALUE="CASH">cash</OPTION>
<OPTION VALUE="WEST">Western Union</OPTION>
<OPTION VALUE="MCRD">manual credit card</OPTION>
+ <OPTION VALUE="MCHK">manual electronic check</OPTION>
</SELECT>
</TD>
</TR>
% }
% if ( $cust_bill->owed > 0
-% && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD) )
+% && scalar( grep $payby{$_}, qw(BILL CASH WEST MCRD MCHK) )
% && $curuser->access_right(['Post payment', 'Post check payment', 'Post cash payment'])
% && ! $conf->exists('pkg-balances')
% )
<A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;invnum=<% $invnum %>"><% mt('manual credit card') |h %></A>
% }
+% if ( $payby{'MCHK'} && $curuser->access_right(['Post payment']) ) {
+ <% $s++ ? ' | ' : '' %>
+ <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCHK;invnum=<% $invnum %>"><% mt('manual electronic check') |h %></A>
+% }
+
<% mt('payment against this invoice') |h %><BR><BR>
% }
<A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card payment') |h %></A>
% }
+% if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) {
+ <% $s++ ? ' | ' : '' %>
+ <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCHK;custnum=<% $custnum %>"><% mt('Post manual (offline) electronic check payment') |h %></A>
+% }
+
<% $s ? '<BR>' : '' %>
%# credit links
<A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card refund') |h %></A>
% }
+% if ( $payby{'MCHK'} && $curuser->access_right('Post refund') ) {
+ <% $s++ ? ' | ' : '' %>
+ <A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline) electronic check refund') |h %></A>
+% }
+
</TD>
<TD ALIGN="right" VALIGN="top">