Dart API Client which wraps the QvaPay API

Overview

qvapay_api_client

coverage style: very good analysis License: MIT

Dart API Client which wraps the QvaPay API

The client needs Dio to perform the requests, you must inject an instance in the constructor.

void main () async {
  final api = QvaPayApiClient (Dio(), CustomSecureStorage());

  // Listen to the authentication status
  api.status.listen ((status) => print (status));

  // Start section on the platform
  await api.logIn (email: '[email protected]', password: 'sqpToTheMoon');

  // You get the user's data and its last operations
  final me = await api.getUserData ();
  print (me.toString ());

  // You can create a transaction to receive a specific payment,
  // or just a transfer that you want to receive from another user.
  final transactionCreated = await api.createTransaction (
      uuid: 'c67af7d0-a699-4e50-82d5-cfeaa9ed2b7d',
      amount: 20.5,
      description: 'Mobile Recharge');

  // Pay a specific transaction through your `uuid`, it can be the
  // purchase of an item or simply a transfer to another user.
  final payTransaction =
      await api.payTransaction (uuid: '09dfsd9fs-cxc5-sdfd-3dsvf-f7sdtfrds6d', pin: '9900');

  // You get the details of a specific transaction through its `uuid`
  final transaction =
      await api.getTransactionDetails (uuid: payTransaction.uuid);
  print (transaction.toString ());

  // Filter the search for Transactions in terms of the given parameters, otherwise
  // Contrary to not passing any parameter returns the last 30 transactions
  final transactions = await api.getTransactions (
    start: DateTime.parse ('2021-08-16T03: 39: 03.000000Z'),
    end: DateTime.now (),
    description: 'Recharge',
  );
  print (transactions.toString ());

  // Close the session
  await api.logOut ();
  // Close listening
  api.dispose ();
}

⚠️ Always remember to close the status stream with the dispose() method provided by the client.

🦺 Implementing secure storage with flutter_secure_storage

import 'package:flutter_secure_storage/flutter_secure_storage.dart';

import 'package:qvapay_api_client/qvapay_api_client.dart';

const _keySecureStorage = 'secure_storage';

class CustomSecureStorage extends OAuthStorage {
  final _secureStorage = const FlutterSecureStorage();

  @override
  Future<void> delete() {
    return _secureStorage.deleteAll();
  }

  @override
  Future<String?> fetch() {
    return _secureStorage.read(key: _keySecureStorage);
  }

  @override
  Future<bool> save(String token) async {
    try {
      await _secureStorage.write(key: _keySecureStorage, value: token);
      return true;
    } catch (e) {
      return false;
    }
  }
}

Running Tests 🧪

To run all unit tests use the following command:

# Run all test
$ flutter test --coverage --test-randomize-ordering-seed random

To view the generated coverage report you can use lcov.

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html
You might also like...

A WordPress API client for dart with support for WooCommerce and custom namespaces.

A WordPress API client for dart with support for WooCommerce and custom namespaces.

WordPress REST API client for Dart | Flutter Description A WordPress REST API client for dart with support for WooCommerce and custom namespaces/endpo

Nov 26, 2022

An API Client for Discord, written in Dart.

discord_api_client An API Client for Discord, written in Dart. Features TODO: List what your package can do. Maybe include images, gifs, or videos. Ge

Feb 15, 2022

Firebase API Client Libraries for Dart

Firebase API Client Libraries for Dart

🔥 Generated Firebase APIs for Dart. Additionally Includes private and unlisted APIs.

Oct 18, 2022

A Dart client for the NATS messaging system. Design to use with Dart and Flutter.

Dart-NATS A Dart client for the NATS messaging system. Design to use with Dart and flutter. Flutter Web Support by WebSocket client.connect(Uri.parse(

Nov 18, 2022

Socketio dart server and client - Full Socket.io implementation using Dart Lang

Socketio dart server and client - Full Socket.io implementation using Dart Lang

Getting Started Step 1: Run dart_server.dart Step 2: Android Emulator has proble

Jan 23, 2022

This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.

This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise projects and builds and lets you download your artifacts.

Bitrise Artifact Downloader Introduction 🙋‍♂️ This is a flutter app which uses the Bitrise Api(https://api-docs.bitrise.io/) to show the bitrise proj

Apr 30, 2021

Rock-Paper-Scissor-Game-Using-Dart - This is a repository of Rock Paper Scissor Game which I developed while learning Dart.

Rock-Paper-Scissor-Game-Using-Dart This is a repository of Rock Paper Scissor Game which I developed while learning Dart. The main.dart file consist o

Jan 4, 2022

Authentication API client with Flutter (Login, Register, Google Login, Facebook Login, Apple Login)

Authentication API client with Flutter (Login, Register, Google Login, Facebook Login, Apple Login)

Flutter Auth App (Login, Register, Google Login, Facebook Login, Apple Login) To use this client, get the server up and running. Try it out now! App S

Jan 4, 2023
Owner
QvaPay
Pasarela de pagos con criptomonedas
QvaPay
Dart package that conveniently wraps an isolate, ports and state for easy isolates.

Isolate Agents Description Isolate Agents adds a new class, Agent, which is a proper implementation of the Actor model for Dart. Where Isolates have n

null 65 Jan 2, 2023
Wraps Flutter shared_preferences plugin, providing a iOS Suite Name support, it's helpful for sharing data from App to Widget.

shared_preferences_ios_sn Wraps Flutter shared_preferences plugin and provides an iOS Suite Name support, it's helpful for sharing data from App to iO

null 3 Sep 14, 2022
An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS

Pusher Flutter Client An unofficial Flutter plugin that wraps pusher-websocket-java on Android and pusher-websocket-swift on iOS. Get it from pub. How

HomeX 31 Oct 21, 2022
A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.

dio_http A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout

null 46 Dec 19, 2021
A powerful Http client for Dart, which supports Interceptors, FormData, Request Cancellation, File Downloading, Timeout etc.

Language: English | 中文简体 dio A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File

Flutter中国开源项目 11.2k Jan 3, 2023
An Imgur API Client Library that uses Imgur's v3 API for Dart

imgur.dart An Imgur API Client Library that uses Imgur's v3 API for Dart. Usage

null 2 Dec 2, 2022
A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package. Built after react apollo

Flutter GraphQL Table of Contents Flutter GraphQL Table of Contents About this project Installation Usage GraphQL Provider [Graphql Link and Headers]

Snowball Digital 45 Nov 9, 2022
A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.

GraphQL Flutter ?? Bulletin See the v3 -> v4 Migration Guide if you're still on v3. Maintenance status: Low. Follow #762 for updates on the planned ar

Zino & Co. 3.1k Jan 5, 2023
Vrchat mobile client - VRChat Unofficial Mobile Client For Flutter

VRChatMC VRChatの非公式なAPIを利用したVRChatのモバイルクライアント Flutterで作成されたシンプルなUIが特徴的です iosビルドは

ふぁ 8 Sep 28, 2022
Mysql.dart - MySQL client for Dart written in Dart

Native MySQL client written in Dart for Dart See example directory for examples

null 48 Dec 29, 2022