Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add korea card cases #8

Merged
merged 2 commits into from Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -33,3 +33,11 @@ let scannerView = DGCardScanner.getScanner { number, date, name in
self.present(scannerView, animated: true)
```

## High hit rate cards
```Please let me know if there is a card that you want to add by posting at Issues tab```
- NH
- Shinhan
- WOORI
- KB
- KAKAOBANK

12 changes: 12 additions & 0 deletions Sources/DGCardScanner/DGCardScanner.swift
Expand Up @@ -206,6 +206,10 @@ public class DGCardScanner: UIViewController {
continue
}
}

if let cardName = CARD.allCases.first(where: { trimmed.contains($0.rawValue.lowercased()) }).map({ $0.rawValue }) {
creditCardName = cardName
}
}

guard let creditCardName = self.creditCardName, let creditCardDate = self.creditCardDate, let creditCardNumber = self.creditCardNumber else { return }
Expand Down Expand Up @@ -319,3 +323,11 @@ extension DGCardScanner {
let cardNumber: String
}
}

enum CARD: String, CaseIterable {
case NH
case Shinhan
case KB
case WOORI
case KAKAOBANK
}