From ec2bbe3c669b938981be379728e47fe5ecbdcc2e Mon Sep 17 00:00:00 2001 From: Manager Bot Date: Tue, 6 Dec 2022 02:49:13 +0000 Subject: [PATCH] Make finish subscribe. --- Web/lib/MJB/Web.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Web/lib/MJB/Web.pm b/Web/lib/MJB/Web.pm index 6c56c6e..d6457e3 100644 --- a/Web/lib/MJB/Web.pm +++ b/Web/lib/MJB/Web.pm @@ -119,6 +119,14 @@ sub startup ($self) { # Logged in user exists. if ( $c->stash->{person} ) { + + # Did the user register with a subscription and not complete it? - Send them to complete it. + if ( $c->stash->{person}->subscription && ! $c->stash->{person}->subscription->stripe_customer_id ) { + my $fetch_url = $c->config->{stripe}->{backend} . '/stripe/get-checkout-link?lookup_key='; + return $c->redirect_to( $c->ua->get( $fetch_url . $c->config->{stripe}->{lookup_key} )->result->json->{url} ); + } + + # Continue return 1; }