refactor-location #134
|
@ -17,15 +17,16 @@ func GetBank() Bank {
|
|||
return Bank{}
|
||||
}
|
||||
|
||||
func (s Bank) GetBankAndBranchByBankIDs(p model.GetBankAndBranchesRequest) ([]*model.ResponseBankAndBranches, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Bank.GetBankAndBranchesByBankIDs, toBytes(p))
|
||||
// GetBankInfo ...
|
||||
func (s Bank) GetBankInfo(p []model.GetBankInfoRequest) ([]*model.ResponseBankInfo, error) {
|
||||
msg, err := natsio.GetServer().Request(subject.Bank.GetBankInfo, toBytes(p))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var r struct {
|
||||
Data []*model.ResponseBankAndBranches `json:"data"`
|
||||
Error string `json:"error"`
|
||||
Data []*model.ResponseBankInfo `json:"data"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||
|
|
|
@ -5,6 +5,7 @@ type CheckBankAndBranchByIDRequest struct {
|
|||
BranchID string `json:"branchId"`
|
||||
}
|
||||
|
||||
type GetBankAndBranchesRequest struct {
|
||||
BankIDs []string `json:"bankIds"`
|
||||
type GetBankInfoRequest struct {
|
||||
BankID string `json:"bankId"`
|
||||
BranchID string `json:"branchId"`
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ type BankBrief struct {
|
|||
Logo interface{} `json:"logo"`
|
||||
}
|
||||
|
||||
type ResponseBankAndBranches struct {
|
||||
Bank BankBrief `json:"bank"`
|
||||
Branches []BranchBrief `json:"branches"`
|
||||
type ResponseBankInfo struct {
|
||||
Bank BankBrief `json:"bank"`
|
||||
Branch BranchBrief `json:"branch"`
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ func getBankValue(val string) string {
|
|||
}
|
||||
|
||||
var Bank = struct {
|
||||
GetBankAndBranchesByBankIDs string
|
||||
CheckBankAndBranchByID string
|
||||
GetBankInfo string
|
||||
CheckBankAndBranchByID string
|
||||
}{
|
||||
GetBankAndBranchesByBankIDs: getBankValue("get_bank_and_branches_by_bank_ids"),
|
||||
CheckBankAndBranchByID: getBankValue("check_bank_and_branch_by_id"),
|
||||
GetBankInfo: getBankValue("get_bank_info"),
|
||||
CheckBankAndBranchByID: getBankValue("check_bank_and_branch_by_id"),
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue