addDeposite method
Future<Either<AppException, Response> >
addDeposite(
- String bankName,
- String branch,
- String deposit,
- String transactionNumber,
- String file,
- String selectedPayment,
override
Implementation
@override
Future<Either<AppException, response.Response>> addDeposite(
String bankName,
String branch,
String deposit,
String transactionNumber,
String file,
String selectedPayment) async {
try {
final eitherType = await networkService.postFileUpload('getdata',
data: {
'action': 'lmddeposit-create',
'bank_name': bankName,
'branch': branch,
'deposit_amount': deposit,
'transaction_number': transactionNumber,
'payment_type': selectedPayment == 'Cash' ? "1" : "2",
},
files: file.isNotEmpty ? [File(file)] : [],
fileKey: 'image');
return eitherType.fold(
(exception) {
return Left(exception);
},
(response) {
return Right(response);
},
);
} catch (e) {
return Left(
AppException(
message: 'Unknown error occured',
statusCode: 1,
identifier: '${e.toString()}\nLoginUserRemoteDataSource.loginUser',
),
);
}
}