shushper/cloudpayments

show3ds does not catch other errors, and as a result, the function does not work.

Opened this issue · 1 comments

Hello!
I tried to implement this library in my application. Payment without 3DS is successfully completed (although I had to rewrite a few lines), but as soon as it comes to payment with a 3DS request, everything breaks down. No logs, no error message. I decided to see how the show3ds method works, and I saw this:

static Future<ThreeDsResponse?> show3ds({
    required String acsUrl,
    required String transactionId,
    required String paReq,
  }) async {
    try {
      final dynamic arguments =
          await _channel.invokeMethod<dynamic>('show3ds', {
        'acsUrl': acsUrl,
        'transactionId': transactionId,
        'paReq': paReq,
      });

      if (arguments == null) {
        return null;
      } else {
        return ThreeDsResponse(
            success: true, md: arguments['md'], paRes: arguments['paRes']);
      }
    } on PlatformException catch (e) {
      return ThreeDsResponse(success: false, error: e.message);
    }
  }

The problem is that the method does not catch other errors (except PlatformException ), so it does not return anything and does not take any action.

@bl1nkker I think you temporary can wrap your call to show3ds method with your own try catch block. I don't have enough time for supporting this plugin so you can create a pull request with fixes.