Creating JBilling Plugins

Jbilling can be extended with its plugin architecture to customize the way Jbilling behaves.
All Jbilling plugins must extend the PluggableTask abstract class(com.sapienter.jbilling.server.pluggableTask.PluggableTask) and implement specific category interface summarized below:

Name Interface Description
Order Processing OrderProcessingTask Calculates total amount for an order. we usually use this plugin to add taxes.
Order Filter OrderFilterTask Checks if an order should be included in a particular invoice
Invoice filter InvoiceFilterTask Checks if an invoice with an outstanding balance should be carried over to a new invoice
Invoice composition InvoiceCompositionTask Creates an invoice based on outstanding invoices or orders
Order Period OrderPeriodTask Calculates start and end time for an order.
Payment Gateway PaymentTask Submits payments to a payment system like credit card, checks, paypal.
Notification NotificationTask Send notification to a customer. examples: SMS, email or print to mail.
Payment method PaymentInfoTask Selects a payment method to be used to submit to gateways.
Interests PenaltyTask Checks if penalty/interests should be included for a carried invoice and the amount.
Gateway down alarm ProcessorAlarm Notification if a payment gateway is down.Example: notify NOC for network connectivity to paypal.
User subscription status manager ISubscriptionStatusManager User state manager for transitions between different status for a user.
Asynchronous payment parameters IAsyncPaymentParameters Can add additional parameters to handle distributed payment types.
Item Management IItemPurchaseManager Does the functionality of adding an item to an order. you can extend it to add additional items or modify the order. very useful to handle bundles.
Item pricing IPricing Gives an item its price. This is the place to implement your own rating engine or get tax information from external systems.
Mediation record reader IMediationReader Reads records from a source. Example: you can extend it to read session records from a freeradius database.
Mediation processor IMediationProcess Takes records from mediation record reader and translates them into items and identifies users for these events

Please check JBilling SVN for each classes’ method.

Your customized JBilling plugin must extend pluggabletask abstract class and implement one of the interfaces above.

An Example:

import com.sapienter.jbilling.server.notification.MessageDTO;
import com.sapienter.jbilling.server.pluggableTask.NotificationTask;
import com.sapienter.jbilling.server.pluggableTask.PluggableTask;
import com.sapienter.jbilling.server.pluggableTask.TaskException;
import com.sapienter.jbilling.server.user.db.UserDTO;
public class OSINotificationExample extends PluggableTask implements NotificationTask {
@Override

public void deliver(UserDTO user, MessageDTO message) throws TaskException {
// your implementation
}
}

Next post will provide more information on loading your plugin into JBilling

Tags: , , ,

Leave a Reply