Skip to content

Instantly share code, notes, and snippets.

@xslim
Created October 22, 2018 09:06
Show Gist options
  • Save xslim/d12822e3f7523baeeb0fa43d5b790245 to your computer and use it in GitHub Desktop.
Save xslim/d12822e3f7523baeeb0fa43d5b790245 to your computer and use it in GitHub Desktop.
-(void)removeAllPaymentDevices:(id)args
{
NSLog(@"removing all payment devices");
ADYDeviceRegistry* deviceRegistry = [Adyen sharedInstance].deviceRegistry;
NSMutableArray* devices = deviceRegistry.devices.copy;
for (ADYDevice* device in devices) {
if (device.connectionType == ADYDeviceConnectionTypeWifi && device.hostname != nil && ![device.hostname isEqualToString:@""]) {
NSLog(@"Payment device with hostname %@ being removed from device registry", device.hostname);
if (self.device == device) {
[self.device removeObserver:self forKeyPath:@"status"];
self.device = nil;
}
[deviceRegistry removeDeviceWithHostname:device.hostname];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment