diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.cc index c649fda5261a..271075d09ed2 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.cc @@ -42,14 +42,17 @@ void GetCapabilities::OnRequest(const type::UrlResponse& response, Capabilities capabilities; if (capability_map.count("receives") && capability_map.count("sends")) { - capabilities.can_receive = capability_map["receives"]; - capabilities.can_send = capability_map["sends"]; + const auto receives = capability_map["receives"]; + const auto sends = capability_map["sends"]; + + capabilities.can_receive = receives.enabled && receives.requirements_empty; + capabilities.can_send = sends.enabled && sends.requirements_empty; } callback(result, std::move(capabilities)); } -std::pair> +std::pair GetCapabilities::ProcessResponse(const type::UrlResponse& response) { const auto status_code = response.status_code; @@ -69,9 +72,9 @@ GetCapabilities::ProcessResponse(const type::UrlResponse& response) { std::move(capability_map)}; } -std::map GetCapabilities::ParseBody( +GetCapabilities::CapabilityMap GetCapabilities::ParseBody( const std::string& body) { - std::map capability_map; + std::map capability_map; const auto value = base::JSONReader::Read(body); const base::ListValue* list_value = nullptr; @@ -82,13 +85,15 @@ std::map GetCapabilities::ParseBody( for (const auto& item : list_value->GetList()) { const auto* key = item.FindStringKey("key"); const auto enabled = item.FindBoolKey("enabled"); + const auto* requirements = item.FindListKey("requirements"); - if (!key || !enabled) { + if (!key || !enabled || !requirements) { capability_map.clear(); break; } - capability_map.emplace(*key, *enabled); + capability_map.emplace( + *key, Capability{*enabled, requirements->GetList().empty()}); } } diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.h b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.h index f9420e0dd2a4..5f8190eafd49 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.h +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities.h @@ -182,13 +182,20 @@ class GetCapabilities { void Request(const std::string& token, GetCapabilitiesCallback callback); private: + struct Capability { + bool enabled = false; + bool requirements_empty = false; + }; + + using CapabilityMap = std::map; + void OnRequest(const type::UrlResponse& response, GetCapabilitiesCallback callback); - std::pair> ProcessResponse( + std::pair ProcessResponse( const type::UrlResponse& response); - std::map ParseBody(const std::string& body); + CapabilityMap ParseBody(const std::string& body); LedgerImpl* ledger_; // NOT OWNED }; diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities_unittest.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities_unittest.cc index e24e11125421..31436d5ac311 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities_unittest.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/endpoint/uphold/get_capabilities/get_capabilities_unittest.cc @@ -45,7 +45,7 @@ class GetCapabilitiesTest : public testing::Test { std::unique_ptr get_capabilities_; }; -TEST_F(GetCapabilitiesTest, ServerReturns200OK) { +TEST_F(GetCapabilitiesTest, ServerReturns200OKSufficientReceivesAndSends) { ON_CALL(*mock_ledger_client_, LoadURL(_, _)) .WillByDefault( Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { @@ -54,117 +54,207 @@ TEST_F(GetCapabilitiesTest, ServerReturns200OK) { response.body = R"( [ { - "category": "features", + "category": "permissions", "enabled": true, - "key": "change_phone", - "name": "Change Phone", + "key": "receives", + "name": "Receives", "requirements": [], "restrictions": [] }, { - "category": "features", + "category": "permissions", "enabled": true, - "key": "change_pii", - "name": "ChangePII", + "key": "sends", + "name": "Sends", "requirements": [], "restrictions": [] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, true); + EXPECT_EQ(capabilities.can_send, true); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientReceives1) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { - "category": "features", + "category": "permissions", "enabled": true, - "key": "equities", - "name": "Equities", + "key": "receives", + "name": "Receives", "requirements": [ - "user-must-accept-equities-terms-of-services" + "user-must-submit-customer-due-diligence" ], "restrictions": [] }, { - "category": "features", + "category": "permissions", "enabled": true, - "key": "limit_orders", - "name": "Limit Orders", + "key": "sends", + "name": "Sends", "requirements": [], "restrictions": [] - }, - { - "category": "features", - "enabled": false, - "key": "physical_card_eea", - "name": "Physical Card EEA", - "requirements": [], - "restrictions": [ - "user-country-not-supported" - ] - }, - { - "category": "features", - "enabled": false, - "key": "physical_card_us", - "name": "Physical Card US", - "requirements": [], - "restrictions": [ - "user-country-not-supported" - ] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, false); + EXPECT_EQ(capabilities.can_send, true); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientReceives2) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { - "category": "features", + "category": "permissions", "enabled": false, - "key": "physical_card", - "name": "Physical Card", + "key": "receives", + "name": "Receives", "requirements": [], - "restrictions": [ - "user-country-not-supported" - ] + "restrictions": [] }, { - "category": "features", + "category": "permissions", "enabled": true, - "key": "referrals", - "name": "Referrals", + "key": "sends", + "name": "Sends", "requirements": [], "restrictions": [] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, false); + EXPECT_EQ(capabilities.can_send, true); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientSends1) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { - "category": "features", + "category": "permissions", "enabled": true, - "key": "staking", - "name": "Staking", + "key": "receives", + "name": "Receives", "requirements": [], "restrictions": [] }, { - "category": "features", + "category": "permissions", "enabled": true, - "key": "virtual_iban", - "name": "Virtual IBAN", + "key": "sends", + "name": "Sends", "requirements": [ - "user-must-accept-virtual-iban-terms-of-services" + "user-must-submit-customer-due-diligence" ], "restrictions": [] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, true); + EXPECT_EQ(capabilities.can_send, false); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientSends2) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { "category": "permissions", "enabled": true, - "key": "deposits", - "name": "Deposits", + "key": "receives", + "name": "Receives", "requirements": [], "restrictions": [] }, { "category": "permissions", - "enabled": true, - "key": "invites", - "name": "Invites", + "enabled": false, + "key": "sends", + "name": "Sends", "requirements": [], "restrictions": [] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, true); + EXPECT_EQ(capabilities.can_send, false); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientReceivesAndSends1) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { "category": "permissions", - "enabled": false, + "enabled": true, "key": "receives", "name": "Receives", - "requirements": [], + "requirements": [ + "user-must-submit-customer-due-diligence" + ], "restrictions": [] }, { @@ -172,22 +262,46 @@ TEST_F(GetCapabilitiesTest, ServerReturns200OK) { "enabled": true, "key": "sends", "name": "Sends", - "requirements": [], + "requirements": [ + "user-must-submit-customer-due-diligence" + ], "restrictions": [] - }, + } +] + )"; + callback(std::move(response)); + })); + + get_capabilities_->Request( + "193a77cf-02e8-4e10-8127-8a1b5a8bfece", + [](type::Result result, Capabilities capabilities) { + EXPECT_EQ(result, type::Result::LEDGER_OK); + EXPECT_EQ(capabilities.can_receive, false); + EXPECT_EQ(capabilities.can_send, false); + }); +} + +TEST_F(GetCapabilitiesTest, ServerReturns200OKInsufficientReceivesAndSends2) { + ON_CALL(*mock_ledger_client_, LoadURL(_, _)) + .WillByDefault( + Invoke([](type::UrlRequestPtr, client::LoadURLCallback callback) { + type::UrlResponse response; + response.status_code = net::HTTP_OK; + response.body = R"( +[ { "category": "permissions", - "enabled": true, - "key": "trades", - "name": "Trades", + "enabled": false, + "key": "receives", + "name": "Receives", "requirements": [], "restrictions": [] }, { "category": "permissions", - "enabled": true, - "key": "withdrawals", - "name": "Withdrawals", + "enabled": false, + "key": "sends", + "name": "Sends", "requirements": [], "restrictions": [] } @@ -201,7 +315,7 @@ TEST_F(GetCapabilitiesTest, ServerReturns200OK) { [](type::Result result, Capabilities capabilities) { EXPECT_EQ(result, type::Result::LEDGER_OK); EXPECT_EQ(capabilities.can_receive, false); - EXPECT_EQ(capabilities.can_send, true); + EXPECT_EQ(capabilities.can_send, false); }); } diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_unittest.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_unittest.cc index eb30bd77fe51..2497069639f8 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_unittest.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_unittest.cc @@ -620,6 +620,7 @@ using GetCapabilitiesParamType = std::tuple< std::string, // input Uphold wallet type::UrlResponse, // Uphold Get User response type::UrlResponse, // Uphold Get Capabilities response + type::UrlResponse, // Rewards Delete Claim response type::Result, // expected result absl::optional // expected status >; @@ -648,6 +649,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::EXPIRED_TOKEN, type::WalletStatus::NOT_CONNECTED }, @@ -669,6 +671,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::PENDING }, @@ -690,6 +693,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::PENDING }, @@ -711,6 +715,7 @@ INSTANTIATE_TEST_SUITE_P( R"([ { "key": "sends", "enabled": true } ])", {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::PENDING }, @@ -732,6 +737,7 @@ INSTANTIATE_TEST_SUITE_P( R"([ { "key": "receives", "enabled": true } ])", {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::PENDING }, @@ -750,9 +756,10 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": false } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": false, "requirements": [] } ])", {} }, + type::UrlResponse{}, type::Result::UPHOLD_INSUFFICIENT_CAPABILITIES, type::WalletStatus::NOT_CONNECTED }, @@ -773,6 +780,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::EXPIRED_TOKEN, type::WalletStatus::DISCONNECTED_VERIFIED }, @@ -794,6 +802,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::VERIFIED }, @@ -815,6 +824,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::VERIFIED }, @@ -836,6 +846,7 @@ INSTANTIATE_TEST_SUITE_P( R"([ { "key": "sends", "enabled": true } ])", {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::VERIFIED }, @@ -857,6 +868,7 @@ INSTANTIATE_TEST_SUITE_P( R"([ { "key": "receives", "enabled": true } ])", {} }, + type::UrlResponse{}, type::Result::CONTINUE, type::WalletStatus::VERIFIED }, @@ -875,11 +887,18 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": false } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": false, "requirements": [] } ])", + {} + }, + type::UrlResponse{ + {}, + {}, + net::HttpStatusCode::HTTP_OK, + {}, {} }, type::Result::UPHOLD_INSUFFICIENT_CAPABILITIES, - type::WalletStatus::DISCONNECTED_VERIFIED + type::WalletStatus::NOT_CONNECTED }, GetCapabilitiesParamType{ // Happy path. (VERIFIED) "12_VERIFIED_happy_path", @@ -895,9 +914,10 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, + type::UrlResponse{}, type::Result::LEDGER_OK, type::WalletStatus::VERIFIED }), @@ -910,8 +930,9 @@ TEST_P(GetCapabilities, Paths) { std::string uphold_wallet = std::get<1>(params); const auto& uphold_get_user_response = std::get<2>(params); const auto& uphold_get_capabilities_response = std::get<3>(params); - const auto expected_result = std::get<4>(params); - const auto expected_status = std::get<5>(params); + const auto& rewards_services_delete_claim_response = std::get<4>(params); + const auto expected_result = std::get<5>(params); + const auto expected_status = std::get<6>(params); ON_CALL(*mock_ledger_client_, GetStringState(state::kWalletUphold)) .WillByDefault( @@ -924,12 +945,15 @@ TEST_P(GetCapabilities, Paths) { }); EXPECT_CALL(*mock_ledger_client_, LoadURL(_, _)) - .Times(AtMost(2)) + .Times(AtMost(3)) .WillOnce([&](type::UrlRequestPtr, client::LoadURLCallback callback) { callback(uphold_get_user_response); }) .WillOnce([&](type::UrlRequestPtr, client::LoadURLCallback callback) { callback(uphold_get_capabilities_response); + }) + .WillOnce([&](type::UrlRequestPtr, client::LoadURLCallback callback) { + callback(rewards_services_delete_claim_response); }); ON_CALL(*mock_ledger_impl_, database()) @@ -938,6 +962,16 @@ TEST_P(GetCapabilities, Paths) { ON_CALL(*mock_ledger_impl_, promotion()) .WillByDefault(Return(mock_promotion_.get())); + ON_CALL(*mock_ledger_client_, GetStringState(state::kWalletBrave)) + .WillByDefault([] { + return R"( + { + "payment_id": "f375da3c-c206-4f09-9422-665b8e5952db", + "recovery_seed": "OG2zYotDSeZ81qLtr/uq5k/GC6WE5/7BclT1lHi4l+w=" + } + )"; + }); + uphold_->GenerateWallet( [&](type::Result result) { ASSERT_EQ(result, expected_result); }); @@ -983,7 +1017,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1013,7 +1047,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1119,7 +1153,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1430,7 +1464,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1466,7 +1500,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1507,7 +1541,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1548,7 +1582,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1589,7 +1623,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1630,7 +1664,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ @@ -1707,7 +1741,7 @@ INSTANTIATE_TEST_SUITE_P( {}, {}, net::HttpStatusCode::HTTP_OK, - R"([ { "key": "receives", "enabled": true }, { "key": "sends", "enabled": true } ])", + R"([ { "key": "receives", "enabled": true, "requirements": [] }, { "key": "sends", "enabled": true, "requirements": [] } ])", {} }, type::UrlResponse{ diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_wallet.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_wallet.cc index c64c24cd36f5..525d9f0c20b2 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_wallet.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_wallet.cc @@ -151,11 +151,14 @@ void UpholdWallet::OnGetCapabilities(type::Result result, if (!*capabilities.can_receive || !*capabilities.can_send) { BLOG(0, "User doesn't have the required Uphold capabilities!"); - // Entering NOT_CONNECTED or DISCONNECTED_VERIFIED. - ledger_->uphold()->DisconnectWallet( - uphold_wallet->status == type::WalletStatus::VERIFIED - ? ledger::notifications::kWalletDisconnected - : ""); + // Entering NOT_CONNECTED. + if (uphold_wallet->status == type::WalletStatus::VERIFIED) { + ledger_->ledger_client()->ShowNotification( + ledger::notifications::kWalletDisconnected, {"Uphold"}, [](auto) {}); + ledger_->wallet()->DisconnectWallet(constant::kWalletUphold, [](auto) {}); + } else { + ledger_->uphold()->DisconnectWallet(""); + } return callback(type::Result::UPHOLD_INSUFFICIENT_CAPABILITIES); }