m8ty_client_cards
Package overview
Section titled “Package overview”m8ty_client_cards solves this by enabling apps to list and search cards, show balance trends, and retrieve or change card controls, putting relevant card management into the customer’s hands.
As bank can provide various cards to user here the cards can be managed, blocked and limits changed.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_cards library to get an idea about the available models and their properties.
import all needed libraries
Section titled “import all needed libraries” import 'package:dio/dio.dart'; import 'package:m8ty_client_cards/m8ty_client_cards.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
List all cards
Section titled “List all cards” final client = M8tyClientCards(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCardsApi(); final Response<CardsResponseModel> response = await api.listAllCards();Search for cards
Section titled “Search for cards” final client = M8tyClientCards(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCardsApi(); final Response<CardsResponseModel> response = await api.searchCards( searchCardsRequestModel: SearchCardsRequestModel((b) { // set search criteria }), );Get card balance trends
Section titled “Get card balance trends” final client = M8tyClientCards(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCardsApi(); final response = await api.cardBalanceTrends( cardId: '1234', );Change card control status
Section titled “Change card control status” final client = M8tyClientCards(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCardControlApi();
try { final response = await api.changeCardControlStatus( cardId: '1234', cardControlStatusChangeRequestModel: CardControlStatusChangeRequestModel((b) { // set required fields }), ); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }Fetch cards control data
Section titled “Fetch cards control data” final client = M8tyClientCards(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCardControlApi(); final response = await api.fetchCardsControlData();© m8ty GmbH 2023 · m8ty.eu
