I'm using sample code from the Test project to calculate the signature and check if the push message is valid. But I can't get it to work.
This is my test code
// JSON push as it is received by the client system.
try
{
SdkClient BuckarooClient = new SdkClient();
PushHandler pushHandler = BuckarooClient.GetPushHandler("xkduEg374bs63nsiGFs");
var bodyAsBytes = Encoding.UTF8.GetBytes(requestBody); // DEZE IS BELANGRIJK: BERICHT AS BYTE[]
// calculate UNIX time
var epochStart = new DateTime(1970, 01, 01, 0, 0, 0, 0, DateTimeKind.Utc);
var timeSpan = DateTime.UtcNow - epochStart;
var requestTimeStamp = Convert.ToUInt64(timeSpan.TotalSeconds).ToString();
// create random nonce for each request
var pushSignature = BuckarooClient.GetSignatureCalculationService().CalculateSignature(bodyAsBytes, HttpMethod.Post.ToString(),
requestTimeStamp, Guid.NewGuid().ToString("N"),
"https://5rmj616c-7142.euw.devtunnels.ms/api/BuckarooPush?code=rP_gjf0lzLaP8a1vn99A0-mLd-eM9V3enM1JgjAxFFVBAzFuB3uxAQ==", "ahpfM7jwcb", "xkduEg374bs63nsiGFs");
var authorizationheader = $"hmac {pushSignature}"; // DEZE IS BELANGRIJK: SIGNATURE
// Function that returns a structured push, based on the JSON pushed that is received.
var push = pushHandler.DeserializePush(bodyAsBytes, "https://5rmj616c-7142.euw.devtunnels.ms/api/BuckarooPush?code=rP_gjf0lzLaP8a1vn99A0-mLd-eM9V3enM1JgjAxFFVBAzFuB3uxAQ==", authorizationheader);
var service = push.GetServices();
var responseData = push.GetActionResponse<IdealPayPush>();
}
catch (Exception ex)
{
string s = ex.ToString();
}
And this is the error I'm receiving:
System.Security.Authentication.AuthenticationException: System error.
at BuckarooSdk.Base.PushHandler.DeserializePush(Byte[] body, String requestUri, String authorizationHeader)
Can anybody point me in the right directory on how to handle this?
I'm using sample code from the Test project to calculate the signature and check if the push message is valid. But I can't get it to work.
This is my test code
And this is the error I'm receiving:
System.Security.Authentication.AuthenticationException: System error.
at BuckarooSdk.Base.PushHandler.DeserializePush(Byte[] body, String requestUri, String authorizationHeader)
Can anybody point me in the right directory on how to handle this?