-
Notifications
You must be signed in to change notification settings - Fork 0
/
wb.go
39 lines (33 loc) · 984 Bytes
/
wb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package wb
import (
"encoding/json"
"io/ioutil"
"path"
"runtime"
)
type Bank struct {
Name string `json:"name"`
Address string `json:"address"`
Businessname string `json:"business_name"`
BranchCode string `json:"branch_code"`
Code string `json:"code"`
Description string `json:"description"`
SwiftCode string `json:"swift_code"`
StateProvince string `json:"state_province"`
StateProvinceCode string `json:"state_province_code"`
City string `json:"city"`
Website string `json:"website"`
Branches []string `json:"branches"`
}
func GetNigerianBanks() ([]Bank, error) {
var banks []Bank
_, fn, _, _ := runtime.Caller(0)
banksJson, err := ioutil.ReadFile(path.Join(path.Dir(fn), "data/nigeria.json"))
if err != nil {
return banks, err
}
if err := json.Unmarshal(banksJson, &banks); err != nil {
return banks, err
}
return banks, nil
}