• Maria Montgomery
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
I am trying to re-write the following VB function in Apex:


Private Shared Function sign(ByVal data As String, ByVal secretKey As String) As String

    Dim encoder As New System.Text.UTF8Encoding
    Dim key() As Byte = encoder.GetBytes(secretKey)
    Dim dataAsBytes() As Byte = encoder.GetBytes(data)

    Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(key)
    Dim HashCode As Byte() = myHMACSHA256.ComputeHash(dataAsBytes)

    Return Convert.ToBase64String(HashCode)

End Function


can anyone help me?
Hi everyone,

I need to figure out how to make calls to Cybersource for payments and refunds in Apex, and I have the credentials to do so, but I'm not sure how to implement it.

Does anyone have any sample/simple code that accomplishes one of these? I don't know how to build the request and the errors I receive are all 'XML Parsing Error'.

Any help at all would be great.