• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stripe / stripe-java / #16493

03 Oct 2024 07:15PM UTC coverage: 12.942% (+0.08%) from 12.864%
#16493

push

github

web-flow
Merge Stripe-java v27.0.0 to beta branch (#1888)

409 of 1651 new or added lines in 88 files covered. (24.77%)

31 existing lines in 7 files now uncovered.

18773 of 145050 relevant lines covered (12.94%)

0.13 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/com/stripe/examples/StripeWebhookHandler.java
1
package com.stripe.examples;
2

NEW
3
public class StripeWebhookHandler {
×
4
  // private static final String API_KEY = System.getenv("STRIPE_API_KEY");
5
  // private static final String WEBHOOK_SECRET = System.getenv("WEBHOOK_SECRET");
6

7
  // private static final StripeClient client = new StripeClient(API_KEY);
8

9
  // public static void main(String[] args) throws IOException {
10

11
  //   HttpServer server = HttpServer.create(new InetSocketAddress(4242), 0);
12
  //   server.createContext("/webhook", new WebhookHandler());
13
  //   server.setExecutor(null);
14
  //   server.start();
15
  // }
16

17
  // static class WebhookHandler implements HttpHandler {
18
  //   @Override
19
  //   public void handle(HttpExchange exchange) throws IOException {
20
  // if ("POST".equals(exchange.getRequestMethod())) {
21
  //   InputStream requestBody = exchange.getRequestBody();
22
  //   String webhookBody = new String(requestBody.readAllBytes(), StandardCharsets.UTF_8);
23
  //   String sigHeader = exchange.getRequestHeaders().getFirst("Stripe-Signature");
24

25
  //   try {
26
  //     ThinEvent thinEvent = client.parseThinEvent(webhookBody, sigHeader, WEBHOOK_SECRET);
27

28
  //     // Fetch the event data to understand the failure
29
  //     Event baseEvent = client.v2().core().events().retrieve(thinEvent.getId());
30
  //     if (baseEvent instanceof V1BillingMeterErrorReportTriggeredEvent) {
31
  //       V1BillingMeterErrorReportTriggeredEvent event =
32
  //           (V1BillingMeterErrorReportTriggeredEvent) baseEvent;
33
  //       Meter meter = event.fetchRelatedObject();
34

35
  //       String meterId = meter.getId();
36
  //       System.out.println(meterId);
37

38
  //       // Record the failures and alert your team
39
  //       // Add your logic here
40
  //     }
41

42
  //     exchange.sendResponseHeaders(200, -1);
43
  //   } catch (StripeException e) {
44
  //     exchange.sendResponseHeaders(400, -1);
45
  //   }
46
  // } else {
47
  //   exchange.sendResponseHeaders(405, -1);
48
  // }
49
  // exchange.close();
50
  // }
51
  // }
52
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc