Solved

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

Posted on 2007-11-14
5
586 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
Comment Utility
0
 
LVL 16

Accepted Solution

by:
gnoon earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

12 Experts available now in Live!

Get 1:1 Help Now