process method

  1. @override
Future<MpesaResponse> process()
override

Implementation

@override
Future<MpesaResponse> process() async {
  late Map<String, dynamic> _tokenRes;
  try {
    _tokenRes = await fetchMpesaToken(mpesa.consumerKey, mpesa.consumerSecret,
        applicationMode: mpesa.applicationMode);
  } catch (e) {
    rethrow;
  }

  Map<String, String> headers = {
    'content-type': 'application/json',
    'Authorization': 'Bearer ${_tokenRes["token"]}'
  };

  return await processMpesaTransaction(url, headers, payload);
}