Solved

credit card processing and returned ASCII value

Posted on 2003-11-13
19
560 Views
Last Modified: 2007-12-19
hey, i am converting my old asp classic form to .NET and dealing with the whole credit card processing for the first time via .NET. i have got it all working now and my data is returned back from me from the credit card processor in a POST stream.

the only problem is that the data is returned back in ASCII format with no commas or quotation marks. it looks just like this:

ssl_result=0 ssl_result_message=APPROVED ssl_txn_id=00000000-0000-0000-0000-000000000000 ssl_approval_code=123456 ssl_cvv2_response=P ssl_avs_response=X ssl_transaction_type=SALE ssl_amount=53

how can i parse this without commas so that i can populate my SQL Server database?
0
Comment
Question by:trevoray
  • 11
  • 8
19 Comments
 

Author Comment

by:trevoray
ID: 9743156
the processor is Viaklix. does anyone work with Viaklix?
0
 

Author Comment

by:trevoray
ID: 9743327
and for some reason, when i display the results in a textbox, it knows when to do a return after each entry, so that the textbox looks like this:

ssl_result=0
ssl_result_message=APPROVED
ssl_txn_id=00000000-0000-0000-0000-000000000000
ssl_approval_code=123456
ssl_cvv2_response=P
ssl_avs_response=X
ssl_transaction_type=SALE
ssl_amount=53

0
 
LVL 9

Expert Comment

by:malharone
ID: 9743392
how about this ... real working example!!

Imports System.Text.RegularExpressions

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(296, 16)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(152, 88)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Continue"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(8, 16)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(264, 72)
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = "ssl_result=0 ssl_result_message=APPROVED ssl_txn_id=00000000-0000-0000-0000-00000" & _
        "0000000 ssl_approval_code=123456 ssl_cvv2_response=P ssl_avs_response=X ssl_tran" & _
        "saction_type=SALE ssl_amount=53 "
        '
        'ListView1
        '
        Me.ListView1.AllowColumnReorder = True
        Me.ListView1.FullRowSelect = True
        Me.ListView1.GridLines = True
        Me.ListView1.HoverSelection = True
        Me.ListView1.Location = New System.Drawing.Point(16, 136)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(400, 136)
        Me.ListView1.TabIndex = 2
        Me.ListView1.View = System.Windows.Forms.View.Details
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(472, 302)
        Me.Controls.Add(Me.ListView1)
        Me.Controls.Add(Me.TextBox1)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim rx As New Regex("(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s (?<ssl_result_message>ssl_result_message) =      (?<ssl_result_message_Value> .*)\s (?<ssl_txn_id>ssl_txn_id) =      (?<ssl_txn_id_Value> .* )\s (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> .* )\s", RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
        Dim match As Match = rx.Match(Me.TextBox1.Text)
        If match.Groups.Count Mod 2 = 0 Then
            MessageBox.Show("Missing parameters")
        Else
            Me.ListView1.Columns.Add("Parameter", Me.ListView1.Width / 2, HorizontalAlignment.Center)
            Me.ListView1.Columns.Add("Value", Me.ListView1.Width / 2, HorizontalAlignment.Center)
            Dim gp As Group
            Dim x As Short = (match.Groups.Count / 2)
            Dim y As Short
            For y = 1 To x
                With Me.ListView1.Items.Add(match.Groups(y * 2 - 1).Value)
                    .SubItems.Add(match.Groups(y * 2).Value)
                End With
            Next
        End If
    End Sub
End Class
0
 
LVL 9

Expert Comment

by:malharone
ID: 9743538
Note:
(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s (?<ssl_result_message>ssl_result_message) =      (?<ssl_result_message_Value> .*)\s (?<ssl_txn_id>ssl_txn_id) =      (?<ssl_txn_id_Value> .* )\s (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> \d+ ) \s?
((?<ParamName> [a-zA-Z0-9_]+) = (?<ParamName_Value>[a-zA-Z0-9_]+) \s*)*

will match additional parameters
eg. it'll match (anytherParameter1=value1 anytherParameter2=value2) from

ssl_result=abc ssl_result_message=NOT_APPROVED ssl_txn_id=123-456-7890-123456 ssl_approval_code=9999999999AAANNN!!! ssl_cvv2_response=P ssl_avs_response=X ssl_transaction_type=SALE ssl_amount=5323 anytherParameter1=value1 anytherParameter2=value2

'just a little improvement
'-----------------------------
Imports System.Text.RegularExpressions

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.ListView1 = New System.Windows.Forms.ListView
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Button1.Location = New System.Drawing.Point(352, 8)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(112, 72)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Parse ..."
        '
        'TextBox1
        '
        Me.TextBox1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.TextBox1.Location = New System.Drawing.Point(8, 8)
        Me.TextBox1.Multiline = True
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
        Me.TextBox1.Size = New System.Drawing.Size(336, 72)
        Me.TextBox1.TabIndex = 1
        Me.TextBox1.Text = "ssl_result=abc ssl_result_message=NOT_APPROVED ssl_txn_id=123-456-7890-123456 ssl" & _
        "_approval_code=9999999999AAANNN!!! ssl_cvv2_response=P ssl_avs_response=X ssl_tr" & _
        "ansaction_type=SALE ssl_amount=5323"
        '
        'ListView1
        '
        Me.ListView1.AllowColumnReorder = True
        Me.ListView1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.ListView1.FullRowSelect = True
        Me.ListView1.GridLines = True
        Me.ListView1.HoverSelection = True
        Me.ListView1.Location = New System.Drawing.Point(8, 88)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(456, 208)
        Me.ListView1.TabIndex = 2
        Me.ListView1.View = System.Windows.Forms.View.Details
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(472, 302)
        Me.Controls.Add(Me.ListView1)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.TextBox1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim rx As New Regex("(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s (?<ssl_result_message>ssl_result_message) =      (?<ssl_result_message_Value> .*)\s (?<ssl_txn_id>ssl_txn_id) =      (?<ssl_txn_id_Value> .* )\s (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> .* )", RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
        'Dim rx As New Regex("(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s (?<ssl_result_message>ssl_result_message) =      (?<ssl_result_message_Value> .*)\s (?<ssl_txn_id>ssl_txn_id) =      (?<ssl_txn_id_Value> .* )\s (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> \d+ ) \s?((?<ParamName> [a-zA-Z0-9_]+) = (?<ParamName_Value>[a-zA-Z0-9_]+) \s*)*", _
        '            RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
        Dim match As Match = rx.Match(Me.TextBox1.Text)
        Me.ListView1.Columns.Clear()
        Me.ListView1.Items.Clear()


        If False Then ' match.Groups.Count Mod 2 = 0 Then
            MessageBox.Show("Missing parameters")
        Else
            Me.ListView1.Columns.Add("Parameter", Me.ListView1.Width / 2, HorizontalAlignment.Center)
            Me.ListView1.Columns.Add("Value", Me.ListView1.Width / 2, HorizontalAlignment.Center)
            Dim gp As Group
            Dim x As Short = (match.Groups.Count / 2)
            Dim y As Short
            For y = 1 To x
                With Me.ListView1.Items.Add(match.Groups(y * 2 - 1).Value)
                    .SubItems.Add(match.Groups(y * 2).Value)
                End With
            Next
        End If
    End Sub
End Class
0
 

Author Comment

by:trevoray
ID: 9743629
wow, overload!!  i do not have enough resources to handle all of that!  :)

thanks for the code.

ok, my data is returned back to me from the processor in a string variable. the main help i need is taking that string variable and parsing it, then putting it into my SQL Database. Can you show me how to do that with your code?

thanks!
0
 
LVL 9

Expert Comment

by:malharone
ID: 9743754
do you know how to execute the SQL statement from your vb code? (e.g. establishing connection, creating adapters, sql command etc).. or do you also want me to write you a code that does the insertion as well as parsing.
if so, i'm gonna need the name of the table, and the names of the columns where you'd like this data to be inserted.

- malhar
0
 
LVL 9

Expert Comment

by:malharone
ID: 9743941
below is the code that does both .. note it is for win forms ... so some of the things i've done are not supported in asp. forexample, messagebox or msgbox is not supported in asp. so you'll have to come up with your error handling technique. you'll also have to use YOUR connection string, and apprpriate column names before you can use the functions. the acutal function is: Button2_Click. the code inside Button2_Click calls the function "saveInfoToDatabase" with the right parameters.


-- hope this helps

malhar

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    dim rx As New Regex("(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s (?<ssl_result_message>ssl_result_message) =     (?<ssl_result_message_Value> .*)\s (?<ssl_txn_id>ssl_txn_id) =     (?<ssl_txn_id_Value> .* )\s (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> .* )", RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)

        Dim match As Match = rx.Match("ssl_result=abc ssl_result_message=NOT_APPROVED ssl_txn_id=123-456-7890-123456 ssl_approval_code=9999999999AAANNN!!! ssl_cvv2_response=P ssl_avs_response=X ssl_transaction_type=SALE ssl_amount=5323")
        Dim mySQLStr As String
        Dim ssl_result_Value, ssl_result_message_Value, ssl_txn_id_Value, ssl_approval_code_Value, ssl_cvv2_response_Value, ssl_avs_response_Value, ssl_transaction_type_Value, ssl_amount_Value As String
        ssl_result_Value = match.Groups("ssl_result_Value").Value
        ssl_result_message_Value = match.Groups("ssl_result_message_Value").Value
        ssl_txn_id_Value = match.Groups("ssl_txn_id_Value").Value
        ssl_approval_code_Value = match.Groups("ssl_approval_code_Value").Value
        ssl_cvv2_response_Value = match.Groups("ssl_cvv2_response_Value").Value
        ssl_avs_response_Value = match.Groups("ssl_avs_response_Value").Value
        ssl_transaction_type_Value = match.Groups("ssl_transaction_type_Value").Value
        ssl_amount_Value = match.Groups("ssl_amount_Value").Value
        Try
            mySQLStr = "insert into YOUR_TABLE_NAME (ssl_result_Value_columnName,ssl_result_message_Value_columnName , ssl_txn_id_Value_columnName, ssl_approval_code_Value_columnName,ssl_cvv2_response_Value_columnName ,ssl_avs_response_Value_columnName,ssl_transaction_type_Value_columnName,ssl_amount_Value_columnName) values (" & _
                                            "'" & ssl_result_Value & "', '" & ssl_result_message_Value & "', '" & ssl_txn_id_Value & "', '" & ssl_approval_code_Value & "', '" & ssl_cvv2_response_Value & "', '" & ssl_avs_response_Value & "', '" & ssl_transaction_type_Value & "', '" & ssl_amount_Value & "')"
            MsgBox(mySQLStr)   '<------ can not use msgbox in asp
            If saveInfoToDatabase(mySQLStr) Then
                MessageBox.Show("Saved")   '<------ can not use messagebox.show in asp
            Else
                MessageBox.Show("Not saved")   '<------ can not use messagebox.show in asp
            End If
        Catch ex As Exception
            MsgBox("error occured")    '<------ can not use msgbox in asp
        End Try
    End Sub


    Public Function saveInfoToDatabase(ByVal insertString As String) As Boolean
        saveInfoToDatabase = False
        Dim ds As New DataSet()
        Try
            Dim myConn As New SqlConnection("YOUR CONNECTION STRING")
            Dim mySC As New SqlCommand(insertString, myConn)
            Dim adp As New SqlDataAdapter(mySC)
            adp.Fill(ds)
            saveInfoToDatabase = True
        Catch ex As Exception
            MessageBox.Show("error occured - " & ex.ToString)
        End Try
    End Function
0
 

Author Comment

by:trevoray
ID: 9744145
ok, thanks. i get these errors...

type 'Regex' is not defined

type 'Match' is not defined

i am fine with writing the sql connection, etc.

thanks!
0
 
LVL 9

Expert Comment

by:malharone
ID: 9744431
you'll need to add "imports System.Text.RegularExpressions" in the beginning

so
----------------------------------
option explicit on
option strict on

imports System.Text.RegularExpressions
imports .... other imports
public class class1
  ... stuff
end class
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 9

Expert Comment

by:malharone
ID: 9744451
or do the following

right click on your project from the solution explorer, and select Add References. From the ".net refernces" select "System.Text.RegularExpressions".
0
 

Author Comment

by:trevoray
ID: 9744691
ok, thanks! that took away those errors.

i am having a hard time understanding this part...

Dim match As Match = rx.Match("ssl_result=abc ssl_result_message=NOT_APPROVED ssl_txn_id=123-456-7890-123456 ssl_approval_code=9999999999AAANNN!!! ssl_cvv2_response=P ssl_avs_response=X ssl_transaction_type=SALE ssl_amount=5323")


the string is all spelled out. i will not know what the string results are in my code. how will i know what to write, when i will just have my string?
0
 

Author Comment

by:trevoray
ID: 9747436
ok, i got past my last question, i just placed my string in the match box and that did the trick.

BUT, the parsing is not taking out all the extra spaces. this is my returned test sql statement:

insert into YOUR_TABLE_NAME (ssl_result_Value_columnName,ssl_result_message_Value_columnName , ssl_txn_id_Value_columnName, ssl_approval_code_Value_columnName,ssl_cvv2_response_Value_columnName ,ssl_avs_response_Value_columnName,ssl_transaction_type_Value_columnName,ssl_amount_Value_columnName) values ('0
', 'APPROVED
', '00000000-0000-0000-0000-000000000000
', '123456
', 'P
', 'X
', 'SALE
', '53
')


how do i get rid of these extra spaces?

thanks!
0
 
LVL 9

Expert Comment

by:malharone
ID: 9749458
i dont see the extra spaces. if you're wondering about the space between
ssl_cvv2_response_Value_columnName ,ssl_avs_response_Value_columnName
                                                        |____________________________________<<< this extra space, then you should not care about it . those are ignored by your SQL parser.
or you can force it to trim your answers

e.g
        ssl_result_Value = trim(match.Groups("ssl_result_Value").Value)
        ssl_result_message_Value = trim(match.Groups("ssl_result_message_Value").Value)
        ssl_txn_id_Value = trim(match.Groups("ssl_txn_id_Value").Value)
        ssl_approval_code_Value = trim(match.Groups("ssl_approval_code_Value").Value)
        ssl_cvv2_response_Value = trim(match.Groups("ssl_cvv2_response_Value").Value)
        ssl_avs_response_Value = trim(match.Groups("ssl_avs_response_Value").Value)
        ssl_transaction_type_Value = trim(match.Groups("ssl_transaction_type_Value").Value)
        ssl_amount_Value = trim(match.Groups("ssl_amount_Value").Value)
0
 
LVL 9

Expert Comment

by:malharone
ID: 9749483
i'm assuming your columns are all type string/varchar/nvarchar . so when create the output string, i'm appending the single quotation mark.
e.g. insert into tableDemo(firstName, lastName) values ('John','Markson')

but if you were to insert a number you would NOT add quotation marks .. so it'd be like this

insert into tableDemo(firstName,lastName,age) values ('John','Markson',20)
0
 

Author Comment

by:trevoray
ID: 9749516
ok, i see, so just to clarify SQL doesn't care if i have this with the extra spaces?

INSERT INTO myTable (ss_result, ssl_result_message) VALUES ('APPROVED                                                                    ', 'CREDIT CARD APPROVED                                                                             ')

?
0
 
LVL 9

Expert Comment

by:malharone
ID: 9749572
TGIF!

if you're gonna have more than one space separating the columns or params ... then you should change the regular expression. but if you don't change the regular expresion, my suggestion above for trimming your values will trim leading and following spaces .. so
let's say
dim myString as string  = "    John Markson         "
msgbox (trim(myString) )         ---- would give you "John Markson" without the quotes!!

but here's a different approach ... it's upto your taste! :)  i've changed \s to \s+  .. (\s means ignore 1 space ... \s+ means ignore 1 or more spaces)

dim rx As New Regex("(?<ssl_result>ssl_result) = (?<ssl_result_Value> .*)\s+ (?<ssl_result_message>ssl_result_message) =     (?<ssl_result_message_Value> .*)\s+ (?<ssl_txn_id>ssl_txn_id) =     (?<ssl_txn_id_Value> .* )\s+ (?<ssl_approval_code>ssl_approval_code) = (?<ssl_approval_code_Value> .* )\s+ (?<ssl_cvv2_response>ssl_cvv2_response) = (?<ssl_cvv2_response_Value> .* )\s+ (?<ssl_avs_response>ssl_avs_response) = (?<ssl_avs_response_Value> .* )\s+ (?<ssl_transaction_type>ssl_transaction_type) = (?<ssl_transaction_type_Value> .* )\s+ (?<ssl_amount>ssl_amount) = (?<ssl_amount_Value> .* )", RegexOptions.IgnoreCase Or RegexOptions.Multiline Or RegexOptions.IgnorePatternWhitespace Or RegexOptions.Compiled)
0
 

Author Comment

by:trevoray
ID: 9749776
ok, something weird is happening. it's placing some sort of hidden soft return after the values and i guess adding the + after the s doesn't take care of it. do you have any idea what this is? i have my results populated in a text box and it automatically goes to the next line after each value.  ??

insert into YOUR_TABLE_NAME (ssl_result_Value_columnName,ssl_result_message_Value_columnName , ssl_txn_id_Value_columnName, ssl_approval_code_Value_columnName,ssl_cvv2_response_Value_columnName ,ssl_avs_response_Value_columnName,ssl_transaction_type_Value_columnName,ssl_amount_Value_columnName) values ('0
', 'APPROVED
', '00000000-0000-0000-0000-000000000000
', '123456
', 'P
', 'X
', 'SALE
', '53
')
0
 
LVL 9

Expert Comment

by:malharone
ID: 9749912
what you can do is ....  this will replace all the "non-visible" carriage return characters with a zero lenght string.

string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,chr(13),"")
string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,chr(10),"")
string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,vbcrlf,"")

good luck
0
 
LVL 9

Accepted Solution

by:
malharone earned 500 total points
ID: 9749918
oops .. mistake

YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY=string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,chr(13),"")
YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY=string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,chr(10),"")
YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY=string.replace(YOUR_STRING_VALUE_FROM_CREDIT_CARD_COMPANY,vbcrlf,"")
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now