protected virtual void ControlPointQueryResponseSignature(PointQueryResponse pointQueryResponse, string secretKey, string version) { var transactionId = (!string.IsNullOrEmpty(pointQueryResponse.TransactionId) ? pointQueryResponse.TransactionId : String.Empty); var transactionTime = (!string.IsNullOrEmpty(pointQueryResponse.TransactionTime) ? pointQueryResponse.TransactionTime : String.Empty); var currency = (!string.IsNullOrEmpty(pointQueryResponse.Currency) ? pointQueryResponse.Currency : String.Empty); //var installment = (pointQueryResponse.Installment.HasValue ? pointQueryResponse.Installment.Value.ToString() : String.Empty); var messageCode = pointQueryResponse.MessageCode; var text = secretKey + transactionId + transactionTime + pointQueryResponse.PointBalance + currency + messageCode; //+ installment + messageCode; string signature; if (version == "1.1") { signature = CryptographyHelper.HMacSha512(text, secretKey); } else { signature = CryptographyHelper.HashSha256(text); } if (signature != pointQueryResponse.Signature) { throw new DpayClientException(Constants.SignatureVerificationError, Constants.SignatureVerificationError.ReturnErrorMessage(), Constants.SignatureVerificationError.ReturnUserErrorMessage()); } }
protected override void ControlPointQueryResponseSignature(PointQueryResponse pointQueryResponse, string secretKey, string version) { }
public TestablePointQueryProcessor(PointQueryResponse pointQueryResponse) { _pointQueryResponse = pointQueryResponse; }