sendOtp method

Future<void> sendOtp(
  1. PaymentSendOtpRequest paymentSendOtpRequest,
  2. dynamic onSuccess(
    1. String message
    ), {
  3. dynamic onFailed(
    1. int code,
    2. String message
    )?,
})

Implementation

Future<void> sendOtp(
    PaymentSendOtpRequest paymentSendOtpRequest,
    Function(String message) onSuccess,
    {Function(int code,String message)? onFailed}) async {
  final response = await _executeNetworkRequest(FastpayFlutterSdk.instance.apiSendOtp,NetworkRequestType.POST,paymentSendOtpRequest.toJson(),onFailed: onFailed,isVersion2: true,isEmptyBody: true);
  if(response != null){
    try{
      onSuccess.call(response);
    }catch(e){
      onFailed?.call(0,'Something went wrong');
    }
  }
}