Skip to content

Latest commit

 

History

History
991 lines (720 loc) · 41.3 KB

File metadata and controls

991 lines (720 loc) · 41.3 KB

SDKWalletsV1

(wallets().v1())

Overview

Available Operations

confirmHold

Confirm a hold

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.ConfirmHoldRequest;
import com.formance.formance_sdk.models.operations.ConfirmHoldResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;
import java.math.BigInteger;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        ConfirmHoldRequest req = ConfirmHoldRequest.builder()
                .holdId("<id>")
                .confirmHoldRequest(com.formance.formance_sdk.models.shared.ConfirmHoldRequest.builder()
                    .amount(new BigInteger("100"))
                    .final_(true)
                    .build())
                .build();

        ConfirmHoldResponse res = sdk.wallets().v1().confirmHold()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request ConfirmHoldRequest ✔️ The request object to use for the request.

Response

ConfirmHoldResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

createBalance

Create a balance

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.CreateBalanceRequest;
import com.formance.formance_sdk.models.operations.CreateBalanceResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        CreateBalanceRequest req = CreateBalanceRequest.builder()
                .id("<id>")
                .build();

        CreateBalanceResponse res = sdk.wallets().v1().createBalance()
                .request(req)
                .call();

        if (res.createBalanceResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CreateBalanceRequest ✔️ The request object to use for the request.

Response

CreateBalanceResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

createWallet

Create a new wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.CreateWalletRequest;
import com.formance.formance_sdk.models.operations.CreateWalletResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        CreateWalletRequest req = CreateWalletRequest.builder()
                .build();

        CreateWalletResponse res = sdk.wallets().v1().createWallet()
                .request(req)
                .call();

        if (res.createWalletResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request CreateWalletRequest ✔️ The request object to use for the request.

Response

CreateWalletResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

creditWallet

Credit a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.CreditWalletRequest;
import com.formance.formance_sdk.models.operations.CreditWalletResponse;
import com.formance.formance_sdk.models.shared.Monetary;
import com.formance.formance_sdk.models.shared.Security;
import com.formance.formance_sdk.models.shared.WalletSubject;
import java.lang.Exception;
import java.math.BigInteger;
import java.util.List;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        CreditWalletRequest req = CreditWalletRequest.builder()
                .id("<id>")
                .creditWalletRequest(com.formance.formance_sdk.models.shared.CreditWalletRequest.builder()
                    .amount(Monetary.builder()
                        .amount(new BigInteger("201874"))
                        .asset("<value>")
                        .build())
                    .metadata(Map.ofEntries(
                        Map.entry("key", "")))
                    .sources(List.of(
                        WalletSubject.builder()
                            .identifier("<value>")
                            .type("<value>")
                            .build()))
                    .build())
                .build();

        CreditWalletResponse res = sdk.wallets().v1().creditWallet()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request CreditWalletRequest ✔️ The request object to use for the request.

Response

CreditWalletResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

debitWallet

Debit a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.DebitWalletRequest;
import com.formance.formance_sdk.models.operations.DebitWalletResponse;
import com.formance.formance_sdk.models.shared.Monetary;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;
import java.math.BigInteger;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        DebitWalletRequest req = DebitWalletRequest.builder()
                .id("<id>")
                .debitWalletRequest(com.formance.formance_sdk.models.shared.DebitWalletRequest.builder()
                    .amount(Monetary.builder()
                        .amount(new BigInteger("245256"))
                        .asset("<value>")
                        .build())
                    .metadata(Map.ofEntries(
                        Map.entry("key", "<value>")))
                    .pending(true)
                    .build())
                .build();

        DebitWalletResponse res = sdk.wallets().v1().debitWallet()
                .request(req)
                .call();

        if (res.debitWalletResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request DebitWalletRequest ✔️ The request object to use for the request.

Response

DebitWalletResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getBalance

Get detailed balance

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetBalanceRequest;
import com.formance.formance_sdk.models.operations.GetBalanceResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetBalanceRequest req = GetBalanceRequest.builder()
                .balanceName("<value>")
                .id("<id>")
                .build();

        GetBalanceResponse res = sdk.wallets().v1().getBalance()
                .request(req)
                .call();

        if (res.getBalanceResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetBalanceRequest ✔️ The request object to use for the request.

Response

GetBalanceResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getHold

Get a hold

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetHoldRequest;
import com.formance.formance_sdk.models.operations.GetHoldResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetHoldRequest req = GetHoldRequest.builder()
                .holdID("<id>")
                .build();

        GetHoldResponse res = sdk.wallets().v1().getHold()
                .request(req)
                .call();

        if (res.getHoldResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetHoldRequest ✔️ The request object to use for the request.

Response

GetHoldResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getHolds

Get all holds for a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetHoldsRequest;
import com.formance.formance_sdk.models.operations.GetHoldsResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetHoldsRequest req = GetHoldsRequest.builder()
                .cursor("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==")
                .metadata(Map.ofEntries(
                    Map.entry("admin", "true")))
                .pageSize(100L)
                .walletID("wallet1")
                .build();

        GetHoldsResponse res = sdk.wallets().v1().getHolds()
                .request(req)
                .call();

        if (res.getHoldsResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetHoldsRequest ✔️ The request object to use for the request.

Response

GetHoldsResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getTransactions

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetTransactionsRequest;
import com.formance.formance_sdk.models.operations.GetTransactionsResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetTransactionsRequest req = GetTransactionsRequest.builder()
                .cursor("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==")
                .pageSize(100L)
                .walletID("wallet1")
                .build();

        GetTransactionsResponse res = sdk.wallets().v1().getTransactions()
                .request(req)
                .call();

        if (res.getTransactionsResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetTransactionsRequest ✔️ The request object to use for the request.

Response

GetTransactionsResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getWallet

Get a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetWalletRequest;
import com.formance.formance_sdk.models.operations.GetWalletResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetWalletRequest req = GetWalletRequest.builder()
                .id("<id>")
                .build();

        GetWalletResponse res = sdk.wallets().v1().getWallet()
                .request(req)
                .call();

        if (res.getWalletResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetWalletRequest ✔️ The request object to use for the request.

Response

GetWalletResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

getWalletSummary

Get wallet summary

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.GetWalletSummaryRequest;
import com.formance.formance_sdk.models.operations.GetWalletSummaryResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        GetWalletSummaryRequest req = GetWalletSummaryRequest.builder()
                .id("<id>")
                .build();

        GetWalletSummaryResponse res = sdk.wallets().v1().getWalletSummary()
                .request(req)
                .call();

        if (res.getWalletSummaryResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request GetWalletSummaryRequest ✔️ The request object to use for the request.

Response

GetWalletSummaryResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

listBalances

List balances of a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.operations.ListBalancesRequest;
import com.formance.formance_sdk.models.operations.ListBalancesResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        ListBalancesRequest req = ListBalancesRequest.builder()
                .id("<id>")
                .build();

        ListBalancesResponse res = sdk.wallets().v1().listBalances()
                .request(req)
                .call();

        if (res.listBalancesResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request ListBalancesRequest ✔️ The request object to use for the request.

Response

ListBalancesResponse

Errors

Error Type Status Code Content Type
models/errors/SDKError 4XX, 5XX */*

listWallets

List all wallets

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.ListWalletsRequest;
import com.formance.formance_sdk.models.operations.ListWalletsResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;
import java.util.Map;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        ListWalletsRequest req = ListWalletsRequest.builder()
                .cursor("aHR0cHM6Ly9nLnBhZ2UvTmVrby1SYW1lbj9zaGFyZQ==")
                .expand("balances")
                .metadata(Map.ofEntries(
                    Map.entry("admin", "true")))
                .name("wallet1")
                .pageSize(100L)
                .build();

        ListWalletsResponse res = sdk.wallets().v1().listWallets()
                .request(req)
                .call();

        if (res.listWalletsResponse().isPresent()) {
            // handle response
        }
    }
}

Parameters

Parameter Type Required Description
request ListWalletsRequest ✔️ The request object to use for the request.

Response

ListWalletsResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

updateWallet

Update a wallet

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.UpdateWalletRequest;
import com.formance.formance_sdk.models.operations.UpdateWalletResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        UpdateWalletRequest req = UpdateWalletRequest.builder()
                .id("<id>")
                .build();

        UpdateWalletResponse res = sdk.wallets().v1().updateWallet()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request UpdateWalletRequest ✔️ The request object to use for the request.

Response

UpdateWalletResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

voidHold

Cancel a hold

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.VoidHoldRequest;
import com.formance.formance_sdk.models.operations.VoidHoldResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        VoidHoldRequest req = VoidHoldRequest.builder()
                .holdId("<id>")
                .build();

        VoidHoldResponse res = sdk.wallets().v1().voidHold()
                .request(req)
                .call();

        // handle response
    }
}

Parameters

Parameter Type Required Description
request VoidHoldRequest ✔️ The request object to use for the request.

Response

VoidHoldResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*

walletsgetServerInfo

Get server info

Example Usage

package hello.world;

import com.formance.formance_sdk.SDK;
import com.formance.formance_sdk.models.errors.WalletsErrorResponse;
import com.formance.formance_sdk.models.operations.WalletsgetServerInfoResponse;
import com.formance.formance_sdk.models.shared.Security;
import java.lang.Exception;

public class Application {

    public static void main(String[] args) throws WalletsErrorResponse, Exception {

        SDK sdk = SDK.builder()
                .security(Security.builder()
                    .clientID("<YOUR_CLIENT_ID_HERE>")
                    .clientSecret("<YOUR_CLIENT_SECRET_HERE>")
                    .build())
            .build();

        WalletsgetServerInfoResponse res = sdk.wallets().v1().walletsgetServerInfo()
                .call();

        if (res.serverInfo().isPresent()) {
            // handle response
        }
    }
}

Response

WalletsgetServerInfoResponse

Errors

Error Type Status Code Content Type
models/errors/WalletsErrorResponse default application/json
models/errors/SDKError 4XX, 5XX */*