summaryrefslogtreecommitdiff
path: root/FS/FS/payinfo_transaction_Mixin.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-01-02 19:01:16 -0800
committerMark Wells <mark@freeside.biz>2013-01-02 19:01:16 -0800
commite5d6af11f52aabe8c9e6e12ce43c3401ccf025a8 (patch)
treee67a2737e58566ad7d4e4b759b3bf4a542dae25d /FS/FS/payinfo_transaction_Mixin.pm
parentc7286ce9036d71665c2bfed9de93f87309b72d35 (diff)
move credit card transaction results out of paybatch and into real fields, #18548
Diffstat (limited to 'FS/FS/payinfo_transaction_Mixin.pm')
-rw-r--r--FS/FS/payinfo_transaction_Mixin.pm56
1 files changed, 30 insertions, 26 deletions
diff --git a/FS/FS/payinfo_transaction_Mixin.pm b/FS/FS/payinfo_transaction_Mixin.pm
index 19419de..093891e 100644
--- a/FS/FS/payinfo_transaction_Mixin.pm
+++ b/FS/FS/payinfo_transaction_Mixin.pm
@@ -23,7 +23,8 @@ 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
@@ -55,32 +56,8 @@ sub payby_name {
}
}
-=item gatewaynum
+# We keep _parse_paybatch just because the upgrade needs it.
-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;
@@ -112,6 +89,33 @@ 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;
+
+ # All of these can be null, so in principle this could go in payinfo_Mixin.
+
+ $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
=head1 SEE ALSO