Skip to content

Commit

Permalink
ofac: use sanctionslistservice.ofac.treas.gov
Browse files Browse the repository at this point in the history
Issue: #550
  • Loading branch information
adamdecaf committed Jan 6, 2025
1 parent ff84b35 commit 7f361c9
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 14 deletions.
10 changes: 5 additions & 5 deletions pkg/ofac/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ import (

var (
ofacFilenames = []string{
"add.csv", // Address
"alt.csv", // Alternate ID
"sdn.csv", // Specially Designated National
"sdn_comments.csv", // Specially Designated National Comments
"ADD.CSV", // Address
"ALT.CSV", // Alternate ID
"SDN.CSV", // Specially Designated National
"SDN_COMMENTS.CSV", // Specially Designated National Comments
}

ofacURLTemplate = func() string {
if v := os.Getenv("OFAC_DOWNLOAD_TEMPLATE"); v != "" {
return v
}
return "https://www.treasury.gov/ofac/downloads/%s"
return "https://sanctionslistservice.ofac.treas.gov/api/PublicationPreview/exports/%s"
}()
)

Expand Down
12 changes: 5 additions & 7 deletions pkg/ofac/download_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ package ofac
import (
"os"
"path/filepath"
"strings"
"testing"

"github.com/moov-io/base/log"
"github.com/stretchr/testify/require"
)

func TestDownloader(t *testing.T) {
Expand All @@ -18,15 +20,11 @@ func TestDownloader(t *testing.T) {
}

files, err := Download(log.NewNopLogger(), "")
if err != nil {
t.Fatal(err)
}
require.NoError(t, err)
require.Len(t, files, 4)

if len(files) != 4 {
t.Errorf("OFAC: found %d files", len(files))
}
for fn := range files {
name := filepath.Base(fn)
name := strings.ToLower(filepath.Base(fn))
switch name {
case "add.csv", "alt.csv", "sdn.csv", "sdn_comments.csv":
continue
Expand Down
3 changes: 2 additions & 1 deletion pkg/ofac/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ import (
func Read(files map[string]io.ReadCloser) (*Results, error) {
res := new(Results)
for filename, file := range files {
switch filepath.Base(filename) {
switch strings.ToLower(filepath.Base(filename)) {
case "add.csv":
err := res.append(csvAddressFile(file))
if err != nil {
return nil, fmt.Errorf("add.csv: %v", err)
}

case "alt.csv":
err := res.append(csvAlternateIdentityFile(file))
if err != nil {
Expand Down
44 changes: 44 additions & 0 deletions pkg/ofac/testdata/add.csv
Original file line number Diff line number Diff line change
Expand Up @@ -21563,6 +21563,7 @@
50541,76627,"CY-3046 Limassol, Patmou","Zakaki 11A","Cyprus",-0-
50541,76628,-0- ,-0- ,"Hungary",-0-
50542,76630,"VG Torta, OMC Chambers, Wickhams Cay 1.",-0- ,"Virgin Islands, British",-0-
50543,76632,"Room 103, Building 6, No. 9, Fenghao East Road, Haidian District","Beijing","China",-0-
50544,76634,"Ul. Timura Frunze, D. 11, Str. 1, Floor 1, Pomeshch. I, Kom. 2","Moscow 119021","Russia",-0-
50545,76637,-0- ,"Yitzhar","Region: West Bank",-0-
50546,76639,"Number 3, Kagzar Alley, Shahid Hedayeti Avenue, Shahid Soleimani Expressway","Tehran 1675646611","Iran",-0-
Expand Down Expand Up @@ -22316,6 +22317,7 @@
51394,78262,-0- ,-0- ,"Mexico",-0-
51395,78264,-0- ,-0- ,"Mexico",-0-
51396,78266,-0- ,-0- ,"Mexico",-0-
51399,78270,-0- ,"Tehran","Iran",-0-
51400,78275,-0- ,-0- ,"Lithuania",-0-
51400,78276,-0- ,"Santa Cruz de Tenerife","Spain",-0-
51401,78278,-0- ,-0- ,"Lithuania",-0-
Expand All @@ -22336,6 +22338,7 @@
51417,78312,"XVI Krajiske Motorizovane Brigade 63","Laktasi 78250","Bosnia and Herzegovina",-0-
51418,78325,-0- ,-0- ,"Bosnia and Herzegovina",-0-
51419,78317,-0- ,-0- ,"Venezuela",-0-
51420,78386,"Ul. Dinamovskaya D.1a, Office 409","Moscow 109044","Russia",-0-
51427,78329,"Nab. Kanala Griboedova D. 6/2, Lit. A","Saint Petersburg 191186","Russia",-0-
51427,78330,"PR-KT Malyi V.O.D. 43, K. 2, Lit. V, Floor 2, Pomeshch. 31","Saint Petersburg 199178","Russia",-0-
51428,78332,"Ul. Timiryazeva D. 7","Irkutsk 664003","Russia",-0-
Expand Down Expand Up @@ -22367,6 +22370,7 @@
51450,78770,-0- ,-0- ,"Israel",-0-
51451,78384,-0- ,-0- ,"Region: West Bank",-0-
51451,78771,-0- ,-0- ,"Israel",-0-
51452,78388,-0- ,"Moscow","Russia",-0-
51453,78391,"Ul. Staraya Basmannaya D. 19, Str. 12, Kom. 22","Moscow 105066","Russia",-0-
51454,78392,"Bld. 1, St Pyatnitskaya, 31/2","Moscow 119017","Russia",-0-
51455,78394,"Prosp. Pobedy D. 22","Cherepovets 162606","Russia",-0-
Expand Down Expand Up @@ -22578,21 +22582,61 @@
52189,79677,"d. 43 pom. 419, ul. Khabarovksaya","Yuzhno-Sakhalinsk 693020","Russia",-0-
52261,79821,"d. 15 k. 2 litera A pom.66-N ofis 625, liniya 26-Ya V.O.","St. Petersburg 199106","Russia",-0-
52263,79828,"Chengdu City High-Tech Zone, Tianfu Avenue North Section, Annex 18, Number 5","Chengdu, Sichuan","China",-0-
52265,79830,"Payam Rd, Mehrshahr","Karaj, Alborz Province","Iran",-0-
52269,79858,"80 Broad Street","Monrovia","Liberia",-0-
52269,79859,"2, Plastira Street, 166 73","Voula","Greece",-0-
52270,79841,"Trust Company Complex, Ajeltake Road","Majuro, Ajeltake Island 96960","Marshall Islands",-0-
52271,79842,-0- ,-0- ,-0- ,-0-
52272,79844,"Keizer Straat 40","Paramaribo","Suriname",-0-
52274,79847,"Unit 903, 9th Floor, Samarth Aishwarya, Off KL Walawalker Road","Mumbai 400053","India",-0-
52275,79848,-0- ,-0- ,-0- ,-0-
52284,79857,"Flat/Rm A 12/F ZJ 300, 300 Lockhart Road","Hong Kong","China",-0-
52285,79860,-0- ,-0- ,-0- ,-0-
52287,79863,-0- ,-0- ,-0- ,-0-
52288,79866,"Trust Company Complex, Ajeltake Road","Majuro, Ajeltake Island 96960","Marshall Islands",-0-
52291,79870,-0- ,"Shenyang","China",-0-
52291,79871,-0- ,"Pyongyang","Korea, North",-0-
52292,79873,-0- ,"Shenyang","China",-0-
52293,79875,-0- ,"Pyongyang","Korea, North",-0-
52294,79878,"Nasr Street","Sanaa","Yemen",-0-
52294,79879,"Street 75, Shiqiao Building, 3rd Floor, Door 4","Yiwu, Zhejiang","China",-0-
52297,79885,-0- ,-0- ,"Yemen",-0-
52298,79887,-0- ,-0- ,"Yemen",-0-
52299,79889,-0- ,-0- ,"Bosnia and Herzegovina",-0-
52300,79891,"Brace Pantica 2","Banja Luka 78000","Bosnia and Herzegovina",-0-
52301,79934,-0- ,-0- ,"Bosnia and Herzegovina",-0-
52302,79894,-0- ,-0- ,"Yemen",-0-
52304,79899,-0- ,"Hodeidah","Yemen",-0-
52304,79900,-0- ,"Sana'a","Yemen",-0-
52305,79901,"Unit 21-01, Level 21, Mercu Aspire KL Eco City, No 3 Jalan Bangsar","Kuala Lumpur 59200","Malaysia",-0-
52305,79902,"Suite A09-10 Block A Plaza Tarragon Kelana Jalan Ss6/6 Kelana Jaya","Petaling Jaya 47301","Malaysia",-0-
52307,79906,-0- ,"Sana'a","Yemen",-0-
52308,79908,-0- ,-0- ,"Yemen",-0-
52309,79988,-0- ,"Kuala Lumpur","Malaysia",-0-
52311,79912,"Unit 11-02, 11th Floor, Menara TJB, No. 9, Jalan Syed Mohd Mufti","Johor Bahru 80000","Malaysia",-0-
52316,79920,"Unit 11-02, 11th Floor, Menara TJB, No. 9, Jalan Syed Mohd Mufti","Johor Bahru 80000","Malaysia",-0-
52316,79921,"11-01, Jalan Balau 3, Taman Rinting, Masai","Johar Bahru 81750","Malaysia",-0-
52320,79927,-0- ,"Gradiska","Bosnia and Herzegovina",-0-
52321,79929,"Gornji Podgradci bb","Gradiska 78400","Bosnia and Herzegovina",-0-
52322,79931,-0- ,-0- ,"Bosnia and Herzegovina",-0-
52323,79933,"Ulica Jevrejska 67","Banja Luka 78000","Bosnia and Herzegovina",-0-
52324,79936,"Trg Krajine br. 2","Banja Luka 78000","Bosnia and Herzegovina",-0-
52325,79938,"Room 1202, Flat A, 12/F, Efficiency House, 35 Tai Yau Street, San Po Kong","Hong Kong","China",-0-
52325,79939,"39-09, Fuli Center, 6, Gangxing Lu, Zhongshan Qu","Dalian, Liaoning","China",-0-
52326,79940,-0- ,-0- ,-0- ,-0-
52327,79941,-0- ,-0- ,-0- ,-0-
52328,79942,-0- ,-0- ,-0- ,-0-
52329,79943,-0- ,-0- ,-0- ,-0-
52330,79945,"PO Box 1137","Victoria, Mahe Island","Seychelles",-0-
52331,79946,-0- ,-0- ,-0- ,-0-
52352,79989,-0- ,"Kuala Lumpur","Malaysia",-0-
52353,79991,-0- ,"Tehran","Iran",-0-
52353,79992,-0- ,-0- ,"Switzerland",-0-
52354,79994,"Ground Floor, No. 4, Payam Azadi cul-de-sac, Shahid Ahmad Ghasemi St., Timuri, Central Sector","Tehran City, Tehran Province","Iran",-0-
52355,79996,-0- ,"Lausanne","Switzerland",-0-
52356,79998,-0- ,"Tehran","Iran",-0-
52377,80019,"Varketili 3, 1 Micro Distr","Tbilisi","Georgia",-0-
52378,80021,-0- ,"Tbilisi","Georgia",-0-
52393,80049,-0- ,-0- ,"Georgia",-0-
52412,80068,-0- ,"Moscow","Russia",-0-

21 changes: 21 additions & 0 deletions pkg/ofac/testdata/alt.csv
Original file line number Diff line number Diff line change
Expand Up @@ -18907,6 +18907,7 @@
50523,78989,"aka","GITTA GAS",-0-
50523,78990,"aka","JUNO GAS",-0-
50526,78993,"aka","GEMGAZ",-0-
50543,79022,"aka","BEIJING INTEGRITY TECHNOLOGY COMPANY, LIMITED",-0-
50544,79025,"aka","AUTONOMOUS NON-PROFIT ORGANIZATION FOR THE DEVELOPMENT OF DIGITAL PROJECTS IN THE FIELD OF PUBLIC RELATIONS AND COMMUNICATIONS DIALOG REGIONS",-0-
50544,79026,"aka","ANO DIALOG REGIONS",-0-
50544,79030,"aka","AVTONOMNAYA NEKOMMERCHESKAYA ORGANIZATSIYA PO RAZVITIYU TSIFROVYKH PROEKTOV V SFERE OBSHCHESTEVENNYKH SVYAZEI I KOMMUNIKATSII DIALOG REGIONY",-0-
Expand Down Expand Up @@ -19328,6 +19329,7 @@
51412,80618,"aka","STAUSKAS, Soulius",-0-
51414,80622,"aka","LEUNG, Ho-Kar",-0-
51415,80624,"aka","JT TRADING LTD",-0-
51420,80687,"aka","MNF TSENTR GEOPOLITICHESKIKH EKSPERTIZ",-0-
51427,80639,"aka","AO AKTIV",-0-
51428,81524,"aka","AO RK TSENTR INVEST",-0-
51429,80643,"aka","AO DK REGION",-0-
Expand All @@ -19344,6 +19346,7 @@
51446,80675,"aka","AO NSFK",-0-
51450,80683,"aka","BAR AMANA SOCIETY & ASSOCIATIONS",-0-
51451,80686,"aka","BINYANEI BAR AMANA CONSTRUCTION AND DEVELOPMENT",-0-
51452,80689,"aka","KOROVIN, Valerii Mikhailovich",-0-
51453,81523,"aka","OBORONREGISTR",-0-
51456,80694,"aka","AO PRTS",-0-
51457,80696,"aka","JSC RDC PARITET",-0-
Expand Down Expand Up @@ -19450,17 +19453,35 @@
52164,81694,"aka","MORTADA, Abdulqader",-0-
52164,81695,"aka","AL-MURTAZA, Abdul Qader",-0-
52176,81710,"aka","MTV HOLDING",-0-
52265,81860,"aka","GHEZEL HESAR PENITENTIARY",-0-
52265,81861,"aka","QEZEL HESAR PENITENTIARY",-0-
52269,81871,"aka","ROSE SHIPPING LTD-LIB",-0-
52269,81872,"aka","ROSE SHIPPING LTD",-0-
52270,81874,"aka","JOURNEY INVESTMENT CO.",-0-
52271,81876,"aka","KOHO I",-0-
52285,81959,"aka","GATHER VIEW",-0-
52293,81904,"aka","KOREA KURYONGGANG TRADING CORPORATION",-0-
52293,81905,"aka","RYUNGSONG TRADING CORPORATION",-0-
52293,81906,"aka","RYUNGSENG TRADING CORPORATION",-0-
52293,81907,"aka","RYUNG SENG TRADING CORPORATION",-0-
52293,81908,"aka","KOREA TANGUN TRADING CORPORATION",-0-
52293,81909,"aka","KOREA KUWOLSAN TRADING CORPORATION",-0-
52293,81910,"aka","KOREA RYENHAP 2 TRADING CORPORATION",-0-
52294,81914,"aka","SAFWAN FOR SHIPPING AND TRADE",-0-
52297,81920,"aka","ABDULWADOD, Wail Mohammed Saeed",-0-
52298,81922,"aka","HAG, Omar Ahmed Omar Ahmed",-0-
52301,81926,"aka","DOBRIC, Aco",-0-
52304,81933,"aka","AL THAWR EXCHANGE",-0-
52305,81935,"aka","MERKUR ENERGY PORT SERVICES",-0-
52305,81937,"aka","MERKUR ENERGY PORTSERVICES SDN BHD",-0-
52307,81941,"aka","AL HAZMI EXCHANGE",-0-
52307,81942,"aka","AL-HAZMI COMPANY FOR EXCHANGE",-0-
52308,81944,"aka","AL HADI, Ahmad",-0-
52321,81962,"aka","GREEN APPLE D.O.O.",-0-
52324,81966,"aka","NAJBOLJA USLUGA DRUSTVO SA OGRANICENOM ODGOVORNOSCU BANJA LUKA",-0-
52324,81967,"aka","AGAPE BEST D.O.O. BANJA LUKA",-0-
52353,81999,"aka","ABEDINI NAJAFABADI, Mohammad",-0-
52354,82002,"aka","RAHPOOYAN AFLAK INDUSTRY AND KNOWLEDGE ENGINEERING COMPANY",-0-
52412,82097,"aka","MENDELEYEVA, Olesya",-0-
52412,82098,"aka","ANATOLIYIVNA, Mendelieieva Olesia",-0-

Loading

0 comments on commit 7f361c9

Please sign in to comment.