Last active
October 25, 2015 22:59
-
-
Save hackenbruder/aca3cde0e48e6257d40a to your computer and use it in GitHub Desktop.
Příklad použití GovData iOS SDK formou testu vypisujícího nahlášené účty pro platbu DPH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)test3QueryResultFound { | |
XCTestExpectation * expectation = [self expectationWithDescription:@"Prints all accounts"]; | |
GDErrorResponse failure = ^(const GDError * error) { | |
XCTFail(@"%@", error.localizedDescription); | |
}; | |
GDEntityResponse success = ^(const GDEntity * entity) { | |
XCTAssertNotNil(entity, "Entity Found"); | |
if ([entity hasVAT]) { | |
const GDVAT * vat = [entity vat]; | |
if ([vat hasAccounts]) { | |
for ( int i = 0; i < vat.accounts.count; ++i ) { | |
NSLog(@"Account number: %@", vat.accounts[i].description); | |
} | |
} else { | |
NSLog(@"Entity has no reported accounts"); | |
} | |
} else { | |
NSLog(@"Entity is not VAT registered"); | |
} | |
[expectation fulfill]; | |
}; | |
[self.govdata findEntityByNumber:@"00006947" success: success failure: failure]; | |
[self waitForExpectationsWithTimeout:5 handler:^(NSError * error) { | |
if (error != nil) { | |
XCTFail(@"%@", error.localizedDescription); | |
} | |
}]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment