Skip to content

Instantly share code, notes, and snippets.

@xslim
Last active November 11, 2016 18:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xslim/6280a2085d4c1bc3b323 to your computer and use it in GitHub Desktop.
Save xslim/6280a2085d4c1bc3b323 to your computer and use it in GitHub Desktop.
AdyenToolkit

Adyen POS App

Installation

  • Have AdyenToolkit library in ../AdyenPOSLib folder
  • install Cocoapods
  • run pod install

Firewall

For the connection to Adyen backend, those domains should be whitelisted:

  • pos-payment-live.adyen.com
  • pos-sync-live.adyen.com
  • pos-payment-test.adyen.com
  • pos-sync-test.adyen.com
  • ca-test.adyen.com

Using with library

Make sure to unzip the app source and the adyen library in the following folder structure:

  • AdyenPOS/ - source of app
  • AdyenPOSLib/ - library
    • AdyenToolkit.podspec - Pod spec
    • ios/AdyenToolkit.framework - framework

Install Cocoapods and run pod install

Using the lib in custom App

Make sure to include followint in Info.plist

  • UISupportedExternalAccessoryProtocols:
    • com.adyen.bt1
    • com.verifone.pmr.zontalk
    • com.verifone.pmr.xpi

Barcode

Receiving Barcodes

To receive the barcode implement the following:

    [[NSNotificationCenter defaultCenter] addObserver:self 
      selector:@selector(barcodeReceived:) 
      name:ADYNotificationBarcodeReceived 
      object:nil];
    
    
    - (void)barcodeReceived:(NSNotification *)notification {
      NSString *barcode = notification.object;
      NSString *symbology = notification.userInfo[@"symbology”]
      ADYBarcodeType barcodeType = [notification.userInfo[@"type"] integerValue];
    }

Using Soft button barcode

UIButton *barcodeBtn = [[UIButton alloc] init];
[barcodeBtn setTitle:@"Barcode" forState:UIControlStateNormal];
[barcodeBtn addTarget:self action:@selector(startBarcodeScan:) forControlEvents:UIControlEventTouchDown];
[barcodeBtn addTarget:self action:@selector(stopBarcodeScan:) forControlEvents:UIControlEventTouchUpInside];

- (IBAction)startBarcodeScan:(id)sender {
  ADYDevice *device = _selectedDeviceManager.selectedDevice;
  [device startBarcodeScan];
}

- (IBAction)stopBarcodeScan:(id)sender {
  ADYDevice *device = _selectedDeviceManager.selectedDevice;
  [device stopBarcodeScan];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment