...
Code Block |
---|
@Override public int cardholderChooseApplication(DisplayParams displayParams, byte[] bytes) { String prompt = LangHelper.localize(R.string.ch_display_chooseApplication, displayParams.selectedLanguage); Log.d(LOG_TAG, prompt); List<String> application = new ArrayList<>(); Collections.addAll(application, displayParams.itemList); /* AKHD-1003: Add input request multi-choice support. Solely for demonstration purposes, this is not a real-world use-case, we DO NOT recommend such usage in a production context. If the polled event is a payment, then we send a choice-based input request to the retail terminal else we simply use the application fragment. The displayParams.itemList parameters lists the possible 'applications' we received from the payment card, the choice is passed on to the retail terminal through a multi-choice input request. */ NexoEvent event = PaymentSystem.getRetailHandler().getEvent(); if (event instanceof PaymentRequest) { int menuEntryNumberchoiceIndex = PaymentSystem.getRetailHandler().SendMenuEntryInputRequest( prompt, prompt, displayParams.itemList); if(menuEntryNumber<displayParamschoiceIndex<displayParams.itemList.length) { return menuEntryNumber; choiceIndex; } else { throw new InvalidValueException( "Was expecting a value between 0-"+ (displayParams.itemList.length-1)); } } return selectApplication(prompt, application); } |
...