Skip to content

Commit 9bcce06

Browse files
authored
Merge pull request #171 from moov-io/include-clearbit-logos-in-responses
feat: add clearbit logos in responses when configured
2 parents bba3700 + 1a0ca7a commit 9bcce06

21 files changed

+396
-52
lines changed

ACHDictionary.go

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"unicode/utf8"
1818

1919
"github.com/moov-io/base"
20+
"github.com/moov-io/fed/pkg/logos"
2021
"github.com/moov-io/fed/pkg/strcmp"
2122
"golang.org/x/text/cases"
2223
"golang.org/x/text/language"
@@ -83,6 +84,11 @@ type ACHParticipant struct {
8384
// ViewCode is current view
8485
// 1 = Current view
8586
ViewCode string `json:"viewCode"`
87+
88+
// CleanName is our cleaned up value of CustomerName
89+
CleanName string `json:"cleanName"`
90+
// Logo from third-party provider (if enabled)
91+
Logo *logos.Logo `json:"logo"`
8692
}
8793

8894
type achParticipantResult struct {

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ PONG
194194
| `HTTPS_CERT_FILE` | Filepath containing a certificate (or intermediate chain) to be served by the HTTP server. Requires all traffic be over secure HTTP. | Empty |
195195
| `HTTPS_KEY_FILE` | Filepath of a private key matching the leaf certificate from `HTTPS_CERT_FILE`. | Empty |
196196

197+
#### Logos
198+
199+
| Environmental Variable | Description | Default |
200+
|------------------------|-------------------------------------------------------|---------|
201+
| `CLEARBIT_API_KEY` | API key for connecting to Clearbit for logo requests. | Empty |
202+
| `LOGO_CACHE_SIZE` | Maximum size for an in-memory cache of logos. | Empty |
203+
197204
### Data persistence
198205
By design, Fed **does not persist** (save) any data about the search queries created. The only storage occurs in memory of the process and upon restart Fed will have no files or data saved. Also, no in-memory encryption of the data is performed.
199206

WIREDictionary.go

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"unicode/utf8"
1616

1717
"github.com/moov-io/base"
18+
"github.com/moov-io/fed/pkg/logos"
1819
"github.com/moov-io/fed/pkg/strcmp"
1920
)
2021

@@ -71,6 +72,11 @@ type WIREParticipant struct {
7172
BookEntrySecuritiesTransferStatus string `json:"bookEntrySecuritiesTransferStatus"`
7273
// Date of last revision: YYYYMMDD, or blank
7374
Date string `json:"date"`
75+
76+
// CleanName is our cleaned up value of CustomerName
77+
CleanName string `json:"cleanName"`
78+
// Logo from third-party provider (if enabled)
79+
Logo *logos.Logo `json:"logo"`
7480
}
7581

7682
// WIRELocation is the city and state

api/client.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,12 @@ components:
263263
enum:
264264
- 1
265265
example: '1'
266+
cleanName:
267+
type: string
268+
description: Normalized name of ACH participant
269+
example: Chase
270+
logo:
271+
$ref: '#/components/schemas/Logo'
266272
ACHLocation:
267273
description: ACHLocation is the FEDACH delivery address
268274
properties:
@@ -367,6 +373,12 @@ components:
367373
* YYYYMMDD
368374
* Blank
369375
example: '20190401'
376+
cleanName:
377+
type: string
378+
description: Normalized name of Wire participant
379+
example: Chase
380+
logo:
381+
$ref: '#/components/schemas/Logo'
370382
WIRELocation:
371383
description: WIRELocation is the FEDWIRE delivery address
372384
properties:
@@ -381,3 +393,14 @@ components:
381393
maxLength: 2
382394
description: State
383395
example: 'IA'
396+
Logo:
397+
description: Company logo of the Fed ACH or Wire participant
398+
properties:
399+
name:
400+
type: string
401+
description: Company name
402+
example: Chase
403+
url:
404+
type: string
405+
description: URL to the company logo
406+
example: "https://logo.clearbit.com/chase.com"

client/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Class | Method | HTTP request | Description
4444
- [AchLocation](docs/AchLocation.md)
4545
- [AchParticipant](docs/AchParticipant.md)
4646
- [Error](docs/Error.md)
47+
- [Logo](docs/Logo.md)
4748
- [WireDictionary](docs/WireDictionary.md)
4849
- [WireLocation](docs/WireLocation.md)
4950
- [WireParticipant](docs/WireParticipant.md)

client/api/openapi.yaml

+65-15
Original file line numberDiff line numberDiff line change
@@ -218,31 +218,39 @@ components:
218218
description: Search results containing ACHDictionary of Participants
219219
example:
220220
ACHParticipants:
221-
- routingNumber: "044112187"
221+
- officeCode: O
222+
servicingFRBNumber: "041000014"
223+
viewCode: "1"
224+
customerName: FARMERS & MERCHANTS BANK
225+
cleanName: Chase
226+
routingNumber: "044112187"
222227
phoneNumber: "7407325621"
223-
officeCode: O
228+
logo:
229+
name: Chase
230+
url: https://logo.clearbit.com/chase.com
224231
newRoutingNumber: "000000000"
225-
servicingFRBNumber: "041000014"
226232
recordTypeCode: "1"
227233
revised: "20190311"
228-
viewCode: "1"
229-
customerName: FARMERS & MERCHANTS BANK
230234
achLocation:
231235
postalExtension: "0000"
232236
address: 430 NORTH ST
233237
city: CALDWELL
234238
postalCode: "43724"
235239
state: OH
236240
statusCode: "1"
237-
- routingNumber: "044112187"
241+
- officeCode: O
242+
servicingFRBNumber: "041000014"
243+
viewCode: "1"
244+
customerName: FARMERS & MERCHANTS BANK
245+
cleanName: Chase
246+
routingNumber: "044112187"
238247
phoneNumber: "7407325621"
239-
officeCode: O
248+
logo:
249+
name: Chase
250+
url: https://logo.clearbit.com/chase.com
240251
newRoutingNumber: "000000000"
241-
servicingFRBNumber: "041000014"
242252
recordTypeCode: "1"
243253
revised: "20190311"
244-
viewCode: "1"
245-
customerName: FARMERS & MERCHANTS BANK
246254
achLocation:
247255
postalExtension: "0000"
248256
address: 430 NORTH ST
@@ -259,15 +267,19 @@ components:
259267
description: ACHParticipant holds a FedACH dir routing record as defined by
260268
Fed ACH Format. https://www.frbservices.org/EPaymentsDirectory/achFormat.html
261269
example:
270+
officeCode: O
271+
servicingFRBNumber: "041000014"
272+
viewCode: "1"
273+
customerName: FARMERS & MERCHANTS BANK
274+
cleanName: Chase
262275
routingNumber: "044112187"
263276
phoneNumber: "7407325621"
264-
officeCode: O
277+
logo:
278+
name: Chase
279+
url: https://logo.clearbit.com/chase.com
265280
newRoutingNumber: "000000000"
266-
servicingFRBNumber: "041000014"
267281
recordTypeCode: "1"
268282
revised: "20190311"
269-
viewCode: "1"
270-
customerName: FARMERS & MERCHANTS BANK
271283
achLocation:
272284
postalExtension: "0000"
273285
address: 430 NORTH ST
@@ -367,6 +379,12 @@ components:
367379
maxLength: 1
368380
minLength: 1
369381
type: string
382+
cleanName:
383+
description: Normalized name of ACH participant
384+
example: Chase
385+
type: string
386+
logo:
387+
$ref: '#/components/schemas/Logo'
370388
ACHLocation:
371389
description: ACHLocation is the FEDACH delivery address
372390
example:
@@ -409,23 +427,31 @@ components:
409427
example:
410428
WIREParticipants:
411429
- date: "20190401"
430+
cleanName: Chase
412431
routingNumber: "091905114"
413432
wireLocation:
414433
city: IOWA CITY
415434
state: IA
416435
fundsTransferStatus: Y
417436
fundsSettlementOnlyStatus: S
418437
telegraphicName: MIDWESTONE B&T
438+
logo:
439+
name: Chase
440+
url: https://logo.clearbit.com/chase.com
419441
customerName: MIDWESTONE BK
420442
bookEntrySecuritiesTransferStatus: N
421443
- date: "20190401"
444+
cleanName: Chase
422445
routingNumber: "091905114"
423446
wireLocation:
424447
city: IOWA CITY
425448
state: IA
426449
fundsTransferStatus: Y
427450
fundsSettlementOnlyStatus: S
428451
telegraphicName: MIDWESTONE B&T
452+
logo:
453+
name: Chase
454+
url: https://logo.clearbit.com/chase.com
429455
customerName: MIDWESTONE BK
430456
bookEntrySecuritiesTransferStatus: N
431457
properties:
@@ -438,13 +464,17 @@ components:
438464
Fed WIRE Format. https://frbservices.org/EPaymentsDirectory/fedwireFormat.html
439465
example:
440466
date: "20190401"
467+
cleanName: Chase
441468
routingNumber: "091905114"
442469
wireLocation:
443470
city: IOWA CITY
444471
state: IA
445472
fundsTransferStatus: Y
446473
fundsSettlementOnlyStatus: S
447474
telegraphicName: MIDWESTONE B&T
475+
logo:
476+
name: Chase
477+
url: https://logo.clearbit.com/chase.com
448478
customerName: MIDWESTONE BK
449479
bookEntrySecuritiesTransferStatus: N
450480
properties:
@@ -510,6 +540,12 @@ components:
510540
example: "20190401"
511541
maxLength: 8
512542
type: string
543+
cleanName:
544+
description: Normalized name of Wire participant
545+
example: Chase
546+
type: string
547+
logo:
548+
$ref: '#/components/schemas/Logo'
513549
WIRELocation:
514550
description: WIRELocation is the FEDWIRE delivery address
515551
example:
@@ -527,11 +563,25 @@ components:
527563
maxLength: 2
528564
minLength: 2
529565
type: string
566+
Logo:
567+
description: Company logo of the Fed ACH or Wire participant
568+
example:
569+
name: Chase
570+
url: https://logo.clearbit.com/chase.com
571+
properties:
572+
name:
573+
description: Company name
574+
example: Chase
575+
type: string
576+
url:
577+
description: URL to the company logo
578+
example: https://logo.clearbit.com/chase.com
579+
type: string
530580
Error:
531581
properties:
532582
error:
533583
description: An error message describing the problem intended for humans.
534-
example: Validation error(s) present.
584+
example: Example error, see description
535585
type: string
536586
required:
537587
- error

client/docs/AchParticipant.md

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ Name | Type | Description | Notes
1515
**PhoneNumber** | **string** | The Financial Institution's phone number | [optional]
1616
**StatusCode** | **string** | Code is based on the customers receiver code * `1` - Receives Gov/Comm | [optional]
1717
**ViewCode** | **string** | Code is current view * `1` - Current view | [optional]
18+
**CleanName** | **string** | Normalized name of ACH participant | [optional]
19+
**Logo** | [**Logo**](Logo.md) | | [optional]
1820

1921
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
2022

client/docs/Logo.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Logo
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**Name** | **string** | Company name | [optional]
8+
**Url** | **string** | URL to the company logo | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

client/docs/WireParticipant.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Name | Type | Description | Notes
1212
**FundsSettlementOnlyStatus** | **string** | Designates funds settlement only status * `S` - Settlement-Only | [optional]
1313
**BookEntrySecuritiesTransferStatus** | **string** | Designates book entry securities transfer status * `Y` - Eligible * `N` - Ineligible | [optional]
1414
**Date** | **string** | Date of last revision * YYYYMMDD * Blank | [optional]
15+
**CleanName** | **string** | Normalized name of Wire participant | [optional]
16+
**Logo** | [**Logo**](Logo.md) | | [optional]
1517

1618
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1719

client/model_ach_participant.go

+3
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,7 @@ type AchParticipant struct {
3232
StatusCode string `json:"statusCode,omitempty"`
3333
// Code is current view * `1` - Current view
3434
ViewCode string `json:"viewCode,omitempty"`
35+
// Normalized name of ACH participant
36+
CleanName string `json:"cleanName,omitempty"`
37+
Logo Logo `json:"logo,omitempty"`
3538
}

client/model_logo.go

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/*
2+
* FED API
3+
*
4+
* FED API is designed to create FEDACH and FEDWIRE dictionaries. The FEDACH dictionary contains receiving depository financial institutions (RDFI’s) which are qualified to receive ACH entries. The FEDWIRE dictionary contains receiving depository financial institutions (RDFI’s) which are qualified to receive WIRE entries. This project implements a modern REST HTTP API for FEDACH Dictionary and FEDWIRE Dictionary.
5+
*
6+
* API version: v1
7+
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
8+
*/
9+
10+
package openapi
11+
12+
// Logo Company logo of the Fed ACH or Wire participant
13+
type Logo struct {
14+
// Company name
15+
Name string `json:"name,omitempty"`
16+
// URL to the company logo
17+
Url string `json:"url,omitempty"`
18+
}

client/model_wire_participant.go

+3
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ type WireParticipant struct {
2626
BookEntrySecuritiesTransferStatus string `json:"bookEntrySecuritiesTransferStatus,omitempty"`
2727
// Date of last revision * YYYYMMDD * Blank
2828
Date string `json:"date,omitempty"`
29+
// Normalized name of Wire participant
30+
CleanName string `json:"cleanName,omitempty"`
31+
Logo Logo `json:"logo,omitempty"`
2932
}

cmd/server/main.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"github.com/moov-io/base/http/bind"
2323
"github.com/moov-io/base/log"
2424
"github.com/moov-io/fed"
25+
"github.com/moov-io/fed/pkg/logos"
2526

2627
"github.com/gorilla/mux"
2728
)
@@ -114,8 +115,11 @@ func main() {
114115
os.Exit(1)
115116
}
116117

118+
// Create our logo grabber
119+
logoGrabber := logos.NewGrabber()
120+
117121
// Add searcher for HTTP routes
118-
addSearchRoutes(logger, router, searcher)
122+
addSearchRoutes(logger, router, searcher, logoGrabber)
119123

120124
// Start business logic HTTP server
121125
go func() {

0 commit comments

Comments
 (0)