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
34 Returns the parent customer object (see L<FS::cust_main>).
40 qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
45 Returns a name for the payby field.
51 if ( $self->payby eq 'BILL' ) { #kludge
54 FS::payby->shortname( $self->payby );
60 Returns a gatewaynum for the processing gateway.
64 Returns a name for the processing gateway.
68 Returns a name for the processing gateway.
72 Returns a name for the processing gateway.
76 sub gatewaynum { shift->_parse_paybatch->{'gatewaynum'}; }
77 sub processor { shift->_parse_paybatch->{'processor'}; }
78 sub authorization { shift->_parse_paybatch->{'authorization'}; }
79 sub order_number { shift->_parse_paybatch->{'order_number'}; }
81 #sucks that this stuff is in paybatch like this in the first place,
82 #but at least other code can start to use new field names
83 #(code nicked from FS::cust_main::realtime_refund_bop)
87 $self->paybatch =~ /^((\d+)\-)?(\w+):\s*([\w\-\/ ]*)(:([\w\-]+))?$/
89 #"Can't parse paybatch for paynum $options{'paynum'}: ".
90 # $cust_pay->paybatch;
92 my( $gatewaynum, $processor, $auth, $order_number ) = ( $2, $3, $4, $6 );
94 if ( $gatewaynum ) { #gateway for the payment to be refunded
97 qsearchs('payment_gateway', { 'gatewaynum' => $gatewaynum } );
99 die "payment gateway $gatewaynum not found" #?
100 unless $payment_gateway;
102 $processor = $payment_gateway->gateway_module;
107 'gatewaynum' => $gatewaynum,
108 'processor' => $processor,
109 'authorization' => $auth,
110 'order_number' => $order_number,