Skip to content

Commit

Permalink
Add max stake operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Srđan Tot authored and zb-sr committed Dec 4, 2024
1 parent 7c04a12 commit 881b3aa
Show file tree
Hide file tree
Showing 6 changed files with 253 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
@JsonSubTypes.Type(value = CancelAckRequest.class, name = "cancel-ack"),
@JsonSubTypes.Type(value = WithdrawalInformRequest.class, name = "withdrawal-inform"),
@JsonSubTypes.Type(value = ExtSettlementAckRequest.class, name = "ext-settlement-ack"),
@JsonSubTypes.Type(value = BalanceChangeInformRequest.class, name = "balance-change-inform")
@JsonSubTypes.Type(value = BalanceChangeInformRequest.class, name = "balance-change-inform"),
@JsonSubTypes.Type(value = MaxStakeRequest.class, name = "max-stake")
})
public class ContentRequest {

Expand Down Expand Up @@ -156,4 +157,13 @@ public static BalanceChangeInformRequest.Builder newBalanceChangeInformRequestBu
return BalanceChangeInformRequest.newBuilder();
}

/**
* Creates a new instance of the MaxStakeRequest builder.
*
* @return The MaxStakeRequest builder.
*/
public static MaxStakeRequest.Builder newMaxStakeRequestBuilder() {
return MaxStakeRequest.newBuilder();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package com.sportradar.mbs.sdk.entities.request;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Represents a max stake request.
*/
public class MaxStakeRequest extends ContentRequest {

@JsonProperty("ticket")
private TicketRequest ticket;

/**
* Gets the ticket for the request.
*
* @return The ticket for the request.
*/
public TicketRequest getTicket() {
return this.ticket;
}

/**
* Sets the ticket for the request.
*
* @param value The ticket for the request.
*/
public void setTicket(TicketRequest value) {
this.ticket = value;
}


/**
* Creates a new instance of the MaxStakeRequest.Builder class.
*
* @return A new instance of the MaxStakeRequest.Builder class.
*/
public static Builder newBuilder() {
return new Builder();
}

/**
* Builder class for creating instances of the MaxStakeRequest class.
*/
public static class Builder {

private final MaxStakeRequest instance = new MaxStakeRequest();

private Builder() {
}

/**
* Builds the MaxStakeRequest instance.
*
* @return The built MaxStakeRequest instance.
*/
public MaxStakeRequest build() {
return this.instance;
}

/**
* Sets the ticket for the request.
*
* @param value The ticket for the request.
* @return The Builder instance.
*/
public Builder setTicket(TicketRequest value) {
this.instance.setTicket(value);
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
@JsonSubTypes.Type(value = ExtSettlementResponse.class, name = "ext-settlement-reply"),
@JsonSubTypes.Type(value = CashoutAckResponse.class, name = "cashout-ack-reply"),
@JsonSubTypes.Type(value = TicketResponse.class, name = "ticket-reply"),
@JsonSubTypes.Type(value = WithdrawalInformResponse.class, name = "withdrawal-inform-reply")
@JsonSubTypes.Type(value = WithdrawalInformResponse.class, name = "withdrawal-inform-reply"),
@JsonSubTypes.Type(value = MaxStakeResponse.class, name = "max-stake-reply")
})
public class ContentResponse {

Expand Down Expand Up @@ -164,4 +165,14 @@ public static TicketResponse.Builder newTicketResponseBuilder() {
public static WithdrawalInformResponse.Builder newWithdrawalInformResponseBuilder() {
return WithdrawalInformResponse.newBuilder();
}

/**
* Creates a new instance of the MaxStakeResponse builder.
*
* @return The MaxStakeResponse builder.
*/
public static MaxStakeResponse.Builder newMaxStakeResponseBuilder() {
return MaxStakeResponse.newBuilder();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
package com.sportradar.mbs.sdk.entities.response;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.sportradar.mbs.sdk.entities.common.Bet;

/**
* Represents a response for max stake.
*/
public class MaxStakeResponse extends ContentResponse {

@JsonProperty("code")
private int code;
@JsonProperty("bets")
private Bet[] bets;
@JsonProperty("message")
private String message;

/**
* Gets the code of the response.
*
* @return The code of the response.
*/
public int getCode() {
return this.code;
}

/**
* Sets the code of the response.
*
* @param value The code of the response.
*/
public void setCode(int value) {
this.code = value;
}

/**
* Gets bets.
*
* @return bets.
*/
public Bet[] getBets() {
return this.bets;
}

/**
* Sets bets.
*
* @param value bets.
*/
public void setBets(Bet[] value) {
this.bets = value;
}

/**
* Gets the message.
*
* @return The message.
*/
public String getMessage() {
return this.message;
}

/**
* Sets the message.
*
* @param value The message.
*/
public void setMessage(String value) {
this.message = value;
}

/**
* Creates a new instance of the MaxStakeResponse.Builder class.
*
* @return A new instance of the MaxStakeResponse.Builder class.
*/
public static Builder newBuilder() {
return new Builder();
}

/**
* Represents a builder for creating instances of the MaxStakeResponse class.
*/
public static class Builder {

private final MaxStakeResponse instance = new MaxStakeResponse();

private Builder() {
}

/**
* Builds and returns the MaxStakeResponse instance.
*
* @return The MaxStakeResponse instance.
*/
public MaxStakeResponse build() {
return this.instance;
}

/**
* Sets the code of the response.
*
* @param value The code of the response.
* @return The builder instance.
*/
public Builder setCode(int value) {
this.instance.setCode(value);
return this;
}

/**
* Sets bets.
*
* @param value Bets.
* @return The builder instance.
*/
public Builder setBets(Bet... value) {
this.instance.setBets(value);
return this;
}

/**
* Sets the message.
*
* @param value The message.
* @return The builder instance.
*/
public Builder setMessage(String value) {
this.instance.setMessage(value);
return this;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ public CompletableFuture<ExtSettlementResponse> sendExtSettlementAsync(final Ext
public CompletableFuture<ExtSettlementAckResponse> sendExtSettlementAckAsync(final ExtSettlementAckRequest request) {
return engine.execute("ticket-ext-settlement-ack", request, ExtSettlementAckResponse.class);
}

@Override
public CompletableFuture<MaxStakeResponse> sendMaxStakeAsync(MaxStakeRequest request) {
return engine.execute("max-stake", request, MaxStakeResponse.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ default ExtSettlementAckResponse sendExtSettlementAck(ExtSettlementAckRequest re
return this.sendExtSettlementAckAsync(request).get();
}

/**
* Sends a max stake request synchronously and returns the corresponding response.
*
* @param request the max stake request to be sent
* @return the max stake response received
* @throws ExecutionException if the execution of the request encounters an exception wrapping the cause exception
* @throws InterruptedException if the execution of the request is interrupted
*/
default MaxStakeResponse sendMaxStake(MaxStakeRequest request)
throws ExecutionException, InterruptedException {
return this.sendMaxStakeAsync(request).get();
}

/**
* Sends a ticket request asynchronously and returns a CompletableFuture representing the response.
*
Expand Down Expand Up @@ -221,4 +234,12 @@ default ExtSettlementAckResponse sendExtSettlementAck(ExtSettlementAckRequest re
* @return a CompletableFuture representing the external settlement acknowledgment response
*/
CompletableFuture<ExtSettlementAckResponse> sendExtSettlementAckAsync(ExtSettlementAckRequest request);

/**
* Sends a max stake request asynchronously and returns a CompletableFuture representing the response.
*
* @param request the max stake request to be sent
* @return a CompletableFuture representing the max stake response
*/
CompletableFuture<MaxStakeResponse> sendMaxStakeAsync(MaxStakeRequest request);
}

0 comments on commit 881b3aa

Please sign in to comment.