Solved

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

Posted on 2007-11-14
5
595 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
5 Comments
 
LVL 16

Assisted Solution

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

Accepted Solution

by:
gnoon earned 400 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 80 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 20 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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