Skip to content

Commit

Permalink
made some bigger changes with bank accounts and permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Snabeldier committed Mar 26, 2024
1 parent 0c192d1 commit aad3471
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
12 changes: 4 additions & 8 deletions src/main/java/minevalley/core/api/economy/AccountUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface AccountUser {

int getMaxPayoutPerDayInCents();

void setMaxPayOutPerDayInCents(int maxPayout);
void setMaxPayoutPerDayInCents(int maxPayoutInCents);

int getRemainingDailyPayoutInCents();

Expand All @@ -35,18 +35,14 @@ default boolean hasPermission(BankAccountUserPermission permission) {

void revokePermission(BankAccountUserPermission permission);

void updateFromDatabase();

void remove();

@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
enum BankAccountUserPermission {
PAYOUT("allow_payout"),
TRANSFER_MONEY("allow_transfers"),
CREATE_NEW_CARDS("allow_create_new_bank_cars"),
ADD_NEW_USERS("allow_adding_new_users"),
REMOVE_USERS("allow_removing_other_users");
CREATE_NEW_CARDS("allowed_to_create_new_bank_cards"),
ADD_NEW_USERS("allowed_to_add_new_users"),
REMOVE_USERS("allowed_to_remove_other_users");

private final String code;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/minevalley/core/api/economy/BankAccount.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ default AccountUser getAccountUser(Registrant registrant) {
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
enum AccountType {
USER("DE00-"),
COMPANY("DE01-"),
ASSOCIATION("DE02-"),
SECOND_ACCOUNT("DE03-");
SECOND_ACCOUNT("DE01-"),
COMPANY("DE02-"),
ASSOCIATION("DE03-");

private final String prefix;

Expand All @@ -97,11 +97,11 @@ public static AccountType getAccountType(String iban) {
case "DE00":
return USER;
case "DE01":
return COMPANY;
return SECOND_ACCOUNT;
case "DE02":
return ASSOCIATION;
return COMPANY;
case "DE03":
return SECOND_ACCOUNT;
return ASSOCIATION;
default:
return null;
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/minevalley/core/api/users/OnlineUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import lombok.NonNull;
import lombok.Setter;
import minevalley.core.api.ChatMenu;
import minevalley.core.api.economy.AccountUser;
import minevalley.core.api.economy.BankAccount;
import minevalley.core.api.enums.FractionService;
import minevalley.core.api.enums.McVersion;
Expand Down Expand Up @@ -319,9 +320,10 @@ default void leaveInterface() {
* If he chooses nothing, the callback isn't called.
* If he's only permissioned to transfer money from one account, he will not be asked (The callback will be called immediately with the account).
*
* @param callback callback with the chosen bank account
* @param callback callback with the chosen bank account
* @param requiredPermissions permissions that need to be granted to this user to let him choose the specific bank account
*/
void askForBankAccount(Consumer<BankAccount> callback);
void askForBankAccount(Consumer<BankAccount> callback, AccountUser.BankAccountUserPermission... requiredPermissions);

// FractionService

Expand Down

0 comments on commit aad3471

Please sign in to comment.