CardEaseXML COM/ActiveX VB.NET Example Code
Imports CardEaseXML
Imports System.Console
Module Module1
Sub Main()
If Not My.Application.CommandLineArgs.Count = 2 Then
WriteLine("Usage: " + System.Diagnostics.Process.GetCurrentProcess().ProcessName + " TerminalID TransactionKey")
WriteLine()
WriteLine("The TerminalID and TransactionKey are provided at registration:")
WriteLine()
WriteLine(" https://testwebmis.creditcall.com")
WriteLine()
WriteLine("Press Enter to continue . . .")
ReadKey()
Exit Sub
End If
Dim client As CClient
client = New CClient
' Setup the request
With client.Request
.SoftwareName = "SoftwareName"
.SoftwareVersion = "SoftwareVersion"
.TerminalID = My.Application.CommandLineArgs.Item(0)
.TransactionKey = My.Application.CommandLineArgs.Item(1)
' Setup the request detail
.RequestType = RequestType.Auth
.Amount = "123"
.PAN = "341111597241002"
.ExpiryDate = "2012"
End With
WriteLine(client.Request.ToString())
' Setup the client
client.AddServerURL("https://test.cardeasexml.com/generic.cex", 45000)
' Process the request
Dim processResult As ProcessResult
processResult = client.ProcessRequest()
If processResult = processResult.ClientOK Then
WriteLine(client.Response.ToString())
Else
WriteLine("CLIENT ERROR: " + client.LastErrorDescription)
WriteLine("REQUEST ERROR: " + client.Request.LastErrorDescription)
End If
End Sub
End Module
|