diff options
author | ivan <ivan> | 2007-10-27 04:46:05 +0000 |
---|---|---|
committer | ivan <ivan> | 2007-10-27 04:46:05 +0000 |
commit | 9ed8adbf1ab5aba8181903e9c262f2b69dba6cbc (patch) | |
tree | cb1474ff04a974f356db758a01c8299c9a7b0a6e /FS/FS | |
parent | cb008af3d5847be4e31f5f67e3ac017b8adea58f (diff) |
simple payment receipts in web interface, sorry arnie, RT#2738
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/cust_main.pm | 12 | ||||
-rw-r--r-- | FS/FS/cust_pay.pm | 69 |
2 files changed, 79 insertions, 2 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f043e477a..467ddfe0c 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2859,7 +2859,7 @@ L<http://420.am/business-onlinepayment> for supported gateways. 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, @@ -2874,6 +2874,9 @@ call the B<apply_payments> method. 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) =cut @@ -3237,6 +3240,11 @@ sub realtime_bop { return $e; } } + + if ( $options{'paynum_ref'} ) { + ${ $options{'paynum_ref'} } = $cust_pay->paynum; + } + return ''; #no error } else { @@ -3317,7 +3325,7 @@ sub default_payment_gateway { #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'; diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 5d31d2cde..78c09a3d0 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -7,6 +7,7 @@ use Business::CreditCard; 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 @@ sub cust_main { 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 CLASS METHODS |