Scenario 6: Groovy

From Intrannuity

Jump to: navigation, search

Download Source File

import ibilling.client.*
 
class Scenario6 {
 
 static void main(args) {
			//Set up clients' settings
	def config  = [:]
	config[SessionConnection.PROCESSOR_HOST] = "http://server.ibillingclient.org/ibilling/xmlhttps"
	config["debug"] = true
	//Login
	def session  = Session.login(2000, "welcome", config)
	//Find payment plan
	def paymentPlan  = session.loadPaymentPlan("groovy.pp-1")
	//Execute delete last 6 charges
	paymentPlan.removeRange(5, 6)
	//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
		println(ex.message)
		return ;
	}
	//Logout
	session.logout()
 
	}
 
}
Personal tools