Skip to content

Instantly share code, notes, and snippets.

@zaneclaes
Created February 24, 2014 20:02
Show Gist options
  • Save zaneclaes/9195871 to your computer and use it in GitHub Desktop.
Save zaneclaes/9195871 to your computer and use it in GitHub Desktop.
- (void)choosePaymentInstrument:(BBPaymentInstrument*)instrument {
NSAssert(instrument.paymentInstrumentId, @"instrument must have an ID");
NSString *endpoint = [NSString stringWithFormat:@"/trip_invoices/%d",(int)self.tripInvoice.tripInvoiceId.integerValue];
NSDictionary *params = @{@"op":@"add",@"path":@"/payment_instrument_id",@"value":instrument.paymentInstrumentId};
[self showLoadingView:NO blocking:NO];
[[BBAPI V2] patch:endpoint withParams:params onSuccess:^(id object) {
[self dismissLoadingView];
[self.tableView triggerPullToRefresh];
} onFailure:^(NSError *e) {
[[BBAlertManager sharedManager] showAlertWithError:e];
[self dismissLoadingView];
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment