-
Notifications
You must be signed in to change notification settings - Fork 3
SEPA QR
Nenad Mikša edited this page Oct 28, 2016
·
1 revision
To initialize the scanning of SEPA QR codes, use the following intialization code:
- (PPCameraCoordinator*)coordinatorWithError:(NSError **)error {
// Check if photopay is supported
if ([PPCameraCoordinator isScanningUnsupportedForCameraType:PPCameraTypeBack error:error]) {
return nil;
}
// 1. ******* Instantiate Scanning settings ********/
PPSettings* settings = [[PPSettings alloc] init];
// 2. ************* Setup UI Settings **************/
// Instantiate PhotoPay UI settings. This allows more customization in the initialization process.
PPPhotoPayUiSettings* photopayUiSettings = [[PPPhotoPayUiSettings alloc] init];
settings.uiSettings = photopayUiSettings;
// Use english language for UI texts
settings.uiSettings.language = @"en";
// 3. ************* Setup Scan Settings **************/
// Add recognizer for SEPA payment QR codes
[settings.scanSettings addRecognizerSettings:[[PPSepaQrRecognizerSettings alloc] init]];
// 4. ************* Setup License Settings **************/
// Set your license key here. This specific key is for demo purposes only!
settings.licenseSettings.licenseKey = @"7KHIDF5P-PRRVZ5EQ-SMDYQF4Q-NRUDZ7O7-NRUDZ7O7-NRUDZ7O7-NRUDZ7J7-76DCOZKC";
// Allocate the recognition coordinator object
PPCameraCoordinator *coordinator = [[PPCameraCoordinator alloc] initWithSettings:settings];
return coordinator;
}
- (void)showCoordinatorError:(NSError *)error {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Warning"
message:[error localizedDescription]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:nil];
[alertController addAction:okAction];
[self presentViewController:alertController animated:YES completion:nil];
}
- (IBAction)didTapScan:(id)sender {
/** Instantiate the scanning coordinator */
NSError *error;
PPCameraCoordinator *coordinator = [self coordinatorWithError:&error];
/** If scanning isn't supported, show an error */
if (coordinator == nil) {
[self showCoordinatorError:error];
return;
}
/** Allocate and present the scanning view controller */
UIViewController<PPScanningViewController>* scanningViewController = [PPViewControllerFactory cameraViewControllerWithDelegate:self overlayViewController:overlayVC coordinator:coordinator error:nil];
scanningViewController.autorotate = YES;
/** You can use other presentation methods as well */
[self presentViewController:scanningViewController animated:YES completion:nil];
}
Scanning results for SEPA QR codes are obtained as instances of class PPSepaQrRecognizerResult
. See the header files or sample below for all fields contained in these objects.
- (void)scanningViewController:(UIViewController<PPScanningViewController> *)scanningViewController
didOutputResults:(NSArray *)results {
// Here you process scanning results. Scanning results are given in the array of PPRecognizerResult objects.
// Collect data from the result
for (PPRecognizerResult* result in results) {
if ([result isKindOfClass:[PPSepaQrRecognizerResult class]]) {
PPSepaQrRecognizerResult* sepaQrResult = (PPSepaQrRecognizerResult*)result;
[self processSepaQrRecognizerResult:sepaQrResult scanningViewController:scanningViewController];
}
};
}
- (void)processSepaQrRecognizerResult:(PPSepaQrRecognizerResult*)sepaQrResult
scanningViewController:(UIViewController<PPScanningViewController> *)scanningViewController {
// Here we log all field in PPSepaSlipRecognizerResult object
NSLog(@"SEPA payment QR code results\n");
NSLog(@"Amount is %@", [sepaQrResult amount]);
NSLog(@"Currency is %@", [sepaQrResult currency]);
NSLog(@"IBAN is %@", [sepaQrResult iban]);
NSLog(@"bic is %@", [sepaQrResult bic]);
NSLog(@"referenceNumber is %@", [sepaQrResult referenceNumber]);
NSLog(@"paymentDescription is %@", [sepaQrResult paymentDescription]);
NSLog(@"displayData is %@", [sepaQrResult displayData]);
NSLog(@"purposeCode is %@", [sepaQrResult purposeCode]);
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"SEPA QR code"
message:[sepaQrResult description]
preferredStyle:UIAlertControllerStyleAlert];
// pause scanning until the user presses OK buttom
[scanningViewController pauseScanning];
UIAlertAction* okAction = [UIAlertAction actionWithTitle:@"OK"
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * _Nonnull action) {
// resume scanning when OK is pressed
[scanningViewController dismissViewControllerAnimated:YES completion:nil];
}];
[alertController addAction:okAction];
// present alert on top of scanning view controller
[scanningViewController presentViewController:alertController animated:YES completion:nil];
}
- Getting Started with PhotoPay SDK
-
Obtaining scanning results
- Scanning Austrian payslips
- Scanning Belgian payslips
- Scanning Croatian HUB payslips / barcodes
- Scanning Dutch Acceptgiros
- Scanning German payslips
- Scanning Hungarian payslips
- Scanning SEPA payment QR codes
- Scanning Slovenian payslips
- Using BlinkID recognizers
- Using MRTD Recognizer for scanning ID documents
- Using EUDL Recognizer
- Using USDL Recognizer
- Using MyKad recognizer
- Using PDF417 Recognizer
- Using BarDecoder Recognizer
- Using ZXing Recognizer
- Using Barcode Recognizer
- Using Templating API
- Using Detector Recognizer
- Using BlinkInput OCR Recognizer
- Troubleshoot
- Using Direct Processing API
- Customizing Camera UI
- Creating customized framework
- Upgrading from older versions