Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
Fix email in recipient (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias authored Mar 30, 2021
1 parent fdbd6d3 commit fb22fc6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OmiseSwift/API Models/Recipient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ extension Recipient {
isDefault = try container.decode(Bool.self, forKey: .isDefault)
failureCode = try container.decodeIfPresent(FailureCode.self, forKey: .failureCode)
name = try container.decode(String.self, forKey: .name)
email = try container.decode(String.self, forKey: .email)
email = try container.decode(String?.self, forKey: .email)
recipientDescription = try container.decodeIfPresent(String.self, forKey: .recipientDescription)
type = try container.decode(RecipientType.self, forKey: .type)
taxID = try container.decodeIfPresent(String.self, forKey: .taxID)
Expand Down
2 changes: 1 addition & 1 deletion OmiseSwiftTests/Fixtures/api.omise.co/recipients-get.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"default": true,
"active": true,
"name": "[email protected]",
"email": "[email protected]",
"email": null,
"description": "Default recipient",
"type": "individual",
"tax_id": "",
Expand Down
24 changes: 24 additions & 0 deletions OmiseSwiftTests/RecipientOperationFixtureTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import XCTest
import Omise

class RecipientOperationFixtureTests: FixtureTestCase {

func testRecipientList() {
let expectation = self.expectation(description: "recipient list")

let request = Recipient.list(using: testClient, params: nil) { (result) in
defer { expectation.fulfill() }

switch result {
case let .success(recipientList):
XCTAssertEqual(recipientList.data.count, 2)
case let .failure(error):
XCTFail("\(error)")
}
}

XCTAssertNotNil(request)
waitForExpectations(timeout: 15.0, handler: nil)
}

}

0 comments on commit fb22fc6

Please sign in to comment.