mvola 1.0.0 copy "mvola: ^1.0.0" to clipboard
mvola: ^1.0.0 copied to clipboard

A MVola API client for dart and eventually flutter.

example/mvola_example.dart

import 'package:mvola/mvola.dart';
import 'package:dotenv/dotenv.dart';
import 'package:mvola/src/constants.dart';

void main() async {
  var env = DotEnv(includePlatformEnvironment: true)..load();

  var mvola = MVolaClient(
    env['DEV_ENV'] == '1' ? sandboxUrl : productionUrl,
    env['CONSUMER_KEY']!,
    env['CONSUMER_SECRET']!,
  );

  var token = await mvola.generateAccessToken();
  print(token);

  var transactionResponse = await mvola.initTransaction(
    partnerName: 'name',
    partnerNumber: '0343500004',
    creditNumber: '0343500004',
    amount: 5000,
    debitNumber: '0343500003',
    description: 'short description',
  );

  print(transactionResponse);

  // We have to wait for the transaction to be approved to be able 
  // to get the ID to get the details
  await Future.delayed(Duration(seconds: 30));

  var transactionStatus = await mvola.getTransactionStatus(
    transactionResponse.serverCorrelationId,
    '0343500003',
    'name',
  );
  print(transactionStatus);

  var transactionDetails = await mvola.getTransactionDetail(
    transactionStatus.transactionReference,
    'name',
    '0343500004',
  );
  print(transactionDetails);
}
5
likes
130
pub points
0%
popularity

Publisher

unverified uploader

A MVola API client for dart and eventually flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

http, uuid

More

Packages that depend on mvola