-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlategaClientExtensions.ApiMethods.cs
More file actions
44 lines (41 loc) · 1.35 KB
/
PlategaClientExtensions.ApiMethods.cs
File metadata and controls
44 lines (41 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using Platega.IO.Requests.Payments;
using Platega.IO.Types;
using Platega.IO.Types.Enums;
namespace Platega.IO;
public static partial class CryptoPayClientExtensions
{
public static async Task<CreatedTransaction> CreatePaymentLink(
this IPlategaClient apiClient,
PaymentMethod paymentMethod,
decimal amount,
Currency currency,
string description,
Uri? returnUri = default,
Uri? failedUri = default,
string? payload = default,
CancellationToken cancellationToken = default)
{
return await apiClient.SendRequest<CreatedTransaction>(
new CreatePaymentLinkRequest()
{
PaymentMethod = paymentMethod,
PaymentDetails = new()
{
Amount = amount,
Currency = currency,
},
Description = description,
Return = returnUri,
FailedUrl = failedUri,
Payload = payload,
}, cancellationToken);
}
public static async Task<Transaction> GetTransaction(
this IPlategaClient apiClient,
Guid id,
CancellationToken cancellationToken = default)
{
return await apiClient.SendRequest<Transaction>(
new GetTransactionRequest(id), cancellationToken);
}
}