constantcontact/java-sdk — pull request #34 by halusstefan (2014-08-08 12:03:57+00:00)
Title: Webhooks feature

Implemented helper for webhook validation and response parsing.

SDK usage (snippet from server method that consumes the POST request from Constant Contact)

```java
String sharedSecret = "";
String apiKey = "";
String accessToken = "";

ConstantContact constantContact = new ConstantContact(apiKey, accessToken, sharedSecret);

BillingChangeNotification notification = null;
try {
// Get notification object based on the x-ctct-hmac-sha256 header and the request body
notification = constantContact.getBillingChangeNotification(ctctHeader, bodyMessage);

String eventType = notification.getEventType();

// Event type check
if (eventType.contentEquals(BillingChangeNotification.EventType.TIER_INCREASE)) {
// Tier increase action
} else if (eventType.contentEquals(BillingChangeNotification.EventType.TIER_DECREASE)) {
// Tier decrease action
}

//Make use of the notification URL
notification.getUrl();
} catch (ConstantContactException e) {
//Failed because of corrupt message or parsing error
}
```