Skip to content

Commit

Permalink
finalize stripe billing
Browse files Browse the repository at this point in the history
  • Loading branch information
r-follador committed Dec 19, 2023
1 parent ebe603d commit af2cd21
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ public class StripeSubscriptionController {
@Value("${stripe.endpoint.secret}")
String endpointSecret;

@Value("${stripe.endpoint.public}")
String endpointPublic;

Logger logger = LoggerFactory.getLogger(StripeSubscriptionController.class);

@Autowired
Expand Down Expand Up @@ -195,6 +198,7 @@ public String showSubscription(WebRequest request, Model model) throws StripeExc
return "redirect:"+portalSession.getUrl();
} else { //if no subscription exists, create new subscription
model.addAttribute("user", user);
model.addAttribute("stripe_publickey", endpointPublic);
return "subscribe";
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ cubetrek.address=http://localhost:8080

##coche control for web assets: 1 sec
spring.web.resources.cache.cachecontrol.max-age=1
spring.web.resources.cache.cachecontrol.cache-public=true
spring.web.resources.cache.cachecontrol.cache-public=true

stripe.api.key=${stripe.api.key.test}
stripe.price=${stripe.price.test}
stripe.endpoint.secret=${stripe.endpoint.secret.test}
stripe.endpoint.public=${stripe.endpoint.public.test}
5 changes: 5 additions & 0 deletions src/main/resources/application-production.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ spring.mail.port=587

cubetrek.address=https://cubetrek.com

stripe.api.key=${stripe.api.key.prod}
stripe.price=${stripe.price.prod}
stripe.endpoint.secret=${stripe.endpoint.secret.prod}
stripe.endpoint.public=${stripe.endpoint.public.prod}


##coche control for web assets: 6 months
#spring.web.resources.cache.cachecontrol.max-age=15552000
Expand Down
26 changes: 1 addition & 25 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,4 @@ spring.task.execution.thread-name-prefix=cubetrek-task-exec-
spring.servlet.multipart.max-file-size=100MB
# Max request size.
spring.servlet.multipart.max-request-size=108MB
server.error.whitelabel.enabled=false

### Map Api
#maptiler.api.key=xxx
#googlemap.api.key=xxx
#cesium.ion.defaultAccessToken=xxx


### Third Party Syncing

### Garmin Connect
#garmin.consumer.key=xxx
#garmin.consumer.secret=xxx

### Polar Accesslink
#polar.client.id=xxx
#polar.client.secret=xxx
#polar.webhook.signature_secret_key=xxx
#polar.webhook.id=xx


## Suunto Cloud
#suunto.client.id=xxx
#suunto.primary.key=xxx
#suunto.client.secret=xxx
server.error.whitelabel.enabled=false
7 changes: 2 additions & 5 deletions src/main/resources/templates/subscribe.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3" lang="en">

<head>
<title>CubeTrek - Profile</title>
<title>CubeTrek - Support</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down Expand Up @@ -37,7 +37,6 @@ <h2>

<div class="mt-4">
<div id="checkout">
<!-- Checkout will insert the payment form here -->
</div>
</div>
</main>
Expand All @@ -47,11 +46,9 @@ <h2>
</body>

<script>
// This is your test publishable API key.
const stripe = Stripe("pk_test_51OLKeGAnubzMChN3PMLPVAWBSa9EXb1eMvHYzMgtALNx4O0WJQg6YjagNpRtSGCvX7s0jbVY4PnWRqGTtM7bXm1v00ETb6aMAZ");
const stripe = Stripe("[[${stripe_publickey}]]");

initialize();

// Create a Checkout Session as soon as the page loads
async function initialize() {
const response = await fetch("/stripe-session", {
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/subscribe2.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity3" lang="en">

<head>
<title>CubeTrek - Profile</title>
<title>CubeTrek - Support</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down

0 comments on commit af2cd21

Please sign in to comment.