summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2009-07-30 09:19:20 +0000
committerivan <ivan>2009-07-30 09:19:20 +0000
commitc1dbb54da9699d6d347b6d8392e2108f80fb1dcf (patch)
tree400131d05592ea6f692969e98abbbd52355163a8
parent72a60ae400c253e913728a830e588e209b1a23fe (diff)
pass a pkgnum from self-service if applicable, RT#4339
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm11
-rw-r--r--FS/FS/cust_main.pm6
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<method>, I<amount>, I<description>, I<invnum>, I<quiet>, I<paynum_ref>, I<payunique>, I<session_id>
+Available options are: I<method>, I<amount>, I<description>, I<invnum>, I<quiet>, I<paynum_ref>, I<payunique>, I<session_id>, I<pkgnum>
I<method> is one of: I<CC>, I<ECHECK> and I<LEC>. 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} )