-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add check for account age to apply restrictions #2801
Merged
ripcurlx
merged 15 commits into
bisq-network:master
from
ManfredKarrer:restrict-new-accounts
May 3, 2019
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8ab348c
Add check for account age to apply restrictions
ManfredKarrer 6d6e869
Revert changes with filtering not mature accounts
ManfredKarrer 4947352
Update text
ManfredKarrer c74025b
Remove check for makerHasNoMatureAccountForBuyOffer
ManfredKarrer 8e0ec54
Refactor restriction handling
ManfredKarrer 9df5437
Fix verify task
ManfredKarrer 08cf993
Add amount limit to take offer view
ManfredKarrer e51844a
Improve dispute handling of failed trades
ManfredKarrer e0cf683
Update text
ManfredKarrer c4e30e5
Fix limitations
ManfredKarrer 3b613be
Improve handling of filter
ManfredKarrer 830e693
Refactoring: Rename CheckIfPeerIsBanned to ApplyFilter
ManfredKarrer 8f56f4a
Refactoring: Extract variable
ManfredKarrer 8735892
Add null check
ManfredKarrer 364f666
Only show information popup when actual amount was set
ripcurlx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
core/src/main/java/bisq/core/trade/protocol/tasks/seller/SellerVerifiesPeersAccountAge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* This file is part of Bisq. | ||
* | ||
* Bisq is free software: you can redistribute it and/or modify it | ||
* under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or (at | ||
* your option) any later version. | ||
* | ||
* Bisq is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public | ||
* License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package bisq.core.trade.protocol.tasks.seller; | ||
|
||
import bisq.core.offer.Offer; | ||
import bisq.core.payment.AccountAgeWitnessService; | ||
import bisq.core.payment.payload.PaymentMethod; | ||
import bisq.core.trade.Trade; | ||
import bisq.core.trade.protocol.tasks.TradeTask; | ||
|
||
import bisq.common.taskrunner.TaskRunner; | ||
|
||
import java.util.Date; | ||
|
||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class SellerVerifiesPeersAccountAge extends TradeTask { | ||
|
||
@SuppressWarnings({"WeakerAccess", "unused"}) | ||
public SellerVerifiesPeersAccountAge(TaskRunner taskHandler, Trade trade) { | ||
super(taskHandler, trade); | ||
} | ||
|
||
@Override | ||
protected void run() { | ||
try { | ||
runInterceptHook(); | ||
|
||
Offer offer = trade.getOffer(); | ||
if (offer != null && PaymentMethod.hasChargebackRisk(offer.getPaymentMethod())) { | ||
AccountAgeWitnessService accountAgeWitnessService = processModel.getAccountAgeWitnessService(); | ||
long accountCreationDate = new Date().getTime() - accountAgeWitnessService.getTradingPeersAccountAge(trade); | ||
if (accountCreationDate <= AccountAgeWitnessService.SAFE_ACCOUNT_AGE_DATE) { | ||
complete(); | ||
} else { | ||
failed("Trade process failed because the buyer's payment account was created after March 15th 2019 and the payment method is considered " + | ||
"risky regarding chargeback risk."); | ||
} | ||
} else { | ||
complete(); | ||
} | ||
} catch (Throwable t) { | ||
failed(t); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -344,6 +344,16 @@ offerbook.warning.noTradingAccountForCurrency.headline=No trading account for se | |
offerbook.warning.noTradingAccountForCurrency.msg=You don't have a trading account for the selected currency.\nDo you want to create an offer with one of your existing trading accounts? | ||
offerbook.warning.noMatchingAccount.headline=No matching trading account. | ||
offerbook.warning.noMatchingAccount.msg=You don't have a trading account with the payment method required for that offer.\nYou need to setup a trading account with that payment method if you want to take this offer.\nDo you want to do this now? | ||
offerbook.warning.makerHasNoMatureAccountForBuyOffer=You cannot create an offer because you do not have a payment account which was created before March 15th 2019. \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not show-stopping but I made some minor changes:
|
||
The selected payment method is considered risky regarding bank chargeback and we needed to deploy those restrictions for enhanced security.\n\n\ | ||
With the next software release we will provide more protection tools and this restriction for new accounts will be removed. | ||
offerbook.warning.riskyBuyOfferWithImmatureAccountAge=This offer cannot be taken because the maker's payment account \ | ||
was created after March 15th 2019 and the payment method is considered risky regarding bank chargeback and we needed to deploy those restrictions for enhanced security.\n\n\ | ||
With the next software release we will provide more protection tools so that offers with that risk profile can be traded as well. | ||
offerbook.warning.sellOfferAndAnyTakerPaymentAccountForOfferMature=This offer cannot be taken because your payment account \ | ||
was created after March 15th 2019 and the payment method is considered risky regarding bank chargeback and we needed to deploy those restrictions for enhanced security.\n\n\ | ||
With the next software release we will provide more protection tools so that offers with that risk profile can be traded as well. | ||
|
||
offerbook.warning.wrongTradeProtocol=That offer requires a different protocol version as the one used in your version of the software.\n\nPlease check if you have the latest version installed, otherwise the user who created the offer has used an older version.\n\nUsers cannot trade with an incompatible trade protocol version. | ||
offerbook.warning.userIgnored=You have added that user's onion address to your ignore list. | ||
offerbook.warning.offerBlocked=That offer was blocked by the Bisq developers.\nProbably there is an unhandled bug causing issues when taking that offer. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should re-use the static from AccountAgeRestrictions