1 package FS::payinfo_transaction_Mixin;
7 use FS::Record qw(qsearchs);
9 use FS::payment_gateway;
11 @ISA = qw( FS::payinfo_Mixin );
15 FS::payinfo_transaction_Mixin - Mixin class for records in tables that represent transactions.
19 package FS::some_table;
21 @ISA = qw( FS::payinfo_transaction_Mixin FS::Record );
25 This is a mixin class for records that represent transactions: that contain
26 payinfo and paybatch. Currently FS::cust_pay and FS::cust_refund
35 Returns the parent customer object (see L<FS::cust_main>).
41 qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
46 Returns a name for the payby field.
52 if ( $self->payby eq 'BILL' ) { #kludge
55 FS::payby->shortname( $self->payby );
61 Returns a gatewaynum for the processing gateway.
65 Returns a name for the processing gateway.
69 Returns a name for the processing gateway.
73 Returns a name for the processing gateway.
77 sub gatewaynum { shift->_parse_paybatch->{'gatewaynum'}; }
78 sub processor { shift->_parse_paybatch->{'processor'}; }
79 sub authorization { shift->_parse_paybatch->{'authorization'}; }
80 sub order_number { shift->_parse_paybatch->{'order_number'}; }
82 #sucks that this stuff is in paybatch like this in the first place,
83 #but at least other code can start to use new field names
84 #(code nicked from FS::cust_main::realtime_refund_bop)
88 $self->paybatch =~ /^((\d+)\-)?(\w+):\s*([\w\-\/ ]*)(:([\w\-]+))?$/
90 #"Can't parse paybatch for paynum $options{'paynum'}: ".
91 # $cust_pay->paybatch;
93 my( $gatewaynum, $processor, $auth, $order_number ) = ( $2, $3, $4, $6 );
95 if ( $gatewaynum ) { #gateway for the payment to be refunded
98 qsearchs('payment_gateway', { 'gatewaynum' => $gatewaynum } );
100 die "payment gateway $gatewaynum not found" #?
101 unless $payment_gateway;
103 $processor = $payment_gateway->gateway_module;
108 'gatewaynum' => $gatewaynum,
109 'processor' => $processor,
110 'authorization' => $auth,
111 'order_number' => $order_number,