Skip to content

Instantly share code, notes, and snippets.

@rconnelly
Created February 26, 2014 22:05
Show Gist options
  • Save rconnelly/9239594 to your computer and use it in GitHub Desktop.
Save rconnelly/9239594 to your computer and use it in GitHub Desktop.
-(void) fetchCustomerForPayment
{
// Retrieve Customer associated with a self.ppsPayment
[MMProgressHUD showWithTitle:@"Looking for customer information..."];
[self.ppsPayment getCustomerWithCompletion:^(BOOL success, PPSCustomer *customer, NSError *error) {
self.customer = customer;
if (success) {
DDLogInfo(@"getCustomerWithCompletion returned with success");
[MMProgressHUD showWithTitle:@"Looking for customer information...."];
[self.customer findContactsWithCompletion:^(BOOL success, NSArray *contacts, NSError *error) {
[MMProgressHUD dismiss];
if (success) {
[[PPSDataManager sharedInstance] addContacts:contacts];
} else {
DDLogInfo(@"findContactsWithCompletion returned with error: %@", error.localizedDescription);
}
}];
} else {
[MMProgressHUD dismiss];
DDLogInfo(@"getCustomerWithCompletion returned with error: %@", error.localizedDescription);
// I guess it is not a big deal we were not able to "pre-fill" table with known destination recipients,
// more manual typing for customer, but no need to bombard users with error message.
}
[self.tableView reloadData];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment