Recurly Grails API
Dependency :
compile ":recurly:0.99"
Summary
A Easy To Use Grails API to Communicate With Recurly servers. Its a grails-plugin implementation of the Recurly API. Feel Free to mail in case of any issues and enhancements.This Plugin Is Built with these points in mind:
1) Ease Of Use
2) Robustness
Installation
grails install-plugin recurly
Description
Quick Start Guide
Here is a Comprehensive Quick Start Guide For Using The Plugin.STEP-1: Installing the Plugin
To Install The Plugin Simply Dograils install-plugin recurly
STEP-2: Implementing the WebHook Listener
Recurly Provides the Push Notifications for Events that happen at recurly End.(Ex. Subscription Complete, Failed Renewal etc..)This Plugin Has Inbuilt Mechanism to Accept, Parse and Process the Notification and Call the desired Handler In The Application.Implementing handler Is a VERY SIMPLE Process. All You have to do is:- Make a Service, Lets say for an Example "RecurlyWebHookService"
- To that Service implement the interface "RecurlyWebHookListener", and Implement all Interface Methods(Your IDE Will Do that For you :) )
class RecurlyWebHookService implements RecurlyWebHookListener { static transactional = false void successfulPaymentNotificationHandler(RecurlySuccessfulPaymentWebHookNotification notification) { //Handler Code Here } void failedRenewalPaymentNotificationHandler(RecurlyFailedRenewalWebHookNotification notification) { //Handler Code Here } void cancelledSubscriptionNotificationHandler(RecurlyCanceledSubscriptionWebHookNotification notification) { //Handler Code Here } void renewedSubscriptionNotificationHandler(RecurlyRenewedSubscriptionWebHookNotification notification) { //Handler Code Here } void newSubscriptionNotificationHandler(RecurlyNewSubscriptionWebHookNotification notification) { //Handler Code Here } void expiredSubscriptionNotificationHandler(RecurlyExpiredSubscriptionWebHookNotification notification) { //Handler Code Here } void subscriptionUpdatedNotificationHandler(RecurlyChangedSubscriptionWebHookNotification notification) { //Handler Code Here } }
The Plugin automatically Parses the Notification Data. The Data Provided In the Notification Is Processed Into The Appropriate Bean. These Beans Are Passed In The Handler Methods (As Seen In Above Example)
If No WebHook Listener Is Implemented Then Plugin Will Function Normally, Only Difference Would be that All push notifications will be rejected by the plugin.
STEP-3 Configurations
Following Code Needs To Be Added To The Config.groovyrecurly {
subDomain = "yourSubDomainHere"
apiKey = "yourApiKeyHere"
webhook {
user = "user"
pass = "pass"
}
}STEP-4 Setting Up Push Notification On The Recurly Server
Login to your recurly Admin Console, There go To Push Notifications then Click On the Configure ButtonThere In the URL Enter:http://<YourAppBaseURL>/recurlyWebHook/acceptNotice?user=usernameAsSetInConfig&pass=passwordAsSetInConfig
The Plugin Currently Offers Basic Parameter Based Authentication
For Advanced Authentication(Optional), Use Spring Security Plugin And add a authenticated filter for (controller: recurlyWebHook, action: acceptNotice). And then fill in the AuthUsername and AuthPassword Fields in recurly Push Notification Settings.