mSitefTransaction method
Implementation
Future<TefTransactionResponseMSitef?> mSitefTransaction({
required MSitefParams mSitefParams,
}) async {
try {
Map<String, dynamic> lineToMethodChannel({
int? modalidade,
String? value,
String? couponNumber,
String? dateFiscal,
String? hourFiscal,
String? operador,
String? params,
String? ipSitef,
String? storeId,
String? terminalId,
String? paramsAdd,
String? companyDocument,
String? comExternal,
String? isDoubleValidation,
String? otp,
String? enabledTransactions,
String? automationDocument,
}) {
return {
'modalidade': modalidade,
'value': value,
'couponNumber': couponNumber,
'date': dateFiscal,
'hour': hourFiscal,
'operator': operador,
'restricoes': params,
'ipSitef': ipSitef,
'storeId': storeId,
'terminalId': terminalId,
'parametrosAdc': paramsAdd,
'companyDocument': companyDocument,
'comExternal': comExternal,
'isDoubleValidation': isDoubleValidation,
'otp': otp,
'enabledTransactions': enabledTransactions,
'automationDocument': automationDocument,
};
}
final modality = int.tryParse(_modalityMap[mSitefParams.modalidade.modality] ?? '0') ?? 0;
final paramsTransaction = lineToMethodChannel(
modalidade: modality,
value: mSitefParams.value,
couponNumber: mSitefParams.couponNumber,
dateFiscal: mSitefParams.dateFiscal,
hourFiscal: mSitefParams.hourFiscal,
operador: mSitefParams.operador,
ipSitef: mSitefParams.ipSitef,
storeId: mSitefParams.storeId,
terminalId: mSitefParams.terminalId,
paramsAdd: mSitefParams.paramsAdd,
companyDocument: mSitefParams.companyDocument,
comExternal: mSitefParams.comExternal,
isDoubleValidation: mSitefParams.isDoubleValidation,
otp: mSitefParams.otp,
enabledTransactions: mSitefParams.enabledTransactions,
automationDocument: mSitefParams.automationDocument,
);
final resultTransaction = await channel.invokeMethod(
'transactionMsitef',
paramsTransaction,
);
final resultJson = json.decode(resultTransaction);
final model = TefTransactionModel.fromMap(resultJson);
return _fetchTefTransactionResponse(
model: model,
);
} catch (e) {
return null;
}
}