[freeside-commits] freeside/FS/FS Conf.pm, 1.161,
1.162 AccessRight.pm, 1.10, 1.11 payby.pm, 1.8,
1.9 pay_batch.pm, 1.3, 1.4 Schema.pm, 1.31, 1.32 cust_bill.pm,
1.155, 1.156 Setup.pm, 1.5, 1.6
Ivan,,,
ivan at wavetail.420.am
Sun Oct 8 01:17:08 PDT 2006
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv332/FS/FS
Modified Files:
Conf.pm AccessRight.pm payby.pm pay_batch.pm Schema.pm
cust_bill.pm Setup.pm
Log Message:
add menu items for credit card batching, debug last-minute changes to payby.pm, add ACL for re-processing batches, separate CARD and CHEK batches, fixed defaults for batch formats
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- Conf.pm 4 Oct 2006 21:22:08 -0000 1.161
+++ Conf.pm 8 Oct 2006 08:17:06 -0000 1.162
@@ -1729,11 +1729,34 @@
},
{
+ 'key' => 'batch-enable',
+ 'section' => 'billing',
+ 'description' => 'Enable credit card batching - leave disabled for real-time installations.',
+ 'type' => 'checkbox',
+ },
+
+ {
'key' => 'batch-default_format',
'section' => 'billing',
'description' => 'Default format for batches.',
'type' => 'select',
- 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM' ]
+ 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ]
+ },
+
+ {
+ 'key' => 'batch-fixed_format-CARD',
+ 'section' => 'billing',
+ 'description' => 'Fixed (unchangeable) format for credit card batches.',
+ 'type' => 'select',
+ 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ]
+ },
+
+ {
+ 'key' => 'batch-fixed_format-CHEK',
+ 'section' => 'billing',
+ 'description' => 'Fixed (unchangeable) format for electronic check batches.',
+ 'type' => 'select',
+ 'select_enum' => [ 'csv-td_canada_trust-merchant_pc_batch', 'BoM', 'PAP' ]
},
{
Index: payby.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/payby.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- payby.pm 6 Sep 2006 01:07:05 -0000 1.8
+++ payby.pm 8 Oct 2006 08:17:06 -0000 1.9
@@ -3,6 +3,7 @@
use strict;
use vars qw(%hash %payby2bop);
use Tie::IxHash;
+use Business::CreditCard;
=head1 NAME
@@ -98,11 +99,11 @@
},
'DCLN' => { # This is only an event.
tinyname => 'declined',
- shortname => 'Declined payment',
- longname => 'Declined payment',
+ shortname => 'Batch declined payment',
+ longname => 'Batch declined payment',
#its neither of these..
- cust_main => '',
+ #cust_main => '',
cust_pay => '',
},
@@ -117,11 +118,31 @@
map { $_ => $hash{$_}->{longname} } $self->payby;
}
+sub shortname {
+ my( $self, $payby ) = @_;
+ $hash{$payby}->{shortname};
+}
+
+sub longname {
+ my( $self, $payby ) = @_;
+ $hash{$payby}->{longname};
+}
+
%payby2bop = (
'CARD' => 'CC',
'CHEK' => 'ECHECK',
);
+sub payby2bop {
+ my( $self, $payby ) = @_;
+ $payby2bop{ $self->payby2payment($payby) };
+}
+
+sub payby2payment {
+ my( $self, $payby ) = @_;
+ $hash{$payby}{'cust_pay'} || $payby;
+}
+
sub cust_payby {
my $self = shift;
grep { ! exists $hash{$_}->{cust_main} } $self->payby;
@@ -142,7 +163,7 @@
or return "Illegal (mistyped?) credit card number (payinfo)";
$$payinforef = $1;
validate($$payinforef) or return "Illegal credit card number";
- return "Unknown card type" if cardype($$payinforef) eq "Unknown";
+ return "Unknown card type" if cardtype($$payinforef) eq "Unknown";
} else {
$$payinforef="N/A";
}
Index: Setup.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Setup.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Setup.pm 26 Aug 2006 23:15:11 -0000 1.5
+++ Setup.pm 8 Oct 2006 08:17:06 -0000 1.6
@@ -71,13 +71,8 @@
my @states = $subcountry ? $subcountry->all_codes : undef;
if ( !scalar(@states) || ( scalar(@states)==1 && !defined($states[0]) ) ) {
-
- my $cust_main_county = new FS::cust_main_county({
- 'tax' => 0,
- 'country' => $country,
- });
- my $error = $cust_main_county->insert;
- die $error if $error;
+
+ _add_locale( 'country'=>$country );
} else {
@@ -86,15 +81,7 @@
}
foreach my $state ( @states ) {
-
- my $cust_main_county = new FS::cust_main_county({
- 'state' => $state,
- 'tax' => 0,
- 'country' => $country,
- });
- my $error = $cust_main_county->insert;
- die $error if $error;
-
+ _add_locale( 'country'=>$country, 'state'=>$state);
}
}
@@ -102,6 +89,34 @@
}
+sub populate_addl_locales {
+
+ my %addl = (
+ 'US' => {
+ 'FM' => 'Federated States of Micronesia',
+ 'MH' => 'Federated States of Micronesia',
+ 'PW' => 'Federated States of Micronesia',
+ 'AA' => "Armed Forces Americas (except Canada)",
+ 'AE' => "Armed Forces Europe / Canada / Middle East / Africa",
+ 'AP' => "Armed Forces Pacific",
+ },
+ );
+
+ foreach my $country ( keys %addl ) {
+ foreach my $state ( keys %{ $addl{$country} } ) {
+ # $longname = $addl{$country}{$state};
+ _add_locale( 'country'=>$country, 'state'=>$state);
+ }
+ }
+
+}
+
+sub _add_locale {
+ my $cust_main_county = new FS::cust_main_county( { 'tax'=>0, @_ });
+ my $error = $cust_main_county->insert;
+ die $error if $error;
+}
+
sub populate_initial_data {
my %opt = @_;
@@ -175,13 +190,13 @@
'weight' => 40,
'plan' => 'suspend',
},
- { 'payby' => 'DCLN',
- 'event' => 'Retriable',
- 'seconds' => 0,
- 'eventcode' => '$cust_bill_event->retriable();',
- 'weight' => 60,
- 'plan' => 'retriable',
- },
+ #{ 'payby' => 'DCLN',
+ # 'event' => 'Retriable',
+ # 'seconds' => 0,
+ # 'eventcode' => '$cust_bill_event->retriable();',
+ # 'weight' => 60,
+ # 'plan' => 'retriable',
+ #},
],
#you must create a service definition. An example of a service definition
Index: pay_batch.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/pay_batch.pm,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pay_batch.pm 9 Aug 2006 06:43:01 -0000 1.3
+++ pay_batch.pm 8 Oct 2006 08:17:06 -0000 1.4
@@ -34,7 +34,9 @@
=item batchnum - primary key
-=item status -
+=item payby - CARD or CHEK
+
+=item status - O (Open), I (In-transit), or R (Resolved)
=item download -
@@ -102,6 +104,7 @@
my $error =
$self->ut_numbern('batchnum')
+ || $self->ut_enum('payby', [ 'CARD', 'CHEK' ])
|| $self->ut_enum('status', [ 'O', 'I', 'R' ])
;
return $error if $error;
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -d -r1.155 -r1.156
--- cust_bill.pm 7 Oct 2006 23:40:04 -0000 1.155
+++ cust_bill.pm 8 Oct 2006 08:17:06 -0000 1.156
@@ -1319,9 +1319,10 @@
return '' unless $amount > 0;
if ($options{'realtime'}) {
- return $cust_main->realtime_bop ( $FS::payby::payby2bop{$cust_main->payby}, $amount,
- %options,
- );
+ return $cust_main->realtime_bop( FS::payby->payby2bop($cust_main->payby),
+ $amount,
+ %options,
+ );
}
my $oldAutoCommit = $FS::UID::AutoCommit;
@@ -1331,11 +1332,15 @@
$dbh->do("LOCK TABLE pay_batch IN SHARE ROW EXCLUSIVE MODE")
or return "Cannot lock pay_batch: " . $dbh->errstr;
- my $pay_batch = qsearchs('pay_batch', {'status' => 'O'});
+ my %pay_batch = (
+ 'status' => 'O',
+ 'payby' => FS::payby->payby2payment($cust_main->payby),
+ );
+
+ my $pay_batch = qsearchs( 'pay_batch', \%pay_batch );
unless ( $pay_batch ) {
- $pay_batch = new FS::pay_batch;
- $pay_batch->setfield('status' => 'O');
+ $pay_batch = new FS::pay_batch \%pay_batch;
my $error = $pay_batch->insert;
if ( $error ) {
$dbh->rollback if $oldAutoCommit;
@@ -1344,26 +1349,29 @@
}
my $old_cust_pay_batch = qsearchs('cust_pay_batch', {
- 'batchnum' => $pay_batch->getfield('batchnum'),
- 'custnum' => $cust_main->getfield('custnum'),
+ 'batchnum' => $pay_batch->batchnum,
+ 'custnum' => $cust_main->custnum,
} );
my $cust_pay_batch = new FS::cust_pay_batch ( {
- 'batchnum' => $pay_batch->getfield('batchnum'),
+ 'batchnum' => $pay_batch->batchnum,
'invnum' => $self->getfield('invnum'), # is there a better value?
- 'custnum' => $cust_main->getfield('custnum'),
+ # this field should be
+ # removed...
+ # cust_bill_pay_batch now
+ 'custnum' => $cust_main->custnum,
'last' => $cust_main->getfield('last'),
'first' => $cust_main->getfield('first'),
- 'address1' => $cust_main->getfield('address1'),
- 'address2' => $cust_main->getfield('address2'),
- 'city' => $cust_main->getfield('city'),
- 'state' => $cust_main->getfield('state'),
- 'zip' => $cust_main->getfield('zip'),
- 'country' => $cust_main->getfield('country'),
+ 'address1' => $cust_main->address1,
+ 'address2' => $cust_main->address2,
+ 'city' => $cust_main->city,
+ 'state' => $cust_main->state,
+ 'zip' => $cust_main->zip,
+ 'country' => $cust_main->country,
'payby' => $cust_main->payby,
'payinfo' => $cust_main->payinfo,
- 'exp' => $cust_main->getfield('paydate'),
- 'payname' => $cust_main->getfield('payname'),
+ 'exp' => $cust_main->paydate,
+ 'payname' => $cust_main->payname,
'amount' => $amount, # consolidating
} );
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- Schema.pm 4 Oct 2006 21:22:07 -0000 1.31
+++ Schema.pm 8 Oct 2006 08:17:06 -0000 1.32
@@ -592,6 +592,7 @@
'pay_batch' => { #batches of payments to an external processor
'columns' => [
'batchnum', 'serial', '', '', '', '',
+ 'payby', 'char', '', 4, '', '', # CARD/CHEK
'status', 'char', 'NULL', 1, '', '',
'download', @date_type, '', '',
'upload', @date_type, '', '',
Index: AccessRight.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/AccessRight.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- AccessRight.pm 3 Oct 2006 22:44:26 -0000 1.10
+++ AccessRight.pm 8 Oct 2006 08:17:06 -0000 1.11
@@ -165,9 +165,11 @@
###
# misc rights
###
- 'Job queue', # these are not currently agent-virtualized
- 'Import', #
- 'Export', #
+ 'Job queue', # these are not currently agent-virtualized
+ 'Process batches', #
+ 'Reprocess batches', #
+ 'Import', #
+ 'Export', #
###
# setup/config rights
More information about the freeside-commits
mailing list