diff --git a/browser/ui/webui/brave_rewards_page_ui.cc b/browser/ui/webui/brave_rewards_page_ui.cc index c01c637ebe83..d090d2ba38fe 100644 --- a/browser/ui/webui/brave_rewards_page_ui.cc +++ b/browser/ui/webui/brave_rewards_page_ui.cc @@ -1764,6 +1764,7 @@ void RewardsDOMHandler::OnGetMonthlyReport( base::Value transaction_report(base::Value::Type::DICTIONARY); transaction_report.SetDoubleKey("amount", item.amount); transaction_report.SetIntKey("type", item.type); + transaction_report.SetIntKey("processor", item.processor); transaction_report.SetIntKey("created_at", item.created_at); transactions.Append(std::move(transaction_report)); @@ -1789,6 +1790,7 @@ void RewardsDOMHandler::OnGetMonthlyReport( base::Value contribution_report(base::Value::Type::DICTIONARY); contribution_report.SetDoubleKey("amount", item.amount); contribution_report.SetIntKey("type", item.type); + contribution_report.SetIntKey("processor", item.processor); contribution_report.SetIntKey("created_at", item.created_at); contribution_report.SetKey("publishers", std::move(publishers)); contributions.Append(std::move(contribution_report)); diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index e59ca12711c0..7f2ae9f8012b 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -372,6 +372,7 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "allowTip", IDS_BRAVE_UI_ALLOW_TIP }, { "amount", IDS_BRAVE_UI_AMOUNT }, { "autoContribute", IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TITLE }, + { "autoContributeTransaction", IDS_BRAVE_UI_BRAVE_CONTRIBUTE_TRANSACTION }, // NOLINT { "backup", IDS_BRAVE_UI_BACKUP }, { "braveAdsDesc", IDS_BRAVE_UI_BRAVE_ADS_DESC }, { "braveAdsDescPoints", IDS_BRAVE_UI_BRAVE_ADS_DESC_POINTS }, @@ -503,6 +504,9 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "print", IDS_BRAVE_UI_PRINT }, { "processingRequest", IDS_BRAVE_UI_PROCESSING_REQUEST }, { "processingRequestButton", IDS_BRAVE_UI_PROCESSING_REQUEST_BUTTON }, + { "processorBraveTokens", IDS_BRAVE_UI_PROCESSOR_BRAVE_TOKENS }, + { "processorUphold", IDS_BRAVE_UI_PROCESSOR_UPHOLD }, + { "processorBraveUserFunds", IDS_BRAVE_UI_PROCESSOR_BRAVE_USER_FUNDS }, { "readyToTakePart", IDS_BRAVE_UI_READY_TO_TAKE_PART }, { "readyToTakePartOptInText", IDS_BRAVE_UI_READY_TO_TAKE_PART_OPT_IN_TEXT }, // NOLINT { "readyToTakePartStart", IDS_BRAVE_UI_READY_TO_TAKE_PART_START }, diff --git a/components/brave_rewards/browser/contribution_report_info.h b/components/brave_rewards/browser/contribution_report_info.h index 797ef8682e77..32c23b7bd56b 100644 --- a/components/brave_rewards/browser/contribution_report_info.h +++ b/components/brave_rewards/browser/contribution_report_info.h @@ -20,6 +20,7 @@ struct ContributionReportInfo { double amount; uint32_t type; + uint32_t processor; std::vector publishers; uint64_t created_at; }; diff --git a/components/brave_rewards/browser/rewards_service_impl.cc b/components/brave_rewards/browser/rewards_service_impl.cc index a6be450e805a..3c53ecc33b52 100644 --- a/components/brave_rewards/browser/rewards_service_impl.cc +++ b/components/brave_rewards/browser/rewards_service_impl.cc @@ -3325,6 +3325,7 @@ void ConvertLedgerToServiceTransactionReportList( for (const auto& item : list) { info.amount = item->amount; info.type = static_cast(item->type); + info.processor = static_cast(item->processor); info.created_at = item->created_at; converted_list->push_back(info); @@ -3340,6 +3341,7 @@ void ConvertLedgerToServiceContributionReportList( for (auto& item : list) { info.amount = item->amount; info.type = static_cast(item->type); + info.processor = static_cast(item->processor); info.created_at = item->created_at; info.publishers = {}; for (auto& publisher : item->publishers) { diff --git a/components/brave_rewards/browser/transaction_report_info.h b/components/brave_rewards/browser/transaction_report_info.h index dde3b027e5f3..5b5318573da6 100644 --- a/components/brave_rewards/browser/transaction_report_info.h +++ b/components/brave_rewards/browser/transaction_report_info.h @@ -17,6 +17,7 @@ struct TransactionReportInfo { double amount; uint32_t type; + uint32_t processor; uint64_t created_at; }; diff --git a/components/brave_rewards/resources/page/components/pageWallet.tsx b/components/brave_rewards/resources/page/components/pageWallet.tsx index 42240b49bc01..a94383352578 100644 --- a/components/brave_rewards/resources/page/components/pageWallet.tsx +++ b/components/brave_rewards/resources/page/components/pageWallet.tsx @@ -602,9 +602,39 @@ class PageWallet extends React.Component { return '' } + getProcessorString = (processor: Rewards.Processor) => { + let text = '' + switch (processor) { + case 0: { // Rewards.Processor.NONE + text = '' + break + } + case 1: { // Rewards.Processor.BRAVE_TOKENS + text = getLocale('processorBraveTokens') + break + } + case 2: { // Rewards.Processor.UPHOLD + text = getLocale('processorUphold') + break + } + case 3: { // Rewards.Processor.BRAVE_USER_FUNDS + text = getLocale('processorBraveUserFunds') + break + } + } + + if (text.length === 0) { + return '' + } + + return `(${text})` + } + getContributionDescription = (contribution: Rewards.ContributionReport) => { if (contribution.type === 1) { // Rewards.ReportType.AUTO_CONTRIBUTION - return getLocale('autoContribute') + return getLocale( + 'autoContributeTransaction', + { processor: this.getProcessorString(contribution.processor) }) } return '' diff --git a/components/definitions/rewards.d.ts b/components/definitions/rewards.d.ts index ba00e0f4e436..6377e0fc2d26 100644 --- a/components/definitions/rewards.d.ts +++ b/components/definitions/rewards.d.ts @@ -104,15 +104,24 @@ declare namespace Rewards { TIP = 5 } + export enum Processor { + NONE = 0, + BRAVE_TOKENS = 1, + UPHOLD = 2, + BRAVE_USER_FUNDS = 3 + } + export interface TransactionReport { amount: number type: ReportType + processor: Processor created_at: number } export interface ContributionReport { amount: number type: ReportType + processor: Processor created_at: number publishers: Publisher[] } diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index 300c1e4ba293..b13d40483194 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -403,6 +403,7 @@ Ads Support your favorite sites just by browsing – or tip a site any time you like. Auto-Contribute + Auto-Contribute {{processor}} Brave Rewards and Privacy Policy @@ -517,6 +518,9 @@ Print Your request is still being processed, please wait. Try again + Rewards BAT + Uphold Wallet + Deposited BAT Ready to get started? Yes I'm Ready You can start with the diff --git a/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom b/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom index 225d548dc55d..5d9276b145c8 100644 --- a/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom +++ b/vendor/bat-native-ledger/include/bat/ledger/public/interfaces/ledger.mojom @@ -410,6 +410,7 @@ struct RecurringTip { struct TransactionReportInfo { double amount; ReportType type; + ContributionProcessor processor; uint64 created_at; }; @@ -417,6 +418,7 @@ struct ContributionReportInfo { string contribution_id; double amount; ReportType type; + ContributionProcessor processor; array publishers; uint64 created_at; }; diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_contribution_info.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_contribution_info.cc index d9212f278594..23e21f8e7957 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_contribution_info.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/database/database_contribution_info.cc @@ -653,8 +653,8 @@ void DatabaseContributionInfo::GetContributionReport( auto transaction = ledger::DBTransaction::New(); const std::string query = base::StringPrintf( - "SELECT ci.contribution_id, ci.amount, ci.type, ci.created_at " - "FROM %s as ci " + "SELECT ci.contribution_id, ci.amount, ci.type, ci.created_at, " + "ci.processor FROM %s as ci " "WHERE strftime('%%m', datetime(ci.created_at, 'unixepoch')) = ? AND " "strftime('%%Y', datetime(ci.created_at, 'unixepoch')) = ? AND step = ?", kTableName); @@ -674,7 +674,8 @@ void DatabaseContributionInfo::GetContributionReport( ledger::DBCommand::RecordBindingType::STRING_TYPE, ledger::DBCommand::RecordBindingType::DOUBLE_TYPE, ledger::DBCommand::RecordBindingType::INT64_TYPE, - ledger::DBCommand::RecordBindingType::INT64_TYPE + ledger::DBCommand::RecordBindingType::INT64_TYPE, + ledger::DBCommand::RecordBindingType::INT_TYPE }; transaction->commands.push_back(std::move(command)); @@ -708,6 +709,8 @@ void DatabaseContributionInfo::OnGetContributionReport( info->type = static_cast( GetInt64Column(record_pointer, 2)); info->created_at = GetInt64Column(record_pointer, 3); + info->processor = static_cast( + GetIntColumn(record_pointer, 4)); contribution_ids.push_back(info->contribution_id); list.push_back(std::move(info)); @@ -740,6 +743,7 @@ void DatabaseContributionInfo::OnGetContributionReportPublishers( report->contribution_id = contribution->contribution_id; report->amount = contribution->amount; report->type = ConvertRewardsTypeToReportType(contribution->type); + report->processor = contribution->processor; report->created_at = contribution->created_at; report_list.push_back(std::move(report));