Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds cc scope for uphold (uplift to 1.4.x) #4409

Merged
merged 1 commit into from
Jan 24, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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");
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down