Skip to content

Commit 29c9a76

Browse files
Jure Markozb-sr
Jure Marko
authored andcommitted
IT-1948: added cashout inform operation
1 parent 29953ea commit 29c9a76

File tree

7 files changed

+114
-1
lines changed

7 files changed

+114
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System.Text.Json.Serialization;
2+
3+
namespace Sportradar.Mbs.Sdk.Entities.Common;
4+
5+
/// <summary>
6+
/// Represents validation object.
7+
/// </summary>
8+
public class CashoutInformValidation
9+
{
10+
/// <summary>
11+
/// Gets or sets the code.
12+
/// </summary>
13+
[JsonPropertyName("code")]
14+
public int? Code { get; set; }
15+
16+
/// <summary>
17+
/// Gets or sets the message.
18+
/// </summary>
19+
[JsonPropertyName("message")]
20+
public string? Message { get; set; }
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Text.Json.Serialization;
2+
using Sportradar.Mbs.Sdk.Entities.Common;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Request;
5+
6+
/// <summary>
7+
/// Represents a request to acknowledge a cashout inform.
8+
/// </summary>
9+
public class CashoutInformRequest : ContentRequestBase
10+
{
11+
[JsonInclude]
12+
[JsonPropertyName("type")]
13+
private string Type => "cashout-inform";
14+
15+
/// <summary>
16+
/// Gets or sets the cashout object.
17+
/// </summary>
18+
[JsonPropertyName("cashout")]
19+
public CashoutRequest? Cashout { get; set; }
20+
21+
/// <summary>
22+
/// Gets or sets the cashout inform validation object.
23+
/// </summary>
24+
[JsonPropertyName("validation")]
25+
public CashoutInformValidation? Validation{ get; set; }
26+
27+
}

src/Sportradar.Mbs.Sdk/Entities/Request/ContentRequestBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public override ContentRequestBase Read(ref Utf8JsonReader reader, Type typeToCo
3535
"withdrawal-inform" => JsonSerializer.Deserialize<WithdrawalInformRequest>(root.GetRawText()),
3636
"ext-settlement-ack" => JsonSerializer.Deserialize<ExtSettlementAckRequest>(root.GetRawText()),
3737
"balance-change-inform" => JsonSerializer.Deserialize<BalanceChangeInformRequest>(root.GetRawText()),
38+
"cashout-inform" => JsonSerializer.Deserialize<CashoutInformRequest>(root.GetRawText()),
3839
_ => throw new JsonException("Unknown type of ContentRequestBase: " + type)
3940
};
4041
return result ?? throw new NullReferenceException("Null ContentRequestBase: " + type);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System.Text.Json.Serialization;
2+
using Sportradar.Mbs.Sdk.Entities.Common;
3+
4+
namespace Sportradar.Mbs.Sdk.Entities.Response;
5+
6+
/// <summary>
7+
/// Represents a response object for a cashout inform.
8+
/// </summary>
9+
public class CashoutInformResponse : ContentResponseBase
10+
{
11+
[JsonInclude]
12+
[JsonPropertyName("type")]
13+
private string Type => "cashout-inform-reply";
14+
15+
/// <summary>
16+
/// Gets or sets the code of the cashout inform response.
17+
/// </summary>
18+
[JsonPropertyName("code")]
19+
public int Code { get; set; }
20+
21+
/// <summary>
22+
/// Gets or sets the signature of the cashout inform response.
23+
/// </summary>
24+
[JsonPropertyName("signature")]
25+
public string? Signature { get; set; }
26+
27+
/// <summary>
28+
/// Gets or sets the cashout ID of the cashout inform response.
29+
/// </summary>
30+
[JsonPropertyName("cashoutId")]
31+
public string? CashoutId { get; set; }
32+
33+
/// <summary>
34+
/// Gets or sets the message of the cashout inform response.
35+
/// </summary>
36+
[JsonPropertyName("message")]
37+
public string? Message { get; set; }
38+
39+
/// <summary>
40+
/// Gets or sets the ticket ID of the cashout inform response.
41+
/// </summary>
42+
[JsonPropertyName("ticketId")]
43+
public string? TicketId { get; set; }
44+
45+
/// <summary>
46+
/// Gets or sets the status of the cashout inform response.
47+
/// </summary>
48+
[JsonPropertyName("status")]
49+
public AcceptanceStatus? Status { get; set; }
50+
}

src/Sportradar.Mbs.Sdk/Entities/Response/ContentResponseBase.cs

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ public override ContentResponseBase Read(ref Utf8JsonReader reader, Type typeToC
3636
"cashout-ack-reply" => JsonSerializer.Deserialize<CashoutAckResponse>(root.GetRawText()),
3737
"ticket-reply" => JsonSerializer.Deserialize<TicketResponse>(root.GetRawText()),
3838
"withdrawal-inform-reply" => JsonSerializer.Deserialize<WithdrawalInformResponse>(root.GetRawText()),
39+
"cashout-inform-reply" => JsonSerializer.Deserialize<CashoutInformResponse>(root.GetRawText()),
3940
_ => throw new JsonException("Unknown type of ContentResponseBase: " + type)
4041
};
4142
return result ?? throw new NullReferenceException("Null ContentResponseBase: " + type);

src/Sportradar.Mbs.Sdk/Internal/Protocol/ProtocolProvider.ITicketProtocol.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public async Task<CancelResponse> SendCancelAsync(CancelRequest request)
2727
{
2828
return await ProcessRequestAsync<CancelResponse>("ticket-cancel", request).ConfigureAwait(false);
2929
}
30-
30+
3131
public async Task<CancelAckResponse> SendCancelAckAsync(CancelAckRequest request)
3232
{
3333
return await ProcessRequestAsync<CancelAckResponse>("ticket-cancel-ack", request).ConfigureAwait(false);
@@ -37,6 +37,11 @@ public async Task<CashoutResponse> SendCashoutAsync(CashoutRequest request)
3737
{
3838
return await ProcessRequestAsync<CashoutResponse>("ticket-cashout", request).ConfigureAwait(false);
3939
}
40+
41+
public async Task<CashoutInformResponse> SendCashoutInformAsync(CashoutInformRequest request)
42+
{
43+
return await ProcessRequestAsync<CashoutInformResponse>("cashout-inform", request).ConfigureAwait(false);
44+
}
4045

4146
public async Task<CashoutAckResponse> SendCashoutAckAsync(CashoutAckRequest request)
4247
{

src/Sportradar.Mbs.Sdk/Protocol/ITicketProtocol.cs

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ public interface ITicketProtocol
4848
/// <exception cref="SdkException">Thrown when operation has failed.</exception>
4949
Task<CancelAckResponse> SendCancelAckAsync(CancelAckRequest request);
5050

51+
/// <summary>
52+
/// Sends a cashout inform request asynchronously.
53+
/// </summary>
54+
/// <param name="request">The cashout inform request to send.</param>
55+
/// <returns>A task that represents the asynchronous operation. The task result contains the cashout inform response.</returns>
56+
/// <exception cref="SdkException">Thrown when operation has failed.</exception>
57+
Task<CashoutInformResponse> SendCashoutInformAsync(CashoutInformRequest request);
58+
5159
/// <summary>
5260
/// Sends a cashout request asynchronously.
5361
/// </summary>

0 commit comments

Comments
 (0)