mapResult function
Implementation
Result mapResult(String json) {
final map = jsonDecode(json);
switch (map[type]) {
case configurationSuccess:
return ConfigurationSuccess();
case validationError:
return ValidationError(map[value]);
case paymentCompleted:
return PaymentCompleted(map[value]);
case paymentCancelled:
return PaymentCancelled(map[value]);
case tokenizationCompleted:
return TokenizationCompleted();
case tokenizationFailure:
return TokenizationFailure();
case methodCallError:
return MethodCallError(map[value]);
case moduleClosed:
return ModuleClosed();
default:
throw Exception(unknownResult);
}
}