Skip to content

Instantly share code, notes, and snippets.

@hackenbruder
Last active October 25, 2015 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hackenbruder/aca3cde0e48e6257d40a to your computer and use it in GitHub Desktop.
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
- (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