Last updated by kushal.likhi 7 months ago
grails install-plugin recurly
Last updated by kushal.likhi 7 months ago
Quick Start Guide
Here is a Comprehensive Quick Start Guide For Using The Plugin.
STEP-1: Installing the Plugin
To Install The Plugin Simply Do
grails 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 :) )
Hurray… Now this Service will be automatically registered as the handler for webHookEvents. And the Implemented Methods will Act as the handler to a particular event, The
Name Of the Methods are Self Explanatory to tell what event they will handle.
Hurray! Was't that simpleEXAMPLE SERVICE:
Just to show how your service will look like:
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
Leave
AuthUsername and
AuthPassword,
Blank For Basic Implementation.
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.
Last updated by kushal.likhi 7 months ago
Last updated by kushal.likhi 7 months ago