Skip to content

Commit

Permalink
Merge pull request #67 from uphold/feature/transaction-destination-ad…
Browse files Browse the repository at this point in the history
…dress

Add support for transaction destination address
  • Loading branch information
d-moreira authored Feb 20, 2018
2 parents 00f28d2 + 7f21216 commit 23d54fa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Source/Model/Transaction/Destination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ open class Destination: Mappable {
/// The type of the account from the destination of the transaction.
public private(set) final var accountType: String?

/// The address from the destination of the transaction.
public private(set) final var address: String?

/// The amount from the destination of the transaction.
public private(set) final var amount: String?

Expand Down Expand Up @@ -52,6 +55,7 @@ open class Destination: Mappable {
- parameter accountId: The id of the account from the destination of the transaction.
- parameter cardId: The card id of the card from the destination of the transaction.
- parameter accountType: The type of the account from the destination of the transaction.
- parameter address: The address from the destination of the transaction.
- parameter amount: The amount from the destination of the transaction.
- parameter base: The base from the destination of the transaction.
- parameter commission: The commission from the destination of the transaction.
Expand All @@ -64,8 +68,9 @@ open class Destination: Mappable {
- parameter type: The type from the destination of the transaction.
- parameter username: The username from the destination of the transaction.
*/
public init(accountId: String, cardId: String, accountType: String, amount: String, base: String, commission: String, currency: String, description: String, fee: String, merchant: Merchant, node: Node, rate: String, type: String, username: String) {
public init(accountId: String, cardId: String, accountType: String, address: String, amount: String, base: String, commission: String, currency: String, description: String, fee: String, merchant: Merchant, node: Node, rate: String, type: String, username: String) {
self.accountId = accountId
self.address = address
self.cardId = cardId
self.accountType = accountType
self.amount = amount
Expand Down Expand Up @@ -100,6 +105,7 @@ open class Destination: Mappable {
accountId <- map["AccountId"]
cardId <- map["CardId"]
accountType <- map["accountType"]
address <- map["address"]
amount <- map["amount"]
base <- map["base"]
commission <- map["commission"]
Expand Down
2 changes: 2 additions & 0 deletions Tests/IntegrationTests/ModelTests/TransactionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,7 @@ class TransactionTest: UpholdTestCase {
"\"destination\": {" +
"\"AccountId\": \"fizbuz\"," +
"\"CardId\": \"fuzbuz\"," +
"\"address\": \"a1b2c3d4e5f6g7h8j9101112\"," +
"\"amount\": \"0.1\"," +
"\"base\": \"0.1\"," +
"\"commission\": \"0.00\"," +
Expand Down Expand Up @@ -516,6 +517,7 @@ class TransactionTest: UpholdTestCase {
XCTAssertEqual(transaction!.denomination!.rate!, "1.00", "Failed: Transaction denomination rate didn't match.")
XCTAssertEqual(transaction!.destination!.accountId!, "fizbuz", "Failed: Transaction destination accountId didn't match.")
XCTAssertEqual(transaction!.destination!.cardId!, "fuzbuz", "Failed: Transaction destination cardId didn't match.")
XCTAssertEqual(transaction!.destination!.address!, "a1b2c3d4e5f6g7h8j9101112", "Failed: Transaction destination address didn't match.")
XCTAssertEqual(transaction!.destination!.amount!, "0.1", "Failed: Transaction destination amount didn't match.")
XCTAssertEqual(transaction!.destination!.base!, "0.1", "Failed: Transaction destination base didn't match.")
XCTAssertEqual(transaction!.destination!.commission!, "0.00", "Failed: Transaction destination commission didn't match.")
Expand Down
1 change: 1 addition & 0 deletions Tests/UtilTests/Fixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public class Fixtures {
"denominationRate": faker.lorem.numerify("123456789"),
"destinationAccountId": faker.lorem.numerify("123456789"),
"destinationAccountType": faker.lorem.characters(amount: 7),
"destinationAddress": faker.lorem.characters(amount: 20),
"destinationAmount": faker.lorem.numerify("123456789"),
"destinationBase": faker.lorem.numerify("123456789"),
"destinationCardId": faker.lorem.characters(amount: 24),
Expand Down

0 comments on commit 23d54fa

Please sign in to comment.