summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMitch Jackson <mitch@freeside.biz>2018-08-24 22:31:14 -0400
committerMitch Jackson <mitch@freeside.biz>2018-09-07 15:01:16 -0400
commitbe0fbca00a9293aa7984dca5724fa885f41dbd5e (patch)
tree466c8e819510e62ea30a203302328f43ed37e78e /httemplate
parentc2b4bc64544ee18dae0093306b79d3d9798a02c1 (diff)
RT# 81183 Fix crash processing payment with new payment method
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/misc/process/payment.cgi12
1 files changed, 9 insertions, 3 deletions
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index 939fc38c2..d0e589661 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -211,15 +211,21 @@ if ( (my $custpaybynum = scalar($cgi->param('custpaybynum'))) > 0 ) {
my $error = '';
my $paynum = '';
-my $paydate;
-if ($cust_payby->paydate) { $paydate = "$year-$month-01"; }
-else { $paydate = "2037-12-01"; }
if ( $cgi->param('batch') ) {
$error = 'Prepayment discounts not supported with batched payments'
if $discount_term;
+ # Invalid payment expire dates are replaced with 2037-12-01 (why?)
+ my $paydate = "${year}-${month}-01";
+ {
+ use DateTime;
+ local $@;
+ eval { DateTime->new({ year => $year, month => $month, day => 1 }) };
+ $paydate = '2037-12-01' if $@;
+ }
+
$error ||= $cust_main->batch_card(
'payby' => $payby,
'amount' => $amount,