Skip to content

Commit

Permalink
Make ActivityCategory case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Nef10 committed Nov 5, 2021
1 parent 7418d09 commit 7021815
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions Sources/RogersBankDownloader/RogersActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,15 @@ public enum ActivityStatus: String, Codable {
}

/// Categorization for a credit card transaction
public enum ActivityCategory: String, Codable {
public enum ActivityCategory: String {
/// A Purchase, inclduing a refund
case purchase = "PURCHASE"
case purchase = "purchase"
/// A Payment towards the balance
case payment = "PAYMENT"
case payment = "payment"
/// A pre authorization for a purchase
case tokenAuthRequest = "Token Auth Request"
case tokenAuthRequest = "token auth request"
/// An authorization for an mail or phone order
case mailOrPhoneOrder = "Mail or Phone Order"
case mailOrPhoneOrder = "mail or phone order"
}

struct RogersCustomer: Customer, Codable {
Expand Down Expand Up @@ -231,3 +231,9 @@ struct RogersActivity: Activity, Codable {
rogersForeignCurrency
}
}

extension ActivityCategory: Codable {
public init(from decoder: Decoder) throws {
self = try ActivityCategory(rawValue: decoder.singleValueContainer().decode(RawValue.self).lowercased())!
}
}

0 comments on commit 7021815

Please sign in to comment.