From 068ec929516d106957fec620c366eca9d3ac682f Mon Sep 17 00:00:00 2001 From: Antonio Lopez Date: Wed, 24 Apr 2019 17:48:58 +0100 Subject: [PATCH] Some optional parameters were not present on the authorization request: layout, referral and account. As per the documentation https://developers.coinbase.com/docs/wallet/coinbase-connect/reference these are available options to better define the authorisation request. --- .../java/com/coinbase/api/CoinbaseImpl.java | 12 +++++ .../coinbase/api/entity/OAuthCodeRequest.java | 44 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/src/main/java/com/coinbase/api/CoinbaseImpl.java b/src/main/java/com/coinbase/api/CoinbaseImpl.java index 24df905a..7221587f 100644 --- a/src/main/java/com/coinbase/api/CoinbaseImpl.java +++ b/src/main/java/com/coinbase/api/CoinbaseImpl.java @@ -1172,6 +1172,18 @@ public URI getAuthorizationUri(OAuthCodeRequest params) throws CoinbaseException throw new CoinbaseException("scope is required"); } + if (params.getAccount() != null) { + uriBuilder.addParameter("account", params.getAccount().toString()); + } + + if (params.getReferral() != null) { + uriBuilder.addParameter("referral", params.getReferral()); + } + + if (params.getLayout() != null) { + uriBuilder.addParameter("layout", params.getLayout()); + } + if (params.getMeta() != null) { OAuthCodeRequest.Meta meta = params.getMeta(); diff --git a/src/main/java/com/coinbase/api/entity/OAuthCodeRequest.java b/src/main/java/com/coinbase/api/entity/OAuthCodeRequest.java index dde6eb93..02168bdd 100644 --- a/src/main/java/com/coinbase/api/entity/OAuthCodeRequest.java +++ b/src/main/java/com/coinbase/api/entity/OAuthCodeRequest.java @@ -78,6 +78,23 @@ public String getSendLimitCurrency() { } } + public enum Account { + SELECT("select"), + ALL("all"); + + private String _value; + + Account(String value) { + this._value = value; + } + + @Override + @JsonValue + public String toString() { + return this._value; + } + } + private String clientId; private String clientSecret; private String username; @@ -85,6 +102,9 @@ public String getSendLimitCurrency() { private String token; private String scope; private String redirectUri; + private Account account; + private String referral; + private String layout; public String getRedirectUri() { return redirectUri; @@ -151,4 +171,28 @@ public String getClientSecret() { public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; } + + public Account getAccount() { + return account; + } + + public void setAccount(Account account) { + this.account = account; + } + + public String getReferral() { + return referral; + } + + public void setReferral(String referral) { + this.referral = referral; + } + + public String getLayout() { + return layout; + } + + public void setLayout(String layout) { + this.layout = layout; + } }