From Intrannuity
Download Source File
Imports System
Imports System.Collections.Generic
Imports iBilling.Client
Module Scenario5
Sub Main()
'Set up clients' settings
Dim config = new Dictionary(Of String, Object)()
config(SessionConnection.PROCESSOR_HOST) = "http://server.ibillingclient.org/ibilling/xmlhttps"
config("debug") = true
'Login
Dim _session = Session.Login(2000, "welcome", config)
'execute find payment plan
Dim paymentPlan = _session.LoadPaymentPlan("vb.pp-3")
Dim charge = paymentPlan.Charges(1)
charge.IsPrepaid = true
'get customer account
Dim customerAccount = paymentPlan.CustomerAccount
'Create payment for downpayment
Dim transaction = customerAccount.CreateAssetTransaction()
'code is optinal; if you specify the value, make sure the code is unique
transaction.Code = "vb.at-5"
'all amounts are in cents
transaction.Amount = 3000
'Type of transaction
transaction.AccountActivityType = AccountActivityTypes.Payment
transaction.TransactionType = AssetTransactionTypes.Check
'check number
transaction.AccountNumber = "10100125687"
transaction.IsPrepayment = true
transaction.DueDate = charge.BillingDate
'Mark object for persistence
_session.Save(customerAccount)
'Synchronize changes with the server
Try
_session.Synchronize()
Catch ex As Exception
'Be sure to properly handle exception, this is just a sample solution
Console.WriteLine(ex.Message)
Exit Sub
End Try
'Logout
_session.Logout()
End Sub
End Module