X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fpayinfo_transaction_Mixin.pm;h=1b5a0cdff0951c3fb43d58125c7ecc83edf46388;hp=d0be9e847a153d58ca58df433c33eeeae5c16c5e;hb=3adb46fccf9f631e188ea5383bd147b340477639;hpb=6e378bcfac9d6a5107ba4154b3882aa7ea512905 diff --git a/FS/FS/payinfo_transaction_Mixin.pm b/FS/FS/payinfo_transaction_Mixin.pm index d0be9e847..1b5a0cdff 100644 --- a/FS/FS/payinfo_transaction_Mixin.pm +++ b/FS/FS/payinfo_transaction_Mixin.pm @@ -23,13 +23,13 @@ use vars qw(@ISA); =head1 DESCRIPTION This is a mixin class for records that represent transactions: that contain -payinfo and paybatch. Currently FS::cust_pay and FS::cust_refund +payinfo and realtime result fields (gatewaynum, processor, authorization, +order_number). Currently FS::cust_pay, FS::cust_refund, and FS::cust_pay_void. =head1 METHODS =over 4 - =item cust_main Returns the parent customer object (see L). @@ -56,32 +56,8 @@ sub payby_name { } } -=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. +# We keep _parse_paybatch just because the upgrade needs it. -=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; @@ -97,10 +73,7 @@ sub _parse_paybatch { my $payment_gateway = qsearchs('payment_gateway', { 'gatewaynum' => $gatewaynum } ); - die "payment gateway $gatewaynum not found" #? - unless $payment_gateway; - - $processor = $payment_gateway->gateway_module; + $processor = $payment_gateway->gateway_module if $payment_gateway; } @@ -113,8 +86,30 @@ sub _parse_paybatch { } +# because we can't actually name the field 'authorization' (reserved word) +sub authorization { + my $self = shift; + $self->auth(@_); +} + +=item payinfo_check +Checks the validity of the realtime payment fields (gatewaynum, processor, +auth, and order_number) as well as payby and payinfo +=cut + +sub payinfo_check { + my $self = shift; + + $self->SUPER::payinfo_check() + || $self->ut_numbern('gatewaynum') + # not ut_foreign_keyn, it causes upgrades to fail + || $self->ut_alphan('processor') + || $self->ut_textn('auth') + || $self->ut_textn('order_number') + || ''; +} =back @@ -122,4 +117,6 @@ sub _parse_paybatch { L -=back +=cut + +1;