payWithOtp method
Future<void>
payWithOtp(
- PaymentSendOtpRequest paymentSendOtpRequest,
- dynamic onSuccess(
- PaymentSuccessResponse message
- dynamic onFailed()?,
Implementation
Future<void> payWithOtp(
PaymentSendOtpRequest paymentSendOtpRequest,
Function(PaymentSuccessResponse message) onSuccess,
{Function(int code,String message)? onFailed}) async {
final response = await _executeNetworkRequest(FastpayFlutterSdk.instance.apiPaymentWithOtpVerification,NetworkRequestType.POST,paymentSendOtpRequest.toJson(),onFailed: onFailed,isVersion2: true,isEmptyBody: false);
if(response != null){
try{
var data = PaymentSuccessResponse.fromJson(response);
onSuccess.call(data);
}catch(e){
onFailed?.call(0,'Something went wrong');
}
}
}