Skip to content

Commit 5d61682

Browse files
[CHEC-570][Payment Methods] Add Capabilities (#96)
1 parent ce4a01f commit 5d61682

7 files changed

Lines changed: 253 additions & 110 deletions

File tree

cleanse/cleanse.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ type PaymentMethod struct {
169169
LargeWidth int `json:"large_width"`
170170
LargeHeight int `json:"large_height"`
171171
Regions []string `json:"regions"`
172+
Capabilities []string `json:"capabilities"`
172173
}
173174

174175
type Separators struct {
@@ -392,6 +393,9 @@ func Cleanse() {
392393
),
393394
)
394395

396+
splitCapabilities := func(c rune) bool {
397+
return c == ' '
398+
}
395399
writeJson("data/cleansed/payment-methods.json",
396400
toObjects(readCsv("data/original/payment-methods.csv"),
397401
func(record map[string]string) bool {
@@ -409,6 +413,7 @@ func Cleanse() {
409413
LargeWidth: toInt32(record["large_width"]),
410414
LargeHeight: toInt32(record["large_height"]),
411415
Regions: strings.Split(record["regions"], " "),
416+
Capabilities: strings.FieldsFunc(record["capabilities"], splitCapabilities),
412417
}
413418
},
414419
func(record map[string]string) string {

common/common.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@ type Language struct {
6565
}
6666

6767
type PaymentMethod struct {
68-
Id string `json:"id"`
69-
Type string `json:"type"`
70-
Name string `json:"name"`
71-
Images PaymentMethodImages `json:"images"`
72-
Regions []string `json:"regions"`
68+
Id string `json:"id"`
69+
Type string `json:"type"`
70+
Name string `json:"name"`
71+
Images PaymentMethodImages `json:"images"`
72+
Regions []string `json:"regions"`
73+
Capabilities []string `json:"capabilities"`
7374
}
7475

7576
type PaymentMethodImages struct {

0 commit comments

Comments
 (0)