constantcontact/java-sdk — pull request #35 by halusstefan (2014-08-11 08:34:08+00:00)
Title: Webhook Notifications

Implemented Webhook Notifications into separare core object

Usage:

```java
//The secret key provided by ConstantContact along with the API KEY
String sharedSecret = "";

//Utility class used for validation and parsing the Constant Contact webhooks notifications
CTCTWebhookUtil webhookUtil = new CTCTWebhookUtil(sharedSecret);

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

//make use of notification event type.
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 URL in the notification
String url = notification.getUrl();

} catch (ConstantContactException e) {
//Webhook notification is corrupt or a parsing error occurred. See e.getMessage() for details.
}
```