Solved

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

Posted on 2007-11-14
5
587 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

947 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

21 Experts available now in Live!

Get 1:1 Help Now