From 59b6b2399737e8cc5f5919decdcbe5f6a14784e7 Mon Sep 17 00:00:00 2001 From: Nejc Zdovc Date: Wed, 15 Jan 2020 13:03:58 -0800 Subject: [PATCH] Adds cc scope for uphold Resolves https://github.com/brave/brave-browser/issues/7713 --- .../bat/ledger/internal/uphold/uphold_util.cc | 12 +++- .../internal/uphold/uphold_util_unittest.cc | 56 ++++++++++++------- 2 files changed, 46 insertions(+), 22 deletions(-) diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util.cc index aebd94f2bd0d..039f9546a354 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util.cc @@ -56,9 +56,17 @@ std::string GetVerifyUrl(const std::string& state) { return base::StringPrintf( "%s/authorize/%s" - "?scope=cards:read cards:write user:read transactions:read " + "?scope=" + "accounts:read " + "accounts:write " + "cards:read " + "cards:write " + "user:read " + "transactions:deposit " + "transactions:read " "transactions:transfer:application " - "transactions:transfer:others&intention=kyc&" + "transactions:transfer:others" + "&intention=kyc&" "state=%s", url.c_str(), id.c_str(), diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util_unittest.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util_unittest.cc index 4065b7f540f1..9fe324b112b9 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util_unittest.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/uphold/uphold_util_unittest.cc @@ -77,18 +77,22 @@ TEST(UpholdUtilTest, GetVerifyUrl) { std::string result = braveledger_uphold::GetVerifyUrl("rdfdsfsdfsdf"); ASSERT_EQ(result, "https://uphold.com/authorize/" - "6d8d9473ed20be627f71ed46e207f40c004c5b1a?scope=cards:read cards:write " - "user:read transactions:read transactions:transfer:application " - "transactions:transfer:others&intention=kyc&state=rdfdsfsdfsdf"); + "6d8d9473ed20be627f71ed46e207f40c004c5b1a?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state=rdfdsfsdfsdf"); // staging ledger::_environment = ledger::Environment::STAGING; result = braveledger_uphold::GetVerifyUrl("rdfdsfsdfsdf"); ASSERT_EQ(result, "https://sandbox.uphold.com/authorize/" - "4c2b665ca060d912fec5c735c734859a06118cc8?scope=cards:read cards:write " - "user:read transactions:read transactions:transfer:application " - "transactions:transfer:others&intention=kyc&state=rdfdsfsdfsdf"); + "4c2b665ca060d912fec5c735c734859a06118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state=rdfdsfsdfsdf"); } TEST(UpholdUtilTest, GetAddUrl) { @@ -202,9 +206,11 @@ TEST(UpholdUtilTest, GenerateLinks) { ASSERT_EQ(result->withdraw_url, ""); ASSERT_EQ(result->verify_url, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a06" - "118cc8?scope=cards:read cards:write user:read transactions:read " - "transactions:transfer:application transactions:transfer:others&" - "intention=kyc&state="); + "118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state="); ASSERT_EQ(result->account_url, "https://sandbox.uphold.com/dashboard"); // Connected @@ -237,7 +243,9 @@ TEST(UpholdUtilTest, GenerateLinks) { ASSERT_EQ(result->withdraw_url, ""); ASSERT_EQ(result->verify_url, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a0" - "6118cc8?scope=cards:read cards:write user:read transactions:read " + "6118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " "transactions:transfer:application transactions:transfer:others" "&intention=kyc&state="); ASSERT_EQ(result->account_url, "https://sandbox.uphold.com/dashboard"); @@ -249,7 +257,9 @@ TEST(UpholdUtilTest, GenerateLinks) { ASSERT_EQ(result->withdraw_url, ""); ASSERT_EQ(result->verify_url, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a0" - "6118cc8?scope=cards:read cards:write user:read transactions:read " + "6118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " "transactions:transfer:application transactions:transfer:others" "&intention=kyc&state="); ASSERT_EQ(result->account_url, "https://sandbox.uphold.com/dashboard"); @@ -283,9 +293,11 @@ TEST(UpholdUtilTest, GenerateVerifyLink) { auto result = braveledger_uphold::GenerateVerifyLink(wallet->Clone()); ASSERT_EQ(result, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a06" - "118cc8?scope=cards:read cards:write user:read transactions:read " - "transactions:transfer:application transactions:transfer:others&" - "intention=kyc&state=123123123124234234234"); + "118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state=123123123124234234234"); // Connected wallet->status = ledger::WalletStatus::CONNECTED; @@ -304,18 +316,22 @@ TEST(UpholdUtilTest, GenerateVerifyLink) { result = braveledger_uphold::GenerateVerifyLink(wallet->Clone()); ASSERT_EQ(result, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a06" - "118cc8?scope=cards:read cards:write user:read transactions:read " - "transactions:transfer:application transactions:transfer:others&" - "intention=kyc&state=123123123124234234234"); + "118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state=123123123124234234234"); // Disconnected Verified wallet->status = ledger::WalletStatus::DISCONNECTED_VERIFIED; result = braveledger_uphold::GenerateVerifyLink(wallet->Clone()); ASSERT_EQ(result, "https://sandbox.uphold.com/authorize/4c2b665ca060d912fec5c735c734859a06" - "118cc8?scope=cards:read cards:write user:read transactions:read " - "transactions:transfer:application transactions:transfer:others&" - "intention=kyc&state=123123123124234234234"); + "118cc8?scope=accounts:read " + "accounts:write cards:read cards:write user:read " + "transactions:deposit transactions:read " + "transactions:transfer:application transactions:transfer:others" + "&intention=kyc&state=123123123124234234234"); // Pending wallet->status = ledger::WalletStatus::PENDING;