[freeside-commits] freeside/FS/FS cust_pay.pm, 1.50.2.3, 1.50.2.4 cust_main.pm, 1.271.2.23, 1.271.2.24
Ivan,,,
ivan at wavetail.420.am
Fri Oct 26 21:46:22 PDT 2007
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail:/tmp/cvs-serv27386/FS/FS
Modified Files:
Tag: FREESIDE_1_7_BRANCH
cust_pay.pm cust_main.pm
Log Message:
simple payment receipts in web interface, sorry arnie, RT#2738
Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.50.2.3
retrieving revision 1.50.2.4
diff -u -d -r1.50.2.3 -r1.50.2.4
--- cust_pay.pm 11 Jul 2007 08:08:29 -0000 1.50.2.3
+++ cust_pay.pm 27 Oct 2007 04:46:20 -0000 1.50.2.4
@@ -7,6 +7,7 @@
use Text::Template;
use FS::Misc qw(send_email);
use FS::Record qw( dbh qsearch qsearchs );
+use FS::payby;
use FS::cust_main_Mixin;
use FS::payinfo_Mixin;
use FS::cust_bill;
@@ -548,6 +549,74 @@
qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
}
+=item payby_name
+
+Returns a name for the payby field.
+
+=cut
+
+sub payby_name {
+ my $self = shift;
+ FS::payby->shortname( $self->payby );
+}
+
+=item gatewaynum
+
+Returns a gatewaynum for the processing gateway.
+
+=item processor
+
+Returns a name for the processing gateway.
+
+=item authorization
+
+Returns a name for the processing gateway.
+
+=item order_number
+
+Returns a name for the processing gateway.
+
+=cut
+
+sub gatewaynum { shift->_parse_paybatch->{'gatewaynum'}; }
+sub processor { shift->_parse_paybatch->{'processor'}; }
+sub authorization { shift->_parse_paybatch->{'authorization'}; }
+sub order_number { shift->_parse_paybatch->{'order_number'}; }
+
+#sucks that this stuff is in paybatch like this in the first place,
+#but at least other code can start to use new field names
+#(code nicked from FS::cust_main::realtime_refund_bop)
+sub _parse_paybatch {
+ my $self = shift;
+
+ $self->paybatch =~ /^((\d+)\-)?(\w+):\s*([\w\-\/ ]*)(:([\w\-]+))?$/
+ or return {};
+ #"Can't parse paybatch for paynum $options{'paynum'}: ".
+ # $cust_pay->paybatch;
+
+ my( $gatewaynum, $processor, $auth, $order_number ) = ( $2, $3, $4, $6 );
+
+ if ( $gatewaynum ) { #gateway for the payment to be refunded
+
+ my $payment_gateway =
+ qsearchs('payment_gateway', { 'gatewaynum' => $gatewaynum } );
+
+ die "payment gateway $gatewaynum not found" #?
+ unless $payment_gateway;
+
+ $processor = $payment_gateway->gateway_module;
+
+ }
+
+ {
+ 'gatewaynum' => $gatewaynum,
+ 'processor' => $processor,
+ 'authorization' => $auth,
+ 'order_number' => $order_number,
+ };
+
+}
+
=back
=head1 BUGS
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.271.2.23
retrieving revision 1.271.2.24
diff -u -d -r1.271.2.23 -r1.271.2.24
--- cust_main.pm 4 Oct 2007 02:15:40 -0000 1.271.2.23
+++ cust_main.pm 27 Oct 2007 04:46:20 -0000 1.271.2.24
@@ -2437,7 +2437,7 @@
Available methods are: I<CC>, I<ECHECK> and I<LEC>
-Available options are: I<description>, I<invnum>, I<quiet>
+Available options are: I<description>, I<invnum>, I<quiet>, I<paynum_ref>
The additional options I<payname>, I<address1>, I<address2>, I<city>, I<state>,
I<zip>, I<payinfo> and I<paydate> are also available. Any of these options,
@@ -2452,6 +2452,9 @@
I<quiet> can be set true to surpress email decline notices.
+I<paynum_ref> can be set to a scalar reference. It will be filled in with the
+resulting paynum, if any.
+
(moved from cust_bill) (probably should get realtime_{card,ach,lec} here too)
=back
@@ -2801,6 +2804,11 @@
return $e;
}
}
+
+ if ( $options{'paynum_ref'} ) {
+ ${ $options{'paynum_ref'} } = $cust_pay->paynum;
+ }
+
return ''; #no error
} else {
@@ -2889,7 +2897,7 @@
#load up config
my $bop_config = 'business-onlinepayment';
$bop_config .= '-ach'
- if $method eq 'ECHECK' && $conf->exists($bop_config. '-ach');
+ if $method =~ /^(ECHECK|CHEK)$/ && $conf->exists($bop_config. '-ach');
my ( $processor, $login, $password, $action, @bop_options ) =
$conf->config($bop_config);
$action ||= 'normal authorization';
More information about the freeside-commits
mailing list