B4J=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=10
@EndOfDesignText@
'Handler class
Sub Class_Globals
	
End Sub

Public Sub Initialize
	
End Sub

Sub Handle(req As ServletRequest, resp As ServletResponse)
	Try
		Dim mp As Map
		mp.Initialize
		
		Dim StreamReader As TextReader
		StreamReader.Initialize(req.InputStream)
		Dim str_bin As String
		str_bin = StreamReader.ReadAll
		
		Dim Reader As TextReader
		Reader.Initialize(File.OpenInput(File.DirApp, "bin-list-data.csv"))
		Dim line As String
		line = Reader.ReadLine
		Do While line <> Null
			
			Dim str_line() As String
			str_line = Regex.Split(",",line)
			
			If str_line(0) = str_bin Then
				Log(str_line(0))
				Log(str_line(1))
				Log(str_line(2))
				Log(str_line(3))
				Log(str_line(4))
				Log(str_line(5))
				Log(line)
				
				mp.Put("bin",str_line(0))
				mp.Put("Brand",str_line(1))
				mp.Put("Type",str_line(2))
				mp.Put("Category",str_line(3))
				mp.Put("Issuer",str_line(4))
				mp.Put("IssuerPhone",str_line(5))
				mp.Put("IssuerUrl",str_line(6))
				mp.Put("isoCode2",str_line(7))
				mp.Put("isoCode3",str_line(8))
				mp.Put("CountryName",str_line(9))
				
				Exit
			End If
			
			line = Reader.ReadLine
		Loop
		Reader.Close
		
		Dim js As JSONGenerator
		js.Initialize(mp)
		
		Log(js.ToString)
		
		resp.Write(js.ToString)
	Catch
		Log(LastException)
	End Try
End Sub