bank info

This commit is contained in:
Tue 2022-09-21 14:06:59 +07:00
parent 22cd1eb18f
commit 6b168cd98a
3 changed files with 28 additions and 4 deletions

View File

@ -37,3 +37,19 @@ func (s Bank) GetBankById(bankID string) (*model.BankBrief, error) {
return r.Data, nil
}
func (s Bank) CheckBankAndBranchByID(p model.BankBranchRequest) bool {
msg, err := natsio.GetServer().Request(subject.Bank.CheckBankAndBranchByID, toBytes(p))
if err != nil {
return false
}
var r struct {
Error string `json:"error"`
}
if err = json.Unmarshal(msg.Data, &r); err != nil {
return false
}
return r.Error == ""
}

View File

@ -0,0 +1,6 @@
package model
type BankBranchRequest struct {
BankID string `json:"bankId"`
BranchID string `json:"branchId"`
}

View File

@ -7,9 +7,11 @@ func getBankValue(val string) string {
}
var Bank = struct {
GetBankById string
GetBankBranchById string
GetBankById string
GetBankBranchById string
CheckBankAndBranchByID string
}{
GetBankById: getBankValue("get_bank_by_id"),
GetBankBranchById: getBankValue("get_bank_branch_by_id"),
GetBankById: getBankValue("get_bank_by_id"),
GetBankBranchById: getBankValue("get_bank_branch_by_id"),
CheckBankAndBranchByID: getBankValue("check_bank_and_brach_by_id"),
}