summaryrefslogtreecommitdiff
path: root/FS/FS/cust_pay.pm
diff options
context:
space:
mode:
authorivan <ivan>2007-10-27 04:46:05 +0000
committerivan <ivan>2007-10-27 04:46:05 +0000
commit9ed8adbf1ab5aba8181903e9c262f2b69dba6cbc (patch)
treecb1474ff04a974f356db758a01c8299c9a7b0a6e /FS/FS/cust_pay.pm
parentcb008af3d5847be4e31f5f67e3ac017b8adea58f (diff)
simple payment receipts in web interface, sorry arnie, RT#2738
Diffstat (limited to 'FS/FS/cust_pay.pm')
-rw-r--r--FS/FS/cust_pay.pm69
1 files changed, 69 insertions, 0 deletions
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 5d31d2c..78c09a3 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