diff --git a/OmiseSwift/Transfer.swift b/OmiseSwift/Transfer.swift index 8ee80fb..d9cb4b9 100644 --- a/OmiseSwift/Transfer.swift +++ b/OmiseSwift/Transfer.swift @@ -50,7 +50,7 @@ public struct Transfer: OmiseResourceObject, Equatable { public let currency: Currency - public let recipientID: String + public let recipient: DetailProperty public let transactions: [Transaction] public let metadata: JSONDictionary @@ -75,7 +75,7 @@ public struct Transfer: OmiseResourceObject, Equatable { case net case totalFee = "total_fee" case currency - case recipientID = "recipient" + case recipient case transactions case failureCode = "failure_code" case failureMessage = "failure_message" @@ -110,7 +110,7 @@ public struct Transfer: OmiseResourceObject, Equatable { feeVat = try container.decode(Int64.self, forKey: .feeVat) net = try container.decode(Int64.self, forKey: .net) totalFee = try container.decode(Int64.self, forKey: .totalFee) - recipientID = try container.decode(String.self, forKey: .recipientID) + recipient = try container.decode(DetailProperty.self, forKey: .recipient) transactions = try container.decode(Array>.self, forKey: .transactions) let failureCode = try container.decodeIfPresent(TransferFailure.Code.self, forKey: .failureCode) @@ -154,7 +154,7 @@ public struct Transfer: OmiseResourceObject, Equatable { try container.encode(totalFee, forKey: .totalFee) try container.encode(currency, forKey: .currency) - try container.encode(recipientID, forKey: .recipientID) + try container.encode(recipient, forKey: .recipient) try container.encode(transactions, forKey: .transactions) try container.encode(metadata, forKey: .metadata) diff --git a/OmiseSwiftTests/TransferOperationFixtureTests.swift b/OmiseSwiftTests/TransferOperationFixtureTests.swift index d92c97e..edb7ef8 100644 --- a/OmiseSwiftTests/TransferOperationFixtureTests.swift +++ b/OmiseSwiftTests/TransferOperationFixtureTests.swift @@ -18,6 +18,7 @@ class TransferOperationFixtureTests: FixtureTestCase { XCTAssertEqual(transfer.sentDate, dateFormatter.date(from: "2019-05-22T06:47:57Z")) XCTAssertEqual(transfer.paidDate, dateFormatter.date(from: "2019-05-22T06:47:59Z")) XCTAssertFalse(transfer.shouldFailFast) + XCTAssertEqual(transfer.recipient.dataID, "recp_test_5fofl6ivu23gypjeqt8") case let .failure(error): XCTFail("\(error)") }