summaryrefslogtreecommitdiff
path: root/FS/FS/ClientAPI/Signup.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-04-25 14:45:49 -0700
committerMark Wells <mark@freeside.biz>2013-04-25 14:46:10 -0700
commita1a0800de7c69fe5ee414b79e408ceacd4a1c2c3 (patch)
tree92589a379a7bd3925139779ad0b0d5cd55df6152 /FS/FS/ClientAPI/Signup.pm
parentf3e0ac2b009c4edd5692cb587ff709dac2223ebe (diff)
changes to support PayPal, #22395
Diffstat (limited to 'FS/FS/ClientAPI/Signup.pm')
-rw-r--r--FS/FS/ClientAPI/Signup.pm28
1 files changed, 20 insertions, 8 deletions
diff --git a/FS/FS/ClientAPI/Signup.pm b/FS/FS/ClientAPI/Signup.pm
index 1dbb20b..c3beb69 100644
--- a/FS/FS/ClientAPI/Signup.pm
+++ b/FS/FS/ClientAPI/Signup.pm
@@ -946,15 +946,27 @@ sub capture_payment {
}
my $cust_main = $cust_pay_pending->cust_main;
- my $bill_error =
- $cust_main->realtime_botpp_capture( $cust_pay_pending,
- %{$packet->{data}},
- apply => 1,
- );
+ if ( $packet->{cancel} ) {
+ # the user has chosen not to make this payment
+ # (probably should be a separate API call, but I don't want to duplicate
+ # all of the above...which should eventually go away)
+ my $error = $cust_pay_pending->delete;
+ # don't show any errors related to this; they're not meaningful
+ warn "error canceling pending payment $paypendingnum: $error\n" if $error;
+ return { 'error' => '_cancel',
+ 'session_id' => $cust_pay_pending->session_id };
+ } else {
+ # create the payment
+ my $bill_error =
+ $cust_main->realtime_botpp_capture( $cust_pay_pending,
+ %{$packet->{data}},
+ apply => 1,
+ );
- return { 'error' => ( $bill_error->{bill_error} ? '_decline' : '' ),
- %$bill_error,
- };
+ return { 'error' => ( $bill_error->{bill_error} ? '_decline' : '' ),
+ %$bill_error,
+ };
+ }
}