diff --git a/browser/ui/webui/brave_webui_source.cc b/browser/ui/webui/brave_webui_source.cc index 561ed00eef4b..55e0c7e4573f 100644 --- a/browser/ui/webui/brave_webui_source.cc +++ b/browser/ui/webui/brave_webui_source.cc @@ -781,6 +781,8 @@ void CustomizeWebUIHTMLSource(const std::string &name, { "contributionStepReserve", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_RESERVE }, // NOLINT { "contributionStepExternalTransaction", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_EXTERNAL_TRANSACTION }, // NOLINT { "contributionStepCreds", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_CREDS }, // NOLINT + { "contributionStepRewardsOff", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_REWARDS_OFF }, // NOLINT + { "contributionStepAutoContributeOff", IDS_BRAVE_REWARDS_INTERNALS_CONTRIBUTION_STEP_AUTO_CONTRIBUTE_OFF }, // NOLINT { "rewardsNotEnabled", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_NOT_ENABLED }, // NOLINT { "rewardsTypeAuto", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_AUTO }, // NOLINT { "rewardsTypeOneTimeTip", IDS_BRAVE_REWARDS_INTERNALS_REWARDS_TYPE_ONE_TIME_TIP }, // NOLINT diff --git a/components/brave_rewards/resources/internals/components/contribution.tsx b/components/brave_rewards/resources/internals/components/contribution.tsx index ccd8bc5e1cf0..8f756dbadabd 100644 --- a/components/brave_rewards/resources/internals/components/contribution.tsx +++ b/components/brave_rewards/resources/internals/components/contribution.tsx @@ -43,8 +43,12 @@ const getProcessorString = (processor: number) => { const getContributionStepString = (step: number) => { switch (step) { + case -6: + return getLocale('contributionStepAutoContributeOff') + case -5: + return getLocale('contributionStepRewardsOff') case -4: - return getLocale('contributionAutoContributeTableEmpty') + return getLocale('contributionStepAutoContributeTableEmpty') case -3: return getLocale('contributionStepNotEnoughFunds') case -2: diff --git a/components/resources/brave_components_strings.grd b/components/resources/brave_components_strings.grd index 0f5c556bfde6..d571e4bf254c 100644 --- a/components/resources/brave_components_strings.grd +++ b/components/resources/brave_components_strings.grd @@ -385,6 +385,8 @@ Reserve External transaction Creds + Rewards was turned off + Auto-contribute was turned off Type: Contributions Download full log 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 8b917e5d9729..51b9e3cda243 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 @@ -5,6 +5,8 @@ module ledger.mojom; enum ContributionStep { + STEP_AC_OFF = -6, + STEP_REWARDS_OFF = -5, STEP_AC_TABLE_EMPTY = -4, STEP_NOT_ENOUGH_FUNDS = -3, STEP_FAILED = -2, @@ -240,7 +242,9 @@ enum Result { RETRY_SHORT = 30, RETRY_LONG = 31, CONTINUE = 32, - IN_PROGRESS= 33 + IN_PROGRESS= 33, + REWARDS_OFF = 34, + AC_OFF = 35 }; enum PublisherStatus { diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution.cc index 41d1b627126e..e9490a536d7b 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution.cc @@ -26,6 +26,7 @@ #include "bat/ledger/internal/contribution/contribution_unblinded.h" #include "bat/ledger/internal/contribution/contribution_util.h" #include "bat/ledger/internal/contribution/unverified.h" +#include "bat/ledger/internal/state/state_util.h" #include "bat/ledger/internal/uphold/uphold.h" #include "bat/ledger/internal/wallet/balance.h" #include "bat/ledger/internal/ledger_impl.h" @@ -48,6 +49,12 @@ ledger::ContributionStep ConvertResultIntoContributionStep( case ledger::Result::NOT_ENOUGH_FUNDS: { return ledger::ContributionStep::STEP_NOT_ENOUGH_FUNDS; } + case ledger::Result::REWARDS_OFF: { + return ledger::ContributionStep::STEP_REWARDS_OFF; + } + case ledger::Result::AC_OFF: { + return ledger::ContributionStep::STEP_AC_OFF; + } default: { return ledger::ContributionStep::STEP_FAILED; } @@ -755,6 +762,23 @@ void Contribution::Retry( return; } + if (!braveledger_state::GetRewardsMainEnabled(ledger_)) { + BLOG(1, "Rewards is disabled, completing contribution"); + ledger_->ContributionCompleted( + ledger::Result::REWARDS_OFF, + std::move(contribution)); + return; + } + + if (contribution->type == ledger::RewardsType::AUTO_CONTRIBUTE && + !braveledger_state::GetAutoContributeEnabled(ledger_)) { + BLOG(1, "AC is disabled, completing contribution"); + ledger_->ContributionCompleted( + ledger::Result::AC_OFF, + std::move(contribution)); + return; + } + BLOG(1, "Retrying contribution (" << contribution->contribution_id << ") on step " << contribution->step); diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_sku.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_sku.cc index 37e6b5bbcb35..b720d936c922 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_sku.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_sku.cc @@ -455,6 +455,8 @@ void ContributionSKU::OnOrder( callback); return; } + case ledger::ContributionStep::STEP_REWARDS_OFF: + case ledger::ContributionStep::STEP_AC_OFF: case ledger::ContributionStep::STEP_AC_TABLE_EMPTY: case ledger::ContributionStep::STEP_NOT_ENOUGH_FUNDS: case ledger::ContributionStep::STEP_FAILED: diff --git a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded.cc b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded.cc index c3ce6c9f63d3..407f4a1bd8ea 100644 --- a/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded.cc +++ b/vendor/bat-native-ledger/src/bat/ledger/internal/contribution/contribution_unblinded.cc @@ -574,6 +574,8 @@ void Unblinded::Retry( get_callback); return; } + case ledger::ContributionStep::STEP_REWARDS_OFF: + case ledger::ContributionStep::STEP_AC_OFF: case ledger::ContributionStep::STEP_AC_TABLE_EMPTY: case ledger::ContributionStep::STEP_CREDS: case ledger::ContributionStep::STEP_EXTERNAL_TRANSACTION: