Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/co/dfns/sdk/DfnsAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import co.dfns.sdk.feesponsors.FeeSponsorsAsyncClient;
import co.dfns.sdk.keys.KeysAsyncClient;
import co.dfns.sdk.networks.NetworksAsyncClient;
import co.dfns.sdk.payins.PayinsAsyncClient;
import co.dfns.sdk.payouts.PayoutsAsyncClient;
import co.dfns.sdk.permissions.PermissionsAsyncClient;
import co.dfns.sdk.policies.PoliciesAsyncClient;
import co.dfns.sdk.signers.SignersAsyncClient;
import co.dfns.sdk.staking.StakingAsyncClient;
import co.dfns.sdk.swaps.SwapsAsyncClient;
import co.dfns.sdk.vaults.VaultsAsyncClient;
import co.dfns.sdk.wallets.WalletsAsyncClient;
import co.dfns.sdk.webhooks.WebhooksAsyncClient;

Expand All @@ -27,12 +29,14 @@ public class DfnsAsyncClient implements AutoCloseable {
public final FeeSponsorsAsyncClient feeSponsors;
public final KeysAsyncClient keys;
public final NetworksAsyncClient networks;
public final PayinsAsyncClient payins;
public final PayoutsAsyncClient payouts;
public final PermissionsAsyncClient permissions;
public final PoliciesAsyncClient policies;
public final SignersAsyncClient signers;
public final StakingAsyncClient staking;
public final SwapsAsyncClient swaps;
public final VaultsAsyncClient vaults;
public final WalletsAsyncClient wallets;
public final WebhooksAsyncClient webhooks;

Expand All @@ -45,12 +49,14 @@ public DfnsAsyncClient(DfnsClientConfig config) {
this.feeSponsors = new FeeSponsorsAsyncClient(httpClient);
this.keys = new KeysAsyncClient(httpClient);
this.networks = new NetworksAsyncClient(httpClient);
this.payins = new PayinsAsyncClient(httpClient);
this.payouts = new PayoutsAsyncClient(httpClient);
this.permissions = new PermissionsAsyncClient(httpClient);
this.policies = new PoliciesAsyncClient(httpClient);
this.signers = new SignersAsyncClient(httpClient);
this.staking = new StakingAsyncClient(httpClient);
this.swaps = new SwapsAsyncClient(httpClient);
this.vaults = new VaultsAsyncClient(httpClient);
this.wallets = new WalletsAsyncClient(httpClient);
this.webhooks = new WebhooksAsyncClient(httpClient);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/co/dfns/sdk/DfnsClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import co.dfns.sdk.feesponsors.FeeSponsorsClient;
import co.dfns.sdk.keys.KeysClient;
import co.dfns.sdk.networks.NetworksClient;
import co.dfns.sdk.payins.PayinsClient;
import co.dfns.sdk.payouts.PayoutsClient;
import co.dfns.sdk.permissions.PermissionsClient;
import co.dfns.sdk.policies.PoliciesClient;
import co.dfns.sdk.signers.SignersClient;
import co.dfns.sdk.staking.StakingClient;
import co.dfns.sdk.swaps.SwapsClient;
import co.dfns.sdk.vaults.VaultsClient;
import co.dfns.sdk.wallets.WalletsClient;
import co.dfns.sdk.webhooks.WebhooksClient;

Expand All @@ -27,12 +29,14 @@ public class DfnsClient implements AutoCloseable {
public final FeeSponsorsClient feeSponsors;
public final KeysClient keys;
public final NetworksClient networks;
public final PayinsClient payins;
public final PayoutsClient payouts;
public final PermissionsClient permissions;
public final PoliciesClient policies;
public final SignersClient signers;
public final StakingClient staking;
public final SwapsClient swaps;
public final VaultsClient vaults;
public final WalletsClient wallets;
public final WebhooksClient webhooks;

Expand All @@ -45,12 +49,14 @@ public DfnsClient(DfnsClientConfig config) {
this.feeSponsors = new FeeSponsorsClient(httpClient);
this.keys = new KeysClient(httpClient);
this.networks = new NetworksClient(httpClient);
this.payins = new PayinsClient(httpClient);
this.payouts = new PayoutsClient(httpClient);
this.permissions = new PermissionsClient(httpClient);
this.policies = new PoliciesClient(httpClient);
this.signers = new SignersClient(httpClient);
this.staking = new StakingClient(httpClient);
this.swaps = new SwapsClient(httpClient);
this.vaults = new VaultsClient(httpClient);
this.wallets = new WalletsClient(httpClient);
this.webhooks = new WebhooksClient(httpClient);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/co/dfns/sdk/DfnsDelegatedAsyncClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import co.dfns.sdk.feesponsors.DelegatedFeeSponsorsAsyncClient;
import co.dfns.sdk.keys.DelegatedKeysAsyncClient;
import co.dfns.sdk.networks.DelegatedNetworksAsyncClient;
import co.dfns.sdk.payins.DelegatedPayinsAsyncClient;
import co.dfns.sdk.payouts.DelegatedPayoutsAsyncClient;
import co.dfns.sdk.permissions.DelegatedPermissionsAsyncClient;
import co.dfns.sdk.policies.DelegatedPoliciesAsyncClient;
import co.dfns.sdk.signers.DelegatedSignersAsyncClient;
import co.dfns.sdk.staking.DelegatedStakingAsyncClient;
import co.dfns.sdk.swaps.DelegatedSwapsAsyncClient;
import co.dfns.sdk.vaults.DelegatedVaultsAsyncClient;
import co.dfns.sdk.wallets.DelegatedWalletsAsyncClient;
import co.dfns.sdk.webhooks.DelegatedWebhooksAsyncClient;

Expand All @@ -31,12 +33,14 @@ public class DfnsDelegatedAsyncClient implements AutoCloseable {
public final DelegatedFeeSponsorsAsyncClient feeSponsors;
public final DelegatedKeysAsyncClient keys;
public final DelegatedNetworksAsyncClient networks;
public final DelegatedPayinsAsyncClient payins;
public final DelegatedPayoutsAsyncClient payouts;
public final DelegatedPermissionsAsyncClient permissions;
public final DelegatedPoliciesAsyncClient policies;
public final DelegatedSignersAsyncClient signers;
public final DelegatedStakingAsyncClient staking;
public final DelegatedSwapsAsyncClient swaps;
public final DelegatedVaultsAsyncClient vaults;
public final DelegatedWalletsAsyncClient wallets;
public final DelegatedWebhooksAsyncClient webhooks;

Expand All @@ -49,12 +53,14 @@ public DfnsDelegatedAsyncClient(DfnsClientConfig config) {
this.feeSponsors = new DelegatedFeeSponsorsAsyncClient(httpClient);
this.keys = new DelegatedKeysAsyncClient(httpClient);
this.networks = new DelegatedNetworksAsyncClient(httpClient);
this.payins = new DelegatedPayinsAsyncClient(httpClient);
this.payouts = new DelegatedPayoutsAsyncClient(httpClient);
this.permissions = new DelegatedPermissionsAsyncClient(httpClient);
this.policies = new DelegatedPoliciesAsyncClient(httpClient);
this.signers = new DelegatedSignersAsyncClient(httpClient);
this.staking = new DelegatedStakingAsyncClient(httpClient);
this.swaps = new DelegatedSwapsAsyncClient(httpClient);
this.vaults = new DelegatedVaultsAsyncClient(httpClient);
this.wallets = new DelegatedWalletsAsyncClient(httpClient);
this.webhooks = new DelegatedWebhooksAsyncClient(httpClient);
}
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/co/dfns/sdk/DfnsDelegatedClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@
import co.dfns.sdk.feesponsors.DelegatedFeeSponsorsClient;
import co.dfns.sdk.keys.DelegatedKeysClient;
import co.dfns.sdk.networks.DelegatedNetworksClient;
import co.dfns.sdk.payins.DelegatedPayinsClient;
import co.dfns.sdk.payouts.DelegatedPayoutsClient;
import co.dfns.sdk.permissions.DelegatedPermissionsClient;
import co.dfns.sdk.policies.DelegatedPoliciesClient;
import co.dfns.sdk.signers.DelegatedSignersClient;
import co.dfns.sdk.staking.DelegatedStakingClient;
import co.dfns.sdk.swaps.DelegatedSwapsClient;
import co.dfns.sdk.vaults.DelegatedVaultsClient;
import co.dfns.sdk.wallets.DelegatedWalletsClient;
import co.dfns.sdk.webhooks.DelegatedWebhooksClient;

Expand All @@ -31,12 +33,14 @@ public class DfnsDelegatedClient implements AutoCloseable {
public final DelegatedFeeSponsorsClient feeSponsors;
public final DelegatedKeysClient keys;
public final DelegatedNetworksClient networks;
public final DelegatedPayinsClient payins;
public final DelegatedPayoutsClient payouts;
public final DelegatedPermissionsClient permissions;
public final DelegatedPoliciesClient policies;
public final DelegatedSignersClient signers;
public final DelegatedStakingClient staking;
public final DelegatedSwapsClient swaps;
public final DelegatedVaultsClient vaults;
public final DelegatedWalletsClient wallets;
public final DelegatedWebhooksClient webhooks;

Expand All @@ -49,12 +53,14 @@ public DfnsDelegatedClient(DfnsClientConfig config) {
this.feeSponsors = new DelegatedFeeSponsorsClient(httpClient);
this.keys = new DelegatedKeysClient(httpClient);
this.networks = new DelegatedNetworksClient(httpClient);
this.payins = new DelegatedPayinsClient(httpClient);
this.payouts = new DelegatedPayoutsClient(httpClient);
this.permissions = new DelegatedPermissionsClient(httpClient);
this.policies = new DelegatedPoliciesClient(httpClient);
this.signers = new DelegatedSignersClient(httpClient);
this.staking = new DelegatedStakingClient(httpClient);
this.swaps = new DelegatedSwapsClient(httpClient);
this.vaults = new DelegatedVaultsClient(httpClient);
this.wallets = new DelegatedWalletsClient(httpClient);
this.webhooks = new DelegatedWebhooksClient(httpClient);
}
Expand Down
32 changes: 32 additions & 0 deletions src/main/java/co/dfns/sdk/payins/DelegatedPayinsAsyncClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package co.dfns.sdk.payins;

import co.dfns.sdk.internal.DfnsHttpClient;
import co.dfns.sdk.payins.model.*;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import co.dfns.sdk.auth.UserActionChallenge;
import co.dfns.sdk.auth.CredentialAssertion;

public class DelegatedPayinsAsyncClient {
private final DfnsHttpClient httpClient;

public DelegatedPayinsAsyncClient(DfnsHttpClient httpClient) {
this.httpClient = httpClient;
}

/** Get Payin Recipient */
public CompletableFuture<GetPayinRecipientResponse> getPayinRecipient(GetPayinRecipientQuery query) {
return httpClient.getAsync("/payins/recipients", query.toMap(), GetPayinRecipientResponse.class);
}

/** Delegated signing step 1 for Register Payin Recipient: returns the challenge to sign out-of-band. */
public CompletableFuture<UserActionChallenge> registerPayinRecipientInit(Object body) {
return httpClient.createUserActionChallengeAsync("POST", "/payins/recipients", body);
}

/** Delegated signing step 2 for Register Payin Recipient: submits the signed challenge and issues the request. */
public CompletableFuture<RegisterPayinRecipientResponse> registerPayinRecipientComplete(Object body, String challengeIdentifier, CredentialAssertion assertion) {
return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion)
.thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/payins/recipients", java.util.Map.of(), body, RegisterPayinRecipientResponse.class, userAction));
}
}
31 changes: 31 additions & 0 deletions src/main/java/co/dfns/sdk/payins/DelegatedPayinsClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package co.dfns.sdk.payins;

import co.dfns.sdk.internal.DfnsHttpClient;
import co.dfns.sdk.payins.model.*;
import java.util.Map;
import co.dfns.sdk.auth.UserActionChallenge;
import co.dfns.sdk.auth.CredentialAssertion;

public class DelegatedPayinsClient {
private final DfnsHttpClient httpClient;

public DelegatedPayinsClient(DfnsHttpClient httpClient) {
this.httpClient = httpClient;
}

/** Get Payin Recipient */
public GetPayinRecipientResponse getPayinRecipient(GetPayinRecipientQuery query) {
return httpClient.get("/payins/recipients", query.toMap(), GetPayinRecipientResponse.class);
}

/** Delegated signing step 1 for Register Payin Recipient: returns the challenge to sign out-of-band. */
public UserActionChallenge registerPayinRecipientInit(Object body) {
return httpClient.createUserActionChallenge("POST", "/payins/recipients", body);
}

/** Delegated signing step 2 for Register Payin Recipient: submits the signed challenge and issues the request. */
public RegisterPayinRecipientResponse registerPayinRecipientComplete(Object body, String challengeIdentifier, CredentialAssertion assertion) {
String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion);
return httpClient.executeWithUserAction("POST", "/payins/recipients", java.util.Map.of(), body, RegisterPayinRecipientResponse.class, userAction);
}
}
24 changes: 24 additions & 0 deletions src/main/java/co/dfns/sdk/payins/PayinsAsyncClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package co.dfns.sdk.payins;

import co.dfns.sdk.internal.DfnsHttpClient;
import co.dfns.sdk.payins.model.*;
import java.util.Map;
import java.util.concurrent.CompletableFuture;

public class PayinsAsyncClient {
private final DfnsHttpClient httpClient;

public PayinsAsyncClient(DfnsHttpClient httpClient) {
this.httpClient = httpClient;
}

/** Get Payin Recipient */
public CompletableFuture<GetPayinRecipientResponse> getPayinRecipient(GetPayinRecipientQuery query) {
return httpClient.getAsync("/payins/recipients", query.toMap(), GetPayinRecipientResponse.class);
}

/** Register Payin Recipient */
public CompletableFuture<RegisterPayinRecipientResponse> registerPayinRecipient(Object body) {
return httpClient.postAsync("/payins/recipients", java.util.Map.of(), body, RegisterPayinRecipientResponse.class, true);
}
}
23 changes: 23 additions & 0 deletions src/main/java/co/dfns/sdk/payins/PayinsClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package co.dfns.sdk.payins;

import co.dfns.sdk.internal.DfnsHttpClient;
import co.dfns.sdk.payins.model.*;
import java.util.Map;

public class PayinsClient {
private final DfnsHttpClient httpClient;

public PayinsClient(DfnsHttpClient httpClient) {
this.httpClient = httpClient;
}

/** Get Payin Recipient */
public GetPayinRecipientResponse getPayinRecipient(GetPayinRecipientQuery query) {
return httpClient.get("/payins/recipients", query.toMap(), GetPayinRecipientResponse.class);
}

/** Register Payin Recipient */
public RegisterPayinRecipientResponse registerPayinRecipient(Object body) {
return httpClient.post("/payins/recipients", java.util.Map.of(), body, RegisterPayinRecipientResponse.class, true);
}
}
33 changes: 33 additions & 0 deletions src/main/java/co/dfns/sdk/payins/model/GetPayinRecipientQuery.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package co.dfns.sdk.payins.model;

import java.util.HashMap;
import java.util.Map;

public class GetPayinRecipientQuery {
private String provider;
private String walletId;
private String currency;

public GetPayinRecipientQuery provider(String provider) {
this.provider = provider;
return this;
}

public GetPayinRecipientQuery walletId(String walletId) {
this.walletId = walletId;
return this;
}

public GetPayinRecipientQuery currency(String currency) {
this.currency = currency;
return this;
}

public Map<String, String> toMap() {
Map<String, String> map = new HashMap<>();
if (provider != null) map.put("provider", String.valueOf(provider));
if (walletId != null) map.put("walletId", String.valueOf(walletId));
if (currency != null) map.put("currency", String.valueOf(currency));
return map;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.dfns.sdk.payins.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonIgnoreProperties(ignoreUnknown = true)
public record GetPayinRecipientResponse(
@JsonProperty("provider") String provider,
@JsonProperty("walletId") String walletId,
@JsonProperty("currency") String currency,
@JsonProperty("status") String status,
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("recipientAddressId") String recipientAddressId
) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package co.dfns.sdk.payins.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonInclude;

@JsonIgnoreProperties(ignoreUnknown = true)
public record RegisterPayinRecipientResponse(
@JsonProperty("provider") String provider,
@JsonProperty("walletId") String walletId,
@JsonProperty("currency") String currency,
@JsonProperty("status") String status,
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonProperty("recipientAddressId") String recipientAddressId
) {}
Loading
Loading