[freeside-commits] freeside/FS/FS/cust_main Billing_Realtime.pm, 1.9.2.1, 1.9.2.2
Mark Wells
mark at wavetail.420.am
Tue Dec 21 01:13:05 PST 2010
- Previous message: [freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.113.2.7, 1.113.2.8 Signup.pm, 1.64, 1.64.2.1
- Next message: [freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi make_thirdparty_payment.html, 1.4, 1.4.4.1 post_thirdparty_payment.html, NONE, 1.1.2.2 selfservice.cgi, 1.46.2.6, 1.46.2.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv21004/FS/FS/cust_main
Modified Files:
Tag: FREESIDE_2_1_BRANCH
Billing_Realtime.pm
Log Message:
changes to support eWay third-party payment, #10208
Index: Billing_Realtime.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing_Realtime.pm,v
retrieving revision 1.9.2.1
retrieving revision 1.9.2.2
diff -u -w -d -r1.9.2.1 -r1.9.2.2
--- Billing_Realtime.pm 7 Dec 2010 22:26:59 -0000 1.9.2.1
+++ Billing_Realtime.pm 21 Dec 2010 09:13:03 -0000 1.9.2.2
@@ -178,6 +178,14 @@
sub _payment_gateway {
my ($self, $options) = @_;
+ if ( $options->{'selfservice'} ) {
+ my $gatewaynum = FS::Conf->new->config('selfservice-payment_gateway');
+ if ( $gatewaynum ) {
+ return $options->{payment_gateway} ||=
+ qsearchs('payment_gateway', { gatewaynum => $gatewaynum });
+ }
+ }
+
$options->{payment_gateway} = $self->agent->payment_gateway( %$options )
unless exists($options->{payment_gateway});
@@ -467,6 +475,24 @@
'custnum' => $self->custnum,
'status' => { op=>'!=', value=>'done' }
});
+ # This is a problem. A self-service third party payment that fails somehow
+ # can't be retried, EVER, until someone manually clears it. Totally
+ # arbitrary fix: if the existing payment is more than two minutes old,
+ # kill it. This doesn't limit how long it can take the pending payment
+ # to complete, only how long it will obstruct new payments.
+ my @still_pending;
+ foreach (@pending) {
+ if ( time - $_->_date > 120 ) {
+ my $error = $_->delete;
+ warn "error deleting stale pending payment ".$_->paypendingnum.": $error"
+ if $error; # not fatal, it will fail anyway
+ }
+ else {
+ push @still_pending, $_;
+ }
+ }
+ @pending = @still_pending;
+
return "A payment is already being processed for this customer (".
join(', ', map 'paypendingnum '. $_->paypendingnum, @pending ).
"); $options{method} transaction aborted."
@@ -511,6 +537,7 @@
'customer_id' => $self->custnum,
%$bop_content,
'reference' => $cust_pay_pending->paypendingnum, #for now
+ 'callback_url' => $payment_gateway->gateway_callback_url,
'email' => $email,
%content, #after
);
@@ -1016,9 +1043,10 @@
my $method = FS::payby->payby2bop($cust_pay_pending->payby);
- my $payment_gateway = $cust_pay_pending->gatewaynum
- ? qsearchs( 'payment_gateway',
- { gatewaynum => $cust_pay_pending->gatewaynum }
+ my $payment_gateway;
+ my $gatewaynum = $cust_pay_pending->getfield('gatewaynum');
+ $payment_gateway = $gatewaynum ? qsearchs( 'payment_gateway',
+ { gatewaynum => $gatewaynum }
)
: $self->agent->payment_gateway( 'method' => $method,
# 'invnum' => $cust_pay_pending->invnum,
@@ -1080,7 +1108,14 @@
my $error =
$self->_realtime_bop_result( $cust_pay_pending, $transaction, %options );
- {
+ if ( $options{'apply'} ) {
+ my $apply_error = $self->apply_payments_and_credits;
+ if ( $apply_error ) {
+ warn "WARNING: error applying payment: $apply_error\n";
+ }
+ }
+
+ return {
bill_error => $error,
session_id => $cust_pay_pending->session_id,
}
- Previous message: [freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.113.2.7, 1.113.2.8 Signup.pm, 1.64, 1.64.2.1
- Next message: [freeside-commits] freeside/fs_selfservice/FS-SelfService/cgi make_thirdparty_payment.html, 1.4, 1.4.4.1 post_thirdparty_payment.html, NONE, 1.1.2.2 selfservice.cgi, 1.46.2.6, 1.46.2.7
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list