From c1dbb54da9699d6d347b6d8392e2108f80fb1dcf Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 30 Jul 2009 09:19:20 +0000 Subject: [PATCH] pass a pkgnum from self-service if applicable, RT#4339 --- FS/FS/ClientAPI/MyAccount.pm | 11 ++++++++--- FS/FS/cust_main.pm | 6 +++++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 02b54ffc9..895b11d9d 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -128,6 +128,8 @@ sub login { if ( $cust_pkg ) { my $cust_main = $cust_pkg->cust_main; $session->{'custnum'} = $cust_main->custnum; + $session->{'pkgnum'} = $cust_pkg->pkgnum + if $conf->exists('pkg-balances'); } my $session_id; @@ -518,6 +520,7 @@ sub process_payment { 'payname' => $payname, 'paybatch' => $paybatch, #this doesn't actually do anything 'paycvv' => $paycvv, + 'pkgnum' => $session->{'pkgnum'}, map { $_ => $p->{$_} } @{ $payby2fields{$payby} } ); return { 'error' => $error } if $error; @@ -560,9 +563,11 @@ sub realtime_collect { my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) or return { 'error' => "unknown custnum $custnum" }; - my $error = $cust_main->realtime_collect( 'method' => $p->{'method'}, - 'session_id' => $p->{'session_id'}, - ); + my $error = $cust_main->realtime_collect( + 'method' => $p->{'method'}, + 'pkgnum' => $session->{'pkgnum'}, + 'session_id' => $p->{'session_id'}, + ); return { 'error' => $error } unless ref( $error ); return { 'error' => '', amount => $cust_main->balance, %$error }; diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9c131744d..becb9054b 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3961,6 +3961,7 @@ sub realtime_bop { 'payinfo' => $payinfo, 'paydate' => $paydate, 'recurring_billing' => $content{recurring_billing}, + 'pkgnum' => $options{'pkgnum'}, 'status' => 'new', 'gatewaynum' => ( $payment_gateway ? $payment_gateway->gatewaynum : '' ), }; @@ -4116,6 +4117,7 @@ sub realtime_bop { 'payinfo' => $payinfo, 'paybatch' => $paybatch, 'paydate' => $paydate, + 'pkgnum' => $options{'pkgnum'}, } ); #doesn't hurt to know, even though the dup check is in cust_pay_pending now $cust_pay->payunique( $options{payunique} ) @@ -4629,7 +4631,7 @@ On failure returns an error message. Returns false or a hashref upon success. The hashref contains keys popup_url reference, and collectitems. The first is a URL to which a browser should be redirected for completion of collection. The second is a reference id for the transaction suitable for the end user. The collectitems is a reference to a list of name value pairs suitable for assigning to a html form and posted to popup_url. -Available options are: I, I, I, I, I, I, I, I +Available options are: I, I, I, I, I, I, I, I, I I is one of: I, I and I. If none is specified then it is deduced from the customer record. @@ -5002,6 +5004,7 @@ sub _new_realtime_bop { 'payinfo' => $options{payinfo}, 'paydate' => $paydate, 'recurring_billing' => $content{recurring_billing}, + 'pkgnum' => $options{'pkgnum'}, 'status' => 'new', 'gatewaynum' => $payment_gateway->gatewaynum || '', 'session_id' => $options{session_id} || '', @@ -5248,6 +5251,7 @@ sub _realtime_bop_result { #'payinfo' => $payinfo, 'paybatch' => $paybatch, 'paydate' => $cust_pay_pending->paydate, + 'pkgnum' => $cust_pay_pending->pkgnum, } ); #doesn't hurt to know, even though the dup check is in cust_pay_pending now $cust_pay->payunique( $options{payunique} ) -- 2.11.0