Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from rrk12005/SWF-3-setup-data-models
SWE-3 created data models
  • Loading branch information
ahm11003 committed Jan 23, 2019
2 parents aa9165e + 0fb5ecc commit aa1a19b
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 3 deletions.
17 changes: 14 additions & 3 deletions SynchronyFinancial/SynchronyFinancial.xcodeproj/project.pbxproj
Expand Up @@ -8,6 +8,10 @@

/* Begin PBXBuildFile section */
281283568A34D3C5D9C7B383 /* libPods-SynchronyFinancial WatchKit Extension.a in Frameworks */ = {isa = PBXBuildFile; fileRef = CAA6D46F907ADAABF49FD409 /* libPods-SynchronyFinancial WatchKit Extension.a */; };
6717460A21F8FCBF00696468 /* Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6717460921F8FCBE00696468 /* Transaction.swift */; };
6717460C21F8FCC100696468 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6717460B21F8FCC100696468 /* Account.swift */; };
6717460D21F8FCD800696468 /* Account.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6717460B21F8FCC100696468 /* Account.swift */; };
6717460E21F8FCDB00696468 /* Transaction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6717460921F8FCBE00696468 /* Transaction.swift */; };
673F396E21A644570051469E /* MainMenuInterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673F396C21A644460051469E /* MainMenuInterfaceController.swift */; };
673F397021A652A00051469E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 673F396F21A652A00051469E /* Assets.xcassets */; };
67BAC269219E254700713FEF /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67BAC268219E254700713FEF /* AppDelegate.swift */; };
Expand Down Expand Up @@ -66,12 +70,14 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
673F396C21A644460051469E /* MainMenuInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuInterfaceController.swift; sourceTree = "<group>"; };
673F396F21A652A00051469E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
1BEF4B8BF190D117CA6104E5 /* Pods-SynchronyFinancial WatchKit App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit App.release.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit App/Pods-SynchronyFinancial WatchKit App.release.xcconfig"; sourceTree = "<group>"; };
250BDAF6AD4E1CCA82995E30 /* Pods-SynchronyFinancial WatchKit Extension.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit Extension.release.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit Extension/Pods-SynchronyFinancial WatchKit Extension.release.xcconfig"; sourceTree = "<group>"; };
396A16E056D05DEC937A07DA /* Pods-SynchronyFinancial.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial.release.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial/Pods-SynchronyFinancial.release.xcconfig"; sourceTree = "<group>"; };
4EA10823B2E5A7A4FEF31740 /* libPods-SynchronyFinancial WatchKit App.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SynchronyFinancial WatchKit App.a"; sourceTree = BUILT_PRODUCTS_DIR; };
6717460921F8FCBE00696468 /* Transaction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Transaction.swift; path = /Users/alanmaynard/SynchronyFinancialWatchApp/SynchronyFinancial/SynchronyFinancial/Transaction.swift; sourceTree = "<absolute>"; };
6717460B21F8FCC100696468 /* Account.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Account.swift; path = /Users/alanmaynard/SynchronyFinancialWatchApp/SynchronyFinancial/SynchronyFinancial/Account.swift; sourceTree = "<absolute>"; };
673F396C21A644460051469E /* MainMenuInterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainMenuInterfaceController.swift; sourceTree = "<group>"; };
673F396F21A652A00051469E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
67BAC265219E254700713FEF /* SynchronyFinancial.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SynchronyFinancial.app; sourceTree = BUILT_PRODUCTS_DIR; };
67BAC268219E254700713FEF /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
67BAC26D219E254700713FEF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
Expand All @@ -85,7 +91,6 @@
67BAC28D219E254900713FEF /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
67BAC291219E254900713FEF /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
67BAC293219E254900713FEF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
67BAC294219E254900713FEF /* PushNotificationPayload.apns */ = {isa = PBXFileReference; lastKnownFileType = text; path = PushNotificationPayload.apns; sourceTree = "<group>"; };
9F53D0FFFE126D2BE8D08B80 /* Pods-SynchronyFinancial WatchKit App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial WatchKit App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial WatchKit App/Pods-SynchronyFinancial WatchKit App.debug.xcconfig"; sourceTree = "<group>"; };
B4F433747E1B9A2ED14BA462 /* Pods-SynchronyFinancial.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SynchronyFinancial.debug.xcconfig"; path = "Pods/Target Support Files/Pods-SynchronyFinancial/Pods-SynchronyFinancial.debug.xcconfig"; sourceTree = "<group>"; };
CAA6D46F907ADAABF49FD409 /* libPods-SynchronyFinancial WatchKit Extension.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SynchronyFinancial WatchKit Extension.a"; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -146,6 +151,8 @@
67BAC267219E254700713FEF /* SynchronyFinancial */ = {
isa = PBXGroup;
children = (
6717460B21F8FCC100696468 /* Account.swift */,
6717460921F8FCBE00696468 /* Transaction.swift */,
67BAC268219E254700713FEF /* AppDelegate.swift */,
67BAC26C219E254700713FEF /* Main.storyboard */,
67BAC26F219E254800713FEF /* Assets.xcassets */,
Expand Down Expand Up @@ -404,7 +411,9 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6717460A21F8FCBF00696468 /* Transaction.swift in Sources */,
67BAC269219E254700713FEF /* AppDelegate.swift in Sources */,
6717460C21F8FCC100696468 /* Account.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -414,6 +423,8 @@
files = (
67BAC28E219E254900713FEF /* ExtensionDelegate.swift in Sources */,
673F396E21A644570051469E /* MainMenuInterfaceController.swift in Sources */,
6717460E21F8FCDB00696468 /* Transaction.swift in Sources */,
6717460D21F8FCD800696468 /* Account.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
26 changes: 26 additions & 0 deletions SynchronyFinancial/SynchronyFinancial/Account.swift
@@ -0,0 +1,26 @@
//
// Account.swift
//
//
// Created by Alan Maynard on 1/23/19.
//
import Foundation

class Account: NSObject {
var accountNumber: String
var limit: Double
var balance: Double
var transactions: [Transaction]
var paymentDueDate: Date
var cycleEndDate: Date

init(accountNumber: String, limit: Double, transactions: [Transaction], paymentDueDate: Date, cycleEndDate: Date) {
self.accountNumber = accountNumber
self.limit = limit
self.transactions = transactions
self.accountBalance = transactions.map { $0.amount }.reduce(0.0, +)
self.paymentDueDate = paymentDueDate
self.cycleEndDate = cycleEndDate
}
}
27 changes: 27 additions & 0 deletions SynchronyFinancial/SynchronyFinancial/Transaction.swift
@@ -0,0 +1,27 @@
//
// Transaction.swift
//
//
// Created by Alan Maynard on 1/23/19.
//
import Foundation

public enum TransactionType: Int {
case purchase = 0
case reimbursement = 1
}

class Transaction: NSObject {
var type: TransactionType
var amount: Double
var merchantID: String
var date: Date

init(type: TransactionType, amount: Double, merchantID: String, date: Date) {
self.type = type
self.amount = amount
self.merchantID = merchantID
self.date = date
}
}

0 comments on commit aa1a19b

Please sign in to comment.