Skip to content

Commit 49ef629

Browse files
Add signature handling for dLocal API requests (#485)
1 parent c605571 commit 49ef629

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

src/CheckoutSdk/Forward/Requests/DestinationRequest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Checkout.Forward.Requests.Signatures;
2+
13
namespace Checkout.Forward.Requests
24
{
35
public class DestinationRequest
@@ -17,5 +19,10 @@ public class DestinationRequest
1719
/// payment instrument you specified. For example, {{card_number}} (Required, max 16384 characters)
1820
/// </summary>
1921
public string Body { get; set; }
22+
23+
/// <summary>
24+
/// Optional configuration to add a signature to the forwarded HTTP request (Optional).
25+
/// </summary>
26+
public AbstractSignature Signature { get; set; }
2027
}
2128
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace Checkout.Forward.Requests.Signatures
2+
{
3+
public abstract class AbstractSignature
4+
{
5+
protected AbstractSignature(SignatureType type) { Type = type; }
6+
7+
/// <summary>
8+
/// The identifier of the supported signature generation method or a specific third-party service.
9+
/// (Required)
10+
/// </summary>
11+
public SignatureType? Type { get; set; }
12+
}
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace Checkout.Forward.Requests.Signatures
2+
{
3+
public class DlocalParameters
4+
{
5+
/// <summary>
6+
/// The secret key used to generate the request signature. This is part of the dLocal API credentials.
7+
/// </summary>
8+
public string SecretKey { get; set; }
9+
}
10+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace Checkout.Forward.Requests.Signatures
2+
{
3+
public class DlocalSignature
4+
{
5+
/// <summary>
6+
/// The parameters required to generate an HMAC signature for the dLocal API. See their documentation for
7+
/// details.
8+
/// This method requires you to provide the X-Login header value in the destination request headers.
9+
/// When used, the Forward API appends the X-Date and Authorization headers to the outgoing HTTP request
10+
/// before forwarding.
11+
/// </summary>
12+
public DlocalParameters DlocalParameters { get; set; }
13+
}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Runtime.Serialization;
2+
3+
namespace Checkout.Forward.Requests.Signatures
4+
{
5+
public enum SignatureType
6+
{
7+
[EnumMember(Value = "dlocal")]
8+
Dlocal,
9+
}
10+
}

0 commit comments

Comments
 (0)