Dim SRead As New IO.StreamReader("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name)
strLine = SRead.ReadLine()
strLine = SRead.ReadLine()
strLine = SRead.ReadLine()
theProgressCount = 2
Do While Not strLine Is Nothing
LineArray = Split(strLine, """,""", -1)
theProgressCount + 1
For i = 0 To UBound(LineArray)
theFieldValue = Replace(LineArray(i), """", "")
Select Case i
Case 0
If theFieldValue = "##END##" Then
End If
theAccountReferrence = Validation.FReturnString(theFieldValue, 22)
Case 1
theAccountName = Validation.FReturnString(theFieldValue, 49)
Case 2
theBankAccountName = Validation.FReturnString(theFieldValue, 49)
Case 3
theAccountType = Validation.FReturnNumber(theFieldValue, 1)
Case 4
theBranchCode = Validation.FillBranchCode(theFieldValue)
Case 5
theBankAccountNumber = Validation.FReturnNumber(theFieldValue, 16)
Case 6
theContractAmount = theFieldValue / 100
Case 7
theBatchAmount = theFieldValue / 100
Case 8
If Validation.FEmailVerify(theFieldValue) = False Then
theEmail = ""
Else
theEmail = theFieldValue
End If
Case 9
theNameOnCC = Validation.FReturnString(theFieldValue, 49)
Case 10
theNumberOnCC = Validation.FReturnNumber(theFieldValue, 16)
Case 11
theMonthExpires = Validation.FReturnNumber(theFieldValue, 2)
Case 12
theYearExpires = Validation.FReturnNumber(theFieldValue, 4)
Case 13
theCardType = Validation.FReturnNumber(theFieldValue, 1)
Case 14
IsCreditCard = Validation.FReturnNumber(theFieldValue, 1)
Case 15
theExtra1 = theFieldValue
Case 16
theExtra2 = theFieldValue
Case 17
theExtra3 = theFieldValue
End Select
Next
If IsCreditCard = 0 Then
VReturn = 0
VReturn = Validation.CDVValidateAccount(theBankAccountNumber, theBranchCode, theAccountType)
If VReturn <> 0 Then
ErrorDetected = True
Select Case VReturn
Case 0
theErrorText = "OK"
Case 1
theErrorText = "INVALID BRANCH CODE"
Case 2
theErrorText = "INVALID ACCOUNT NO"
Case 3
theErrorText = "INVALID ACCOUNT TYPE"
End Select
'MsgBox(theAccountReferrence & " : " & theAccountType & " : " & theBranchCode & " : " & theBankAccountNumber)
theErrorString = theErrorString & "Acc Ref :" & theAccountReferrence & " Line : " & theProgressCount & " has a CDV Error No : " & VReturn & " - " & theErrorText & vbCrLf
End If
VReturn = 0
Else
Select Case theCardType
Case "1"
theStrCardType = "MasterCard"
Case "2"
theStrCardType = "Visa"
Case "3"
theStrCardType = "AMEX"
Case "4"
theStrCardType = "Diners"
Case Else
theStrCardType = "0"
End Select
If Validation.FIsCreditCard(theStrCardType, theNumberOnCC) = False Then
ErrorDetected = True
theErrorString = theErrorString & "Line : " & theProgressCount & " has an Invalid Credit Card Number : " & vbCrLf
End If
End If
strLine = SRead.ReadLine()
Loop
SRead.Close()
GC.Collect()
If ErrorDetected = True Then
theErrorString = theErrorString & "Please check your documentation to see the explanation for the error codes." & vbCrLf & vbCrLf & "Thank You" & vbCrLf & "Netcash"
Mailer.SendMail(ReplyMail, ReplyMail, "103 CDV Check return from Netcash. ", "Your data has failed the CDV check. Below you will see the records that have failed." & vbCrLf & vbCrLf & theErrorString)
Mailer.SendMail(NetcashSupportMail, NetcashSupportMail, "103 CDV Check return from Netcash. ", "Your data has failed the CDV check. Below you will see the records that have failed." & vbCrLf & vbCrLf & theErrorString)
'Select Case Err.Number
' Case 0 'no error
' 'MsgBox("allok")
' Case Else
' MsgBox("An error occurred: " + Err.Description + " " + Err.Number + " " + Err.HelpContext)
' End
'End Select
Else
Mailer.SendMail(ReplyMail, ReplyMail, "102 CDV Check Complete. Updates and/or Batch queued to follow. ", "Your File has run through the CDV successfully. Please remember that if you have sent us a batch instruction, that it will need to be authorized online. " & vbCrLf & vbCrLf & "Thank You" & vbCrLf & "Netcash")
'Mailer.SendMail(NetcashSupportMail, NetcashSupportMail, "102 CDV Check Complete. Updates and/or Batch queued to follow. ", "Your File has run through the CDV successfully. Please remember that if you have sent us a batch instruction, that it will need to be authorized online. " & vbCrLf & vbCrLf & "Thank You" & vbCrLf & "Netcash")
End If
Select Case whatToDo
Case "V"
'theFile.Delete()
OFile.Delete("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name)
Case "B"
OFile.Move("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name, "C:\Netcash\DebitProcessor\3_MasterBatch\" & theFile.Name)
IO.File.Move("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name, "C:\Netcash\DebitProcessor\3_MasterBatch\" & theFile.Name)
Case "C"
IO.File.Move("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name, "C:\Netcash\DebitProcessor\3_MasterBatch\" & theFile.Name)
End Select