-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
abd16f3
commit 94bd021
Showing
16 changed files
with
394 additions
and
25 deletions.
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
149 changes: 149 additions & 0 deletions
149
Server/src/main/java/com/server/domain/account/domain/Bank.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,149 @@ | ||
package com.server.domain.account.domain; | ||
|
||
import com.server.global.entity.BaseEnum; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.function.Function; | ||
|
||
@RequiredArgsConstructor | ||
public enum Bank implements BaseEnum { | ||
KB("KB 국민은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 3) { | ||
return checkLen(chunk[0], 6) && checkLen(chunk[1], 2) && checkLen(chunk[2], 6); | ||
}else if(chunk.length == 4) { | ||
return checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 2) && | ||
checkLen(chunk[2], 4) && | ||
checkLen(chunk[3], 3); | ||
} | ||
return false; | ||
}), | ||
IBK("IBK 기업은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 4) { | ||
return checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 6) && | ||
checkLen(chunk[2], 2) && | ||
checkLen(chunk[3], 3); | ||
} | ||
return false; | ||
}), | ||
NH("농협은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 4) { | ||
return checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 4) && | ||
checkLen(chunk[2], 4) && | ||
checkLen(chunk[3], 2); | ||
} | ||
return false; | ||
}), | ||
SH("신한은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 3) { | ||
return (checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 2) && | ||
checkLen(chunk[2], 6)) || | ||
(checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 3) && | ||
checkLen(chunk[2], 6)); | ||
} | ||
return false; | ||
}), | ||
WR("우리은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if (chunk.length == 3) { | ||
return checkLen(chunk[0], 4) && checkLen(chunk[1], 3) && checkLen(chunk[2], 6); | ||
} | ||
return false; | ||
}), | ||
HN("KEB 하나은행(구 외환은행)", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 3) { | ||
return (checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 6) && | ||
checkLen(chunk[2], 5)) || | ||
(checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 6) && | ||
checkLen(chunk[2], 3)); | ||
} | ||
return false; | ||
}), | ||
CITY("씨티은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if (chunk.length == 3) { | ||
return checkLen(chunk[0], 3) && checkLen(chunk[1], 6) && checkLen(chunk[2], 3); | ||
} | ||
return false; | ||
}), | ||
DGB("DGB 대구은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 4) { | ||
return checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 2) && | ||
checkLen(chunk[2], 6) && | ||
checkLen(chunk[3], 1); | ||
} | ||
return false; | ||
}), | ||
BNK("BNK 부산은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if(chunk.length == 4) { | ||
return checkLen(chunk[0], 3) && | ||
checkLen(chunk[1], 4) && | ||
checkLen(chunk[2], 4) && | ||
checkLen(chunk[3], 2); | ||
} | ||
return false; | ||
}), | ||
SC("SC 제일은행", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if (chunk.length == 3) { | ||
return checkLen(chunk[0], 3) && checkLen(chunk[1], 2) && checkLen(chunk[2], 6); | ||
} | ||
return false; | ||
}), | ||
KBANK("케이뱅크", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if (chunk.length == 3) { | ||
return checkLen(chunk[0], 3) && checkLen(chunk[1], 3) && checkLen(chunk[2], 6); | ||
} | ||
return false; | ||
}), | ||
KAKAO("카카오뱅크", (attribute) -> { | ||
String[] chunk = attribute.split("-"); | ||
if (chunk.length == 3) { | ||
return checkLen(chunk[0], 4) && checkLen(chunk[1], 2) && checkLen(chunk[2], 7); | ||
} | ||
return false; | ||
}) | ||
; | ||
|
||
private final String description; | ||
|
||
private final Function<String, Boolean> checkAccount; | ||
|
||
public boolean checkAccount(String account) { | ||
return this.checkAccount.apply(account); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name(); | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return this.description; | ||
} | ||
|
||
private static boolean checkLen(String chunk, int len) { | ||
try { | ||
Long.parseLong(chunk); | ||
return chunk.length() == len; | ||
} catch (NumberFormatException e) { | ||
return false; | ||
} | ||
} | ||
} |
8 changes: 6 additions & 2 deletions
8
...ain/java/com/server/domain/adjustment/controller/dto/request/AccountUpdateApiRequest.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
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
11 changes: 11 additions & 0 deletions
11
...java/com/server/global/exception/businessexception/accountexception/AccountException.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,11 @@ | ||
package com.server.global.exception.businessexception.accountexception; | ||
|
||
import com.server.global.exception.businessexception.BusinessException; | ||
import org.springframework.http.HttpStatus; | ||
|
||
public abstract class AccountException extends BusinessException { | ||
|
||
protected AccountException(String errorCode, HttpStatus httpStatus, String message) { | ||
super(errorCode, httpStatus, message); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
.../server/global/exception/businessexception/accountexception/AccountNotValidException.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,16 @@ | ||
package com.server.global.exception.businessexception.accountexception; | ||
|
||
import com.server.global.exception.businessexception.answerexception.AnswerException; | ||
import lombok.Getter; | ||
import org.springframework.http.HttpStatus; | ||
|
||
@Getter | ||
public class AccountNotValidException extends AccountException { | ||
|
||
public static final String MESSAGE = "계좌 번호가 유효하지 않습니다."; | ||
public static final String CODE = "ANSWER-400"; | ||
|
||
public AccountNotValidException() { | ||
super(CODE, HttpStatus.BAD_REQUEST, MESSAGE); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
Server/src/main/java/com/server/module/firmbank/FirmBankService.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 |
---|---|---|
@@ -1,8 +1,9 @@ | ||
package com.server.module.firmbank; | ||
|
||
import com.server.domain.account.domain.Bank; | ||
import com.server.module.firmbank.response.AdjustmentResult; | ||
|
||
public interface FirmBankService { | ||
|
||
AdjustmentResult adjustment(String name, String account, String bank, int amount); | ||
AdjustmentResult adjustment(String name, String account, Bank bank, int amount); | ||
} |
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.