initialize method
Future<void>
initialize({
- required StoneTechCredentialsModel stoneCredentials,
- required dynamic onMessage(),
- required dynamic onSuccess(),
- required dynamic onError(),
Implementation
Future<void> initialize({
required StoneTechCredentialsModel stoneCredentials,
required Function(String) onMessage,
required Function() onSuccess,
required Function(String) onError,
}) async {
credentials = stoneCredentials;
handler = StoneTechPrinterHandler(
onFinishedMonitor: (e) => onFinished(e, onSuccess: onSuccess, onError: onError),
onMessageMonitor: onMessage,
);
stone.initPayment(handler: handler);
stone.payment.setHandler(handler);
if (!StoneTech.isPinpadActivated) {
if (credentials.qrCodeAuthorization != null && credentials.qrCodeProviderid != null) {
await stone.payment.activePinpadWithCredentials(
appName: credentials.appName,
stoneCode: credentials.stoneCode,
qrCodeAuthroization: credentials.qrCodeAuthorization ?? '',
qrCodeProviderid: credentials.qrCodeProviderid ?? '',
);
} else {
await stone.payment.activePinpad(
appName: credentials.appName,
stoneCode: credentials.stoneCode,
);
}
} else {
stone.payment.setHandler(handler);
onSuccess();
}
}