transfer method
Transfer funds between internal wallets. Off-chain operation.
Throw UnauthorizedException when the secret key is invalid. Throw NotFoundException when merchant or user does not exist. It throws exception TelePayException with any other error.
Implementation
@override
Future<bool> transfer(CreateTransfer transfer) async {
try {
final response = await _dio.post<Map<String, dynamic>>(
'transfer',
data: transfer.toJson(),
options: Options(
headers: _headers,
),
);
if (response.statusCode == 200 && response.data != null) {
return response.data!['success'] as bool == true;
}
} on DioError catch (e) {
_handlerError(e, 'transfer');
}
throw const TelePayException('Failed to tranfer.');
}