?
Solved

Any one Help me I want to convert vb code  to c# code

Posted on 2007-11-14
5
Medium Priority
?
610 Views
Last Modified: 2012-05-05
Public Function postSSL(ByRef oMPI As MPIData, ByRef oMerchant As Merchant, ByRef oBTA As BillToAddress, ByRef oSTA As ShipToAddress) As Object
        'Call CheckVerbose()

       Dim oPGResponse
       Set oPGResponse = New PGResponse
       oPGErrResponse = Null

        If (IsObject(oMerchant) = False) Then
            Err.Number = 12
            Err.description = "Invalid Merchant Object passed to postSSL method. Object is null or invalid. Transaction cannot proceed."
            Err.Source = "postSSL"
            Call checkErrors(Err.description)
            Set postSSL = oPGErrResponse
            Exit Function
        End If

        strMerchantTxnId = oMerchant.getMerchantTxnID()

        If (IsNull(oMerchant.getMerchantID()) Or oMerchant.getMerchantID() = "") Then
                Err.Number = 13
                Err.description = "Merchant ID is null or invalid. Transaction cannot proceed."
                Err.Source = "postSSL"
                Call checkErrors(Err.description)
                Set postSSL = oPGErrResponse
                Exit Function
        End If

        If (IsNull(oMerchant.getMessageType()) Or oMerchant.getMessageType() = "") Then
                Err.Number = 14
                Err.description = "Message Type is null or Invalid. Transaction cannot proceed."
                Err.Source = "postSSL"
                Call checkErrors(Err.description)
                Set postSSL = oPGErrResponse
                Exit Function
        End If

        Dim objXML, strData, fs, f, strurl, mypos, parturl

        'Read property File
        Call loadUrl

        'check for error in property file
        If (IsNull(oPGErrResponse)) Then
            Set postSSL = oPGResponse
        Else
            Set postSSL = oPGErrResponse
            Exit Function
        End If

        strData = buildMerchantBillShip(oMerchant, oBTA, oSTA)

        'encrypt the Data
        Dim strEncryptedData
        Set oEncryptionLib = GetObject("java:com.opus.epg.sfa.java.EPGMerchantEncryptionLib")
        strEncryptedData = oEncryptionLib.encryptMerchantData(oMerchant.getMerchantID(), strKeyDir, oMerchant.getMerchantTxnID(), oMerchant.getAmount())

        If (IsNull(strEncryptedData) Or strEncryptedData = "") Then
                Err.Number = 15
                Err.description = "Error in Encrypting Data.Transaction cannot proceed."
                Err.Source = "postSSL"
                Call checkErrors(Err.description)
                Set postSSL = oPGErrResponse
                Exit Function
        End If

        'Append Encrypted Data
        strData = strData + "&EncryptedData=" + strEncryptedData

        'Append Keys
        'strMrtId = oMerchant.getMerchantID()
        'strData = strData + getKeys(strMrtId)

        'Append OSType,LanguageType
        strData = strData + "&OsType=" + strOsType
        strData = strData + "&LanguageType=" + "asp"


        'MPI Details
        If (IsObject(oMPI)) Then
            strData = strData + "&WhatIUse=" + getValue(oMPI.getWhatIUse())
            strData = strData + "&AcceptHdr=" + getValue(oMPI.getAcceptHdr())
            strData = strData + "&UserAgent=" + getValue(oMPI.getAgentHdr())
            strData = strData + "&CurrencyVal=" + getValue(oMPI.getCurrencyVal())
            strData = strData + "&Exponent=" + getValue(oMPI.getExponent())
            strData = strData + "&RecurFreq=" + getValue(oMPI.getRecurFreq())
            strData = strData + "&RecurEnd=" + getValue(oMPI.getRecurEnd())
            strData = strData + "&Installment=" + getValue(oMPI.getInstallment())
            strData = strData + "&DeviceCategory=" + getValue(oMPI.getDeviceCategory())
            strData = strData + "&OrderDesc=" + getValue(oMPI.getOrderDesc())
            strData = strData + "&PurchaseAmount=" + getValue(oMPI.getPurchaseAmount())
            strData = strData + "&DisplayAmount=" + getValue(oMPI.getDisplayAmount())
        Else
            strData = strData + "&WhatIUse=" + getValue("")
            strData = strData + "&AcceptHdr=" + getValue("")
            strData = strData + "&UserAgent=" + getValue("")
            strData = strData + "&CurrencyVal=" + getValue("")
            strData = strData + "&Exponent=" + getValue("")
            strData = strData + "&RecurFreq=" + getValue("")
            strData = strData + "&RecurEnd=" + getValue("")
            strData = strData + "&Installment=" + getValue("")
            strData = strData + "&DeviceCategory=" + getValue("")
            strData = strData + "&OrderDesc=" + getValue("")
            strData = strData + "&PurchaseAmount=" + getValue("")
            strData = strData + "&DisplayAmount=" + getValue("")
        End If

        Dim retData
        'Checking for error before posting the data
        Call checkErrors("Error")

        If (IsNull(oPGErrResponse)) Then
            Set postSSL = oPGResponse
        Else
            Set postSSL = oPGErrResponse
            Exit Function

        End If

        'post data
        retData = postData(sslURL, strData)

        retData = Replace(retData, vbCrLf, "")
        'check for response from payment gateway
        If (Len(retData) = 0) Then
             Err.Number = 16
             Err.description = "No response From Payment Gateway or URL not Found"
             Err.Source = "postSSL"
            Call checkErrors(Err.description)
            Set postSSL = oPGErrResponse
            Exit Function
        Else
            oPGResponse.getResponse (retData)
        End If

        If (oPGResponse.getRedirectionTxnId() <> "") Then
            oPGResponse.setRedirectionUrl (sslURL + "?txnId=" + oPGResponse.getRedirectionTxnId())
        End If

        'checking for Error after posting the Data
        Call checkErrors("Error")

        If (IsNull(oPGErrResponse)) Then
            Set postSSL = oPGResponse
        Else
            Set postSSL = oPGErrResponse
        End If

    End Function
0
Comment
Question by:sitg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Assisted Solution

by:gnoon
gnoon earned 1200 total points
ID: 20287402
0
 
LVL 16

Accepted Solution

by:
gnoon earned 1200 total points
ID: 20287462
You can try using Jarek's converter http://www.codeproject.com/Purgatory/vb2c.asp
0
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 240 total points
ID: 20287988
i'm not too tempted to help given your track record of abandoning questions..
0
 
LVL 6

Assisted Solution

by:dworlton
dworlton earned 60 total points
ID: 20289773
Don't forget this one: http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22962214.html

The other sad thing is he is probably getting paid by some company in the U.S. to convert their VB code to C#.
0
 

Author Comment

by:sitg
ID: 20310393
thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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