refactor-location #134

Closed
trunglam wants to merge 270 commits from refactor-location into master
3 changed files with 27 additions and 3 deletions
Showing only changes of commit a3206ebdd4 - Show all commits

View File

@ -46,11 +46,33 @@ func (s Bank) CheckBankAndBranchByID(p model.CheckBankAndBranchByIDRequest) bool
}
var r struct {
Error string `json:"error"`
Data bool `json:"data"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return false
}
return r.Error == ""
return r.Data
}
// GetBankAndBranchDetail ...
func (s Bank) GetBankAndBranchDetail(p model.GetBankInfoRequest) (*model.ResponseBankInfo, error) {
msg, err := natsio.GetServer().Request(subject.Bank.GetBankInfoDetail, toBytes(p))
if err != nil {
return nil, err
}
var r struct {
Data *model.ResponseBankInfo `json:"data"`
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return nil, err
}
if r.Error != "" {
return nil, errors.New(r.Error)
}
return r.Data, nil
}

View File

@ -8,7 +8,7 @@ type MultiLang struct {
Vi string `json:"vi"`
}
// BankBranchBrief ...
// BranchBrief ...
type BranchBrief struct {
ID string `json:"_id"`
City string `json:"city"`

View File

@ -8,8 +8,10 @@ func getBankValue(val string) string {
var Bank = struct {
GetBankInfo string
GetBankInfoDetail string
CheckBankAndBranchByID string
}{
GetBankInfo: getBankValue("get_bank_info"),
GetBankInfoDetail: getBankValue("get_bank_info_detail"),
CheckBankAndBranchByID: getBankValue("check_bank_and_branch_by_id"),
}