Implemented overload taking in IFormCollection
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-06-01 17:02:30 +02:00
parent 5eb6dbc8b2
commit ac31c6ada8
2 changed files with 19 additions and 0 deletions
+17
View File
@@ -82,4 +82,21 @@ public static class Hash
return (payload, passphrase);
}
public static (PayfastWebhookPayload Payload, string Passphrase) FromRawPayfastPayload(this IFormCollection form)
{
string passphrase = string.Empty;
var payload = new PayfastWebhookPayload();
if (form.IsNullOrEmpty()) return (payload, passphrase);
payload = new PayfastWebhookPayload
{
Amount = form.TryGetValue("amount", out var amountValues) ? amountValues.ToString() : null,
ItemName = form.TryGetValue("item_name", out var itemValues) ? itemValues.ToString() : null,
MPaymentId = form.TryGetValue("m_payment_id", out var paymentIdValues) ? paymentIdValues.ToString() : null,
};
return (payload, passphrase);
}
}