createHexPacketFromData method

  1. @override
Future<Cryptogram?> createHexPacketFromData(
  1. String cardNumber,
  2. String cardDate,
  3. String cardCVC,
  4. String publicId,
  5. String apiUrl,
)
override

Implementation

@override
Future<Cryptogram?> createHexPacketFromData(String cardNumber, String cardDate, String cardCVC, String publicId, String apiUrl) async {

  try {
    final api = Api(apiUrl);
    final publicKey = await api.publicKey();
    final dynamic arguments = await methodChannel.invokeMethod<dynamic>('createHexPacketFromData',
        {
          'cardNumber': cardNumber,
          'cardDate': cardDate,
          'cardCVC': cardCVC,
          'publicId': publicId,
          'publicKey': publicKey.key,
          'keyVersion': publicKey.version
        });
    return Cryptogram(arguments['cryptogram'], arguments['error']);
  } catch (e) {
    print("Create cryptogram error");
  }
}