Card91 SERVICES Flutter Plugin
This package is used to access the bunch of Card91 fintech services from login with auth token to card setting and transferring money
Features
Package directly communicate with Card91 services.
Getting started
Add the widget package on your pubspec version
$ flutter pub add card91_plugin
Use this package as a library
Run this command: With Flutter:
flutter pub add card91_plugin
Import it
Now in your Dart code, you can use:
import 'package:card91_plugin/card91_flutter_library.dart';
SUPPORTED SERVICE METHOD
Name | Description |
---|---|
loginWithAuthToken | Service return the card holder details with its card information. |
getCardFlags | Service return the card holder a particular card flags informations. Eg ATM transaction is enabled or not |
updateCardFlags | Service update the card holder a particular card flags informations.Eg ATM transaction is enabled or disable |
lockCard | Service freeze a particular card activity |
getCardWalletDetails | Allows you to gets Wallet details for a card |
blockCardOTP | Service initiate the card permanent block with OTP generation . |
blockCardConfirmation | Service completes the card permanent block with OTP validation. |
addBeneficiary | Service to add beneficiary at the card holder level. |
getAllBeneficiary | Service to add beneficiary get all beneficiary |
getBeneficiaryDetails | Service to get beneficiary details |
transferMoneyToBeneficiary | transfer money to beneficiary |
getBeneficiaryTransactions | get beneficiary transaction list |
getCardLimit | Service return the card holder a particular card setting limit information. |
setCardLimit | Service update the card holder a particular card setting limit information. |
getKitTracking | Method will respond with kit tracking id |
getAWBStatus | Method will respond with kit tracking current status |
Usage
Call the corresponding service function by passing the required parameter to use it. Check out the below code snippet for the same.
Card91RemoteServices is main service class where the static function will called based on the operation needs to be performed.
Environment
PROD_SANDBOX - Used when working on production sandbox environment
PROD - Used when working on production live environment
Sample code below.
Function loginWithAuthToken Used login customer
Map<String, dynamic> loginWithAuthTokendata = {
"mobile": "917096482153", // Card holder mobile number
"sdkAuthToken": "suth#eree", // Client auth token
"primaryOrgId": "230705103219705ID1OID1317188" // Organization Id
};
//Map<> data with Build context and enviorment need to passed
loginWithAuthToken(loginWithAuthTokendata, context, "PROD_SANDBOX"); //PROD for production, PROD_SANDBOX for production sandbox
static Future<void> loginWithAuthToken(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
// "evn" will be "PROD" for production, "PROD_SANDBOX" for production sandbox
final products = await Card91RemoteServices.loginWithAuthToken(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString()); // Will be true/false (boolean) based on service response
print("headers"+parsed["headers"].toString()); // reponse header will be found here
print("data"+parsed["data"].toString() ); // response body (JSON)
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getCardFlags Used login customer
Map<String, dynamic> getFlagsdata = {
'cardId': '230705103521821ID1CARD0150896',
'loginAuthToken':
"C91CHRaYISg0fZAPbpqbDxRdcXGJKlv/E/jCEuLTWGQmMaaA="
};
getFlags(getFlagsdata, context, "PROD_SANDBOX");
static Future<void> getFlags(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getCardFlags(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function updateCardFlags Used login customer
Map<String, dynamic> updateCardFlagsdataFlag = {
'cardId': '230705103521821ID1CARD0150896',
'cardFlags': {
'ATM_ENABLED': false,
'POS_ENABLED': false,
'ECOM_ENABLED': true,
'CL_ENABLED': false
}
};
updateCardFlags(updateCardFlagsdataFlag, context, "PROD_SANDBOX", "AuthToken");// AuthToken card Holder card token
static Future<void> updateCardFlags(Map<String, dynamic> data, BuildContext context, String evn, String authToken) async {
try {
final products = await Card91RemoteServices.updateCardFlags(data, evn, authToken);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function lockCard Used login customer
Map<String, dynamic> lockCarddata = {
'cardId': '230705103521821ID1CARD0150896',
'loginAuthToken': "C91CHRaYISg0fZAPbpqbDxRdcXGJKlv/E/jCEuLTWGQmMaaA=",
'lock': true
};
lockCard(lockCarddata, context, "PROD_SANDBOX");
static Future<void> lockCard(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.lockCard(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getCardWalletDetails Used login customer
Map<String, dynamic> getCardWalletDetailsdata = {
'cardId': '230705103521821ID1CARD0150896',
'loginAuthToken': "C91CHRaYISg0fZAPbpqbDxRdcXGJKlv/E/jCEuLTWGQmMaaA="
};
getCardWalletDetails(getCardWalletDetailsdata, context, "PROD_SANDBOX");
static Future<void> getCardWalletDetails(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getCardWalletDetails(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function blockCardOTP Used login customer
Map<String, dynamic> blockCardOTPdata = {
'cardId': '230705103521821ID1CARD0150896'
}
blockCardOTP(blockCardOTPdata, context, "PROD_SANDBOX", "auth_token");
static Future<void> blockCardOTP(Map<String, dynamic> data, BuildContext context, String evn, String loginAuthToken) async {
try {
final products = await Card91RemoteServices.blockCardOTP(data, evn, loginAuthToken );
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString()); // True when api is success and false on failed
print("headers"+parsed["headers"].toString()); // Header values from the API
print("data"+parsed["data"].toString() ); // Response Data
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function blockCardConfirmation Used login customer
Map<String, dynamic> data = {
'cardId': '230705103521821ID1CARD0150896',/// card id String
'reason':"",/// String eg. "LOST", "DAMAGED", "STOLEN", "NOT REQUIRED"
'sessionId':"",/// String
'otp':""/// String
};
blockCardConfirmation(data, context, "PROD_SANDBOX", "");
static Future<void> blockCardConfirmation(Map<String, dynamic> data, BuildContext context, String evn, String authToken) async {
try {
final products = await Card91RemoteServices.blockCardConfirmation(data, evn, authToken);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function addBeneficiary Used login customer
Map<String, dynamic> addBeneficiarydata = {
"issuerCode": "YES",// Issuer code
"accountNumber": "BBB1916624", /// Account number of the bene account
"ifscCode": "NSDL0006184", // IFSC code of bene account bank
"name": "Niket Rawat" /// Name on account
};
addBeneficiary(addBeneficiarydata, context, "PROD_SANDBOX", "authToken", "mobile");
static Future<void> addBeneficiary(Map<String, dynamic> data, BuildContext context, String evn, String authToken, String mobile) async {
try {
final products = await Card91RemoteServices.addBeneficiary(data, evn, authToken, mobile);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getAllBeneficiary Used login customer
Map<String, dynamic> getAllBeneficiarydata = {
"issuerCode": "YES", // Issuer code
"ifscCode": "NSDL0006184", /// ifsc code of the bene
"name": "Niket Rawat", // account holder name
'page': "1",
"mobileNo": "917096482153",// bene mobile number (optional)
'perPage': "25", // for pagination
'loginAuthToken': "C91CHIRmv9fxiWvZgqk2YkLP+HwIrGOMwfvk0873bmsG0KAs=" // card holder auth token
};
getAllBeneficiary(getAllBeneficiarydata, context, "PROD_SANDBOX");
static Future<void> getAllBeneficiary(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getAllBeneficiary(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getBeneficiaryDetails Used login customer
Map<String, dynamic> getBeneficiaryDetailsdata = {
'beneficiaryId':
"230712125533217ID1BENF6095840", // bene Id
'loginAuthToken': "C91CHIRmv9fxiWvZgqk2YkLP+HwIrGOMwfvk0873bmsG0KAs=" // auth token
};
getBeneficiaryDetails(getBeneficiaryDetailsdata, context, "PROD_SANDBOX");
static Future<void> getBeneficiaryDetails(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getBeneficiaryDetails(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function transferMoneyToBeneficiary Used login customer
Map<String, dynamic> transferMoneyToBeneficiarydata = {
'beneficiaryId':
"230712125533217ID1BENF6095840", // bene id
'amount': "500", // amount transfferring
'transferMethod': "IMPS" // mode
};
transferMoneyToBeneficiary(transferMoneyToBeneficiarydata, context, "PROD_SANDBOX","authToken","cardId");
static Future<void> transferMoneyToBeneficiary(Map<String, dynamic> data, BuildContext context, String evn, String authToken, String cardId) async {
try {
final products = await Card91RemoteServices.transferMoneyToBeneficiary(data, evn, authToken, cardId);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getBeneficiaryTransactions Used login customer
Map<String, dynamic> getBeneficiaryTransactionsdata = {
'loginAuthToken': "C91CHXg9qzUuDzh1VzjNCOaPnxw5wi7430wRTsZFsOR1xGyc=", //Auth token
'beneficiaryId': "230714095131301ID1BENF5758415", //bene id
'transferStatus': "", // transaction status
'txnMethod': "0",
'page': "1",
'perPage': "2",
'from': "",
'to':""
};
getBeneficiaryTransactions(getBeneficiaryTransactionsdata, context, "PROD_SANDBOX");
static Future<void> getBeneficiaryTransactions(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getBeneficiaryTransactions(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getCardLimit Used login customer
Map<String, dynamic> getCardLimitdata = {
'loginAuthToken': "C91CHoq2DVMFut2xI8UvtbZ4CFdppHQfWVq8qdMt2cETcQdI=", //Auth token
'cardID': '230705103521821ID1CARD0150896', // cardId of the card holder
};
getCardLimit(data, context, "PROD_SANDBOX");
static Future<void> getCardLimit(Map<String, dynamic> data, BuildContext context, String evn) async {
try {
final products = await Card91RemoteServices.getCardLimit(data, evn);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function setCardLimit Used login customer
List<Map<String, dynamic>> setCardLimitdata = [
{
"txnType": "ECOM",
"userLimit": "200",
"maxLimit": "10000",
"period": "M",
"enabled": false
},
{
"txnType": "ECOM",
"userLimit": "10000",
"maxLimit": "10000",
"period": "D",
"enabled": false
},
{
"txnType": "ECOM",
"userLimit": "10",
"maxLimit": "10000",
"enabled": false
},
{
"txnType": "CL",
"userLimit": "10000",
"maxLimit": "10000",
"period": "D",
"enabled": false
},
{
"txnType": "CL",
"userLimit": "5000",
"maxLimit": "5000",
"enabled": false
},
];
setCardLimit(setCardLimitdata, context, "PROD_SANDBOX", "{authToken}","{cardNumber");
static Future<void> setCardLimit(List<Map<String, dynamic>> data, BuildContext context, String evn, String authToken, String cardNumber) async {
try {
final products = await Card91RemoteServices.setCardLimit(data, evn, authToken, cardNumber);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getKitTracking Used login customer
Map<String, dynamic> trackingData = {
'cardId': "231103073943678ID1CARD1874470", // Card Id of the card holder
'kitNumber': "230001048175" // Kit number of the mapped card
};
getKitTracking(trackingData, // Tracking map object defined above
"PROD_SANDBOX", // Env
"C91CHECUiuoXO84D61spxcISJQHbM16aHwv4qXr0EvXApkCw=");
static Future<void> getKitTracking(Map<String, dynamic> data, String evn, String authToken) async {
try {
final products = await Card91RemoteServices.getKitTracking(data, evn, authToken);
if (products != null) {
final Map parsed = json.decode(products);
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Function getAWBStatus Used login customer
Map<String, dynamic> awbTrackingData = {
'cardId': "231103073943678ID1CARD1874470", // card holder card Id
'kitNumber': "230001048175", // kit number
'awb': "80275624397",
};
getAWBStatus(awbTrackingData,
"PROD_SANDBOX",
"C91CHmGRJhY46jW4Z3BRlFD8ljUwZYmiFpj+VgoPsF64AQNE=");
static Future<void> getAWBStatus(Map<String, dynamic> data, String evn, String authToken) async {
try {
final products = await Card91RemoteServices.getAWBStatus(data, evn, authToken);
if (products != null) {
final Map parsed = json.decode(products);
print("json"+products.toString());
print("Success"+parsed["success"].toString());
print("headers"+parsed["headers"].toString());
print("data"+parsed["data"].toString() );
}
else {
print("Failed--"+products.toString().toString());
}
} catch (error) {
print(error);
String errorStr = "";
if (errorStr == 'Unauthorised') {
print("into Unauthorised");
} else {
print("Exception error--"+'$error');
}
}
}
Responses
Name | Type | Description |
---|---|---|
success | boolean | it should come in true/false based on value |
data | object | it will have response data from card91 services |
header | object | it will have response header from card91 services |