Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 628
  • Last Modified:

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

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
sitg
Asked:
sitg
4 Solutions
 
gnoonCommented:
0
 
gnoonCommented:
You can try using Jarek's converter http://www.codeproject.com/Purgatory/vb2c.asp
0
 
imitchieCommented:
i'm not too tempted to help given your track record of abandoning questions..
0
 
dworltonCommented:
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
 
sitgAuthor Commented:
thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now