addSigner function
AƱade un firmante.
Implementation
Future<ApacuanaSuccess<Map<String, dynamic>>> addSigner(
Map<String, dynamic> signerData,
) async {
if (signerData.isEmpty) {
throw ApacuanaAPIError(
'Signer data (signerData) is required and must be a non-empty object.',
statusCode: 400,
errorCode: 'INVALID_PARAMETER',
);
}
final cfg = getConfig();
final typeStr = cfg.integrationType;
final typeEnum = IntegrationType.fromValue(typeStr);
if (typeEnum == IntegrationType.onboarding ||
typeStr == INTEGRATION_TYPE['ONBOARDING']) {
return _addSignerOnBoarding(signerData);
}
if (typeEnum == IntegrationType.onPremise ||
typeStr == INTEGRATION_TYPE['ONPREMISE']) {
return _addSignerOnPremise(signerData);
}
throw ApacuanaAPIError(
'Unsupported integration type: $typeStr',
statusCode: 400,
errorCode: 'UNSUPPORTED_INTEGRATION_TYPE',
);
}