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

Remove updatedAt from transactions #47

Merged
merged 1 commit into from May 16, 2018
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
1 change: 0 additions & 1 deletion OmiseGOTests/CodingTests/DecodeTests.swift
Expand Up @@ -385,7 +385,6 @@ class DecodeTests: XCTestCase {
XCTAssertEqual(exchange.rate, 1)
XCTAssertEqual(decodedData.status, .confirmed)
XCTAssertEqual(decodedData.createdAt, "2018-01-01T00:00:00Z".toDate(withFormat: "yyyy-MM-dd'T'HH:mm:ssZ"))
XCTAssertEqual(decodedData.updatedAt, "2018-01-01T10:00:00Z".toDate(withFormat: "yyyy-MM-dd'T'HH:mm:ssZ"))
XCTAssertTrue(decodedData.metadata.isEmpty)
XCTAssertTrue(decodedData.encryptedMetadata.isEmpty)
} catch let thrownError {
Expand Down
Expand Up @@ -61,8 +61,7 @@
"metadata": {},
"encrypted_metadata": {},
"status": "confirmed",
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
},
"transaction_request": {
"object": "transaction_request",
Expand Down
Expand Up @@ -61,8 +61,7 @@
"metadata": {},
"encrypted_metadata": {},
"status": "confirmed",
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
},
"transaction_request": {
"object": "transaction_request",
Expand Down
Expand Up @@ -46,8 +46,7 @@
"status": "confirmed",
"metadata": {},
"encrypted_metadata": {},
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
}

],
Expand Down
Expand Up @@ -61,8 +61,7 @@
"metadata": {},
"encrypted_metadata": {},
"status": "confirmed",
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
},
"transaction_request": {
"object": "transaction_request",
Expand Down
Expand Up @@ -65,8 +65,7 @@
"metadata": {},
"encrypted_metadata": {},
"status": "confirmed",
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
},
"transaction_request": {
"object": "transaction_request",
Expand Down
3 changes: 1 addition & 2 deletions OmiseGOTests/FixtureTests/Fixtures/objects/transaction.json
Expand Up @@ -40,6 +40,5 @@
"status": "confirmed",
"metadata": {},
"encrypted_metadata": {},
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
}
Expand Up @@ -58,8 +58,7 @@
"metadata": {},
"encrypted_metadata": {},
"status": "confirmed",
"created_at": "2018-01-01T00:00:00Z",
"updated_at": "2018-01-01T10:00:00Z"
"created_at": "2018-01-01T00:00:00Z"
},
"transaction_request": {
"object": "transaction_request",
Expand Down
1 change: 0 additions & 1 deletion OmiseGOTests/FixtureTests/TransactionFixtureTests.swift
Expand Up @@ -50,7 +50,6 @@ class TransactionFixtureTests: FixtureTestCase {
XCTAssertTrue(transaction.metadata.isEmpty)
XCTAssertTrue(transaction.encryptedMetadata.isEmpty)
XCTAssertEqual(transaction.createdAt, "2018-01-01T00:00:00Z".toDate())
XCTAssertEqual(transaction.updatedAt, "2018-01-01T10:00:00Z".toDate())
case .fail(error: let error):
XCTFail("\(error)")
}
Expand Down
6 changes: 2 additions & 4 deletions OmiseGOTests/Helpers/StubGenerator.swift
Expand Up @@ -187,8 +187,7 @@ class StubGenerator {
exchange: TransactionExchange? = nil,
metadata: [String: Any]? = nil,
encryptedMetadata: [String: Any]? = nil,
createdAt: Date? = nil,
updatedAt: Date? = nil)
createdAt: Date? = nil)
-> Transaction {
let v: Transaction = self.stub(forResource: "transaction")
return Transaction(
Expand All @@ -199,8 +198,7 @@ class StubGenerator {
exchange: exchange ?? v.exchange,
metadata: metadata ?? v.metadata,
encryptedMetadata: encryptedMetadata ?? v.encryptedMetadata,
createdAt: createdAt ?? v.createdAt,
updatedAt: updatedAt ?? v.updatedAt)
createdAt: createdAt ?? v.createdAt)
}

class func transactionSource(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -240,10 +240,10 @@ let paginationParams = PaginationParams<Transaction>(
Where:
- `page` is the page you wish to receive.
- `perPage` is the number of results per page.
- `sortBy` is the sorting field. Available values: `.id`, `.status`, `.from`, `.to`, `.createdAt`, `.updatedAt`
- `sortBy` is the sorting field. Available values: `.id`, `.status`, `.from`, `.to`, `.createdAt`
- `sortDir` is the sorting direction. Available values: `.ascending`, `.descending`
- `searchTerm` is a term to search for in ALL of the searchable fields. Conflict with search_terms, only use one of them. See list of searchable fields below (same as search_terms).
- `searchTerms` is a dictionary of fields to search in with the following available fields: `.id`, `.status`, `.from`, `.to`, `.createdAt`, `.updatedAt`. Ex: `[.from: "someAddress", .id: "someId"]`
Copy link

@ripzery ripzery May 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't delete .createdAt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's actually not supported by the API so it shouldn't be here :)

- `searchTerms` is a dictionary of fields to search in with the following available fields: `.id`, `.status`, `.from`, `.to`. Ex: `[.from: "someAddress", .id: "someId"]`

Then you can call:

Expand Down
5 changes: 0 additions & 5 deletions Source/Models/Transaction.swift
Expand Up @@ -36,8 +36,6 @@ public struct Transaction {
public let encryptedMetadata: [String: Any]
/// The creation date of the transaction
public let createdAt: Date
/// The last update date of the transaction
public let updatedAt: Date

}

Expand All @@ -52,7 +50,6 @@ extension Transaction: Decodable {
case metadata
case encryptedMetadata = "encrypted_metadata"
case createdAt = "created_at"
case updatedAt = "updated_at"
}

public init(from decoder: Decoder) throws {
Expand All @@ -63,7 +60,6 @@ extension Transaction: Decodable {
to = try container.decode(TransactionSource.self, forKey: .to)
exchange = try container.decode(TransactionExchange.self, forKey: .exchange)
createdAt = try container.decode(Date.self, forKey: .createdAt)
updatedAt = try container.decode(Date.self, forKey: .updatedAt)
metadata = try container.decode([String: Any].self, forKey: .metadata)
encryptedMetadata = try container.decode([String: Any].self, forKey: .encryptedMetadata)
}
Expand Down Expand Up @@ -104,7 +100,6 @@ extension Transaction: Paginable {
case from
case to
case createdAt = "created_at"
case updatedAt = "updated_at"
}

}
Expand Down