Scenario 8: Java

From Intrannuity

Jump to: navigation, search

Download Source File

import ibilling.client.*
import java.util.*

public class Scenario8 {

  public static void main(String[] args) {
        //Set up clients' settings
    Map<String, Object> config  = new HashMap<String, Object>();
    config.put(SessionConnection.PROCESSOR_HOST, "http://server.ibillingclient.org/ibilling/xmlhttps");
    config.put("debug"true);
    //Login
    Session session  = Session.login(2000"welcome", config);
    //Find payment plan
    PaymentPlan paymentPlan  = session.loadPaymentPlan("java.pp-2");
    //Add 2 freeze after first week
    paymentPlan.add(12true);
    //Mark object for persistence
    session.save(paymentPlan);
    //Synchronize changes with the server
    try{
      session.synchronize();
    }
    catch(Exception ex){
      //Be sure to properly handle exception, this is just a sample solution
      System.out.println(ex.getMessage());
      return;    
      }
    //Logout
    session.logout();

  }

}


Download Source File

Personal tools