Added payment gateway ledger service to payments feature
This commit is contained in:
@@ -1,13 +1,10 @@
|
||||
using LiteCharms.Features.Hasher;
|
||||
using LiteCharms.Features.Models;
|
||||
using static LiteCharms.Features.Extensions.Hash;
|
||||
|
||||
namespace LiteCharms.Features.Tests;
|
||||
|
||||
public class HashServiceFeatureTests(Fixture fixture) : IClassFixture<Fixture>
|
||||
{
|
||||
private readonly HashService hashService = fixture.Services.GetRequiredService<HashService>();
|
||||
private readonly string payfastPassphrase = fixture.Configuration.GetSection("HasherSettings:PayfastPassphrase").Value!;
|
||||
|
||||
[Fact]
|
||||
public void StringToSha256Hash_Should_GenerateHash()
|
||||
@@ -62,28 +59,6 @@ public class HashServiceFeatureTests(Fixture fixture) : IClassFixture<Fixture>
|
||||
Assert.Equal(expectedMd5Lowercase, result.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void VerifyPayfastWebhookSignature_Should_GenerateHash()
|
||||
{
|
||||
var paymentId = hashService.HashEncodeLongId(1001).Value;
|
||||
|
||||
var payload = new PayfastWebhookPayload
|
||||
{
|
||||
Amount = "350.00",
|
||||
ItemName = "System Architecture Book",
|
||||
MPaymentId = paymentId,
|
||||
};
|
||||
|
||||
var rawPayload = payload.ToRawPayfastPayload(payfastPassphrase);
|
||||
|
||||
var generatedSignature = HashService.ToMd5Hash(rawPayload).Value;
|
||||
|
||||
var result = hashService.VerifyPayfastWebhookSignature(payload, generatedSignature);
|
||||
|
||||
Assert.True(result.IsSuccess);
|
||||
Assert.True(result.Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HashEncodeHex_Should_GenerateHash()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user