1 package FS::payinfo_transaction_Mixin;
8 @ISA = qw( FS::payinfo_Mixin );
12 FS::payinfo_transaction_Mixin - Mixin class for records in tables that represent transactions.
16 package FS::some_table;
18 @ISA = qw( FS::payinfo_transaction_Mixin FS::Record );
22 This is a mixin class for records that represent transactions: that contain
23 payinfo and paybatch. Currently FS::cust_pay and FS::cust_refund
32 Returns the parent customer object (see L<FS::cust_main>).
38 qsearchs( 'cust_main', { 'custnum' => $self->custnum } );
43 Returns a name for the payby field.
49 if ( $self->payby eq 'BILL' ) { #kludge
52 FS::payby->shortname( $self->payby );
58 Returns a gatewaynum for the processing gateway.
62 Returns a name for the processing gateway.
66 Returns a name for the processing gateway.
70 Returns a name for the processing gateway.
74 sub gatewaynum { shift->_parse_paybatch->{'gatewaynum'}; }
75 sub processor { shift->_parse_paybatch->{'processor'}; }
76 sub authorization { shift->_parse_paybatch->{'authorization'}; }
77 sub order_number { shift->_parse_paybatch->{'order_number'}; }
79 #sucks that this stuff is in paybatch like this in the first place,
80 #but at least other code can start to use new field names
81 #(code nicked from FS::cust_main::realtime_refund_bop)
85 $self->paybatch =~ /^((\d+)\-)?(\w+):\s*([\w\-\/ ]*)(:([\w\-]+))?$/
87 #"Can't parse paybatch for paynum $options{'paynum'}: ".
88 # $cust_pay->paybatch;
90 my( $gatewaynum, $processor, $auth, $order_number ) = ( $2, $3, $4, $6 );
92 if ( $gatewaynum ) { #gateway for the payment to be refunded
95 qsearchs('payment_gateway', { 'gatewaynum' => $gatewaynum } );
97 die "payment gateway $gatewaynum not found" #?
98 unless $payment_gateway;
100 $processor = $payment_gateway->gateway_module;
105 'gatewaynum' => $gatewaynum,
106 'processor' => $processor,
107 'authorization' => $auth,
108 'order_number' => $order_number,