card91_plugin 0.0.4
card91_plugin: ^0.0.4 copied to clipboard
A card91 common package for different features and services.
Card91 issue card flutter plugin #
This package is used to issue card for a customer based on the validated input taken on the form. This package directly communicates to Card91 SDK.
Features #
Package directly communicate with the SDK (secured platform) to issue card and create a card holder.
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';
Usage #
Open the widget by passing the required parameter to use it. Check out the below code snippet for the same.
Sample code below
import 'package:flutter/material.dart';
import 'package:yolo/screens/onboarding/IssueCards.dart';
import 'package:yolo/screens/onboarding/controller_card91.dart';
import 'package:yolo/utils/app_colors.dart';
class OnBoarding extends StatefulWidget {
const OnBoarding({Key? key}) : super(key: key);
@override
State<OnBoarding> createState() => _OnBoardingState();
}
class _OnBoardingState extends State<OnBoarding> {
final Card91Controller _controller = Card91Controller();// create a instance of the Card91Controller which helps calling the SDK required function
String env=""; /// SANDBOX or PROD
String templateId=""; // template id will be provide separately
String cardProgramId="";// eg.230528190350397ID1CP9723194, card ID
String organizationId=""; // eg. 230526135544169ID1OID4070270, Organization id
String uniqueId="";// eg . unique, Unique Identifier
String authUrl=""; // Auth url which all application has to configure in order to get the business token
String cardMode=""; // eg. DIGITAL_ONLY_CARD, type of card user wanted to generate
String customFields="{\"step1\":[{\"name\":\"fullName\",\"displayText\":\"Full Name\",\"elements\":{\"type\":\"text\",\"defaultValue\":\"\"}},{\"name\":\"mobile\",\"displayText\":\"Mobile No.\",\"elements\":{\"type\":\"text\",\"defaultValue\":\"\"}},{\"name\":\"pan\",\"displayText\":\"PAN\",\"elements\":{\"type\":\"text\",\"defaultValue\":\"\"}},{\"name\":\"nameOnCard\",\"displayText\":\"Name on card\",\"elements\":{\"type\":\"text\",\"defaultValue\":\"\"}}]}";
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
color: Colors.black12,
child: Column(
children: [
IconButton(
onPressed: (){
_controller.callStep!("step2");
},
icon: Icon(
Icons.adb_outlined,
size: 30,
color: AppColors.blackFont,
),
),
const SizedBox(height: 20,),
IssueCards(
env: env,
templateId: templateId,
cardProgramId: cardProgramId,
organizationId: organizationId,
uniqueId: uniqueId,
authUrl: authUrl,
cardMode: cardMode,
customFields: customFields,
card91controller: _controller,
onDataResponse: (String dataResponse) {
print("Data response from SDK--->$dataResponse");
},),
// const SponsoredWidget(),
],
),
),
),
// const LoadingIndicatorConsumer<HomeViewModel>()
);
}
}
Sample steps JSON for "customFields" param #
{
"step1": [
{
"name": "fullName",
"displayText": "Full Name",
"elements": {
"type": "text",
"defaultValue": ""
}
},
{
"name": "mobile",
"displayText": "Mobile No.",
"elements": {
"type": "text",
"defaultValue": ""
}
},
{
"name": "pan",
"displayText": "PAN",
"elements": {
"type": "text",
"defaultValue": ""
}
},
{
"name": "nameOnCard",
"displayText": "Name on card",
"elements": {
"type": "text",
"defaultValue": ""
}
}
]
}
For Issue Card takes the following props:
Input props #
Name | Type | Required | Description |
---|---|---|---|
templateId | string | true | Use to indicate key for design template |
environment | string | false | Use "SANDBOX" for production sandbox environment and "PROD" for production environment . |
cardProgramId | string | true | Customer Card program id which come when you login with MPIN/Auth token |
organizationId | string | true | Need to pass business id |
uniqueId | string | true | Need to pass secret key auth url validation |
authUrl | string | true | Auth Url from client need pass in responses attached with token |
onSubmit | string | true | Methods used to trigger submit button through web view |
customFields | object | true | Fields which represent which step have to show |
step | string | true | Steps indicates which represent active step of issue card form |
cardMode | string | true | value should be DIGITAL_ONLY_CARD / PHYSICAL_NAMED_CARD |
Card91 min KYC flutter plugin #
This package is used to complete the min KYC of the customer who has NSDL cards. This package directly communicates to Card91 SDK.
Features #
Package directly communicate with the SDK (secured platform) to complete the min KYC of a card holder.
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';
Usage #
Open the widget by passing the required parameter to use it. Check out the below code snippet for the same.
Sample code below
class OnBoardingKYC extends StatefulWidget {
const OnBoardingKYC({Key? key}) : super(key: key);
@override
State<OnBoardingKYC> createState() => _OnBoardingKYCState();
}
class _OnBoardingKYCState extends State<OnBoardingKYC> {
String env="";/// SANDBOX or PROD
String templateId="";///template id will be provide separately
String mobile=""; //eg. 91***2077430, card holder mobile number
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
const SizedBox(height: 20,),
SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: CardKYCFunction(
env: env,
template: templateId,
mobile: mobile,
onDataResponse: (String dataResponse) {
switch (dataResponse) {
case "C91_MIN_KYC_INITIALISED":
// Do something to indicate that library is initialized
break;
case "C91_MIN_KYC_SUCCESS":
// Do something to indicate that the API calls have succeeded
break;
case "C91_MIN_KYC_API_FAILURE":
// Do something to indicate that the API calls have failed
break;
case "C91_MIN_KYC_AUTHENTICATION_FAILURE":
// Do something to indicate that the API calls have Unauthorized
break;
case "C91_MIN_KYC_SERVER_FAILURE":
// Do something to indicate that the API calls have Server Error
break;
case 'C91_ISSUE_CARD_API_FAILURE':
// Do something to indicate that the API calls have failed
break;
case "C91_MIN_KYC_MISSING_PARAMETER":
// Do something to indicate that Parameter is missing
break;
case "C91_MIN_KYC_OTP_SEND_FAIL":
// Do something to indicate that the API fails to send the OTP
break;
case "C91_MIN_KYC_OTP_VERIFICATION_FAIL":
// Do something to indicate that the API MIN KYC Verification is failed
break;
case 'C91_MIN_KYC_MOBILE_ALREADY_EXIST_OR_INVALID':
// Do something to indicate that the KYC already done or mobile number invalid
// Check the payload to identify the two cases here
}
},),
),
],
),
),
);
}
}
For Issue Card takes the following props:
Input props #
Name | Type | Required | Description |
---|---|---|---|
template | string | true | Use to indicate key for design template |
env | string | true | Use "SANDBOX" for production sandbox environment and "PROD" for production environment . |
mobile | string | true | Card holder mobile number |
onDataResponse | call back function | true | In order to get the callback event from the SDK |
The events are as follows:
The events are as follows:
[block:parameters] { "data": { "h-0": "Event Name", "h-1": "Description", "0-0": "C91_MIN_KYC_INITIALISED", "0-1": "The NSDL MIN KYC screen has been initialised.", "1-0": "C91_MIN_KYC_SUCCESS", "1-1": "The API request related to the NSDL MIN KYC screen was successful.", "2-0": "C91_MIN_KYC_API_FAILURE", "2-1": "The API request related to theNSDL MIN KYC screen has failed.", "3-0": "C91_MIN_KYC_AUTHENTICATION_FAILURE", "3-1": "Authentication for the NSDL MIN KYC screen has failed.", "4-0": "C91_MIN_KYC_SERVER_FAILURE", "4-1": "The server encountered an error while processing the NSDL MIN KYC request.", "5-0": "C91_MIN_KYC_MISSING_PARAMETER", "5-1": "A required parameter is missing in the NSDL MIN KYC request.", "6-0": "C91_MIN_KYC_OTP_SEND_FAIL", "6-1": "The API request for generating the OTP for the NSDL MIN KYC has failed.", "7-0": "C91_MIN_KYC_OTP_VERIFICATION_FAIL", "7-1": "The API request for validating the OTP has failed for the NSDL MIN KYC", "8-0": "C91_MIN_KYC_MOBILE_ALREADY_EXIST_OR_INVALID", "8-1": "KYC for this mobile number is already done or the mobile number is not valid. \nPayload of both these event will be different." }, "cols": 2, "rows": 9, "align": [ "left", "left" ] } [/block]