techprocess 0.0.2 copy "techprocess: ^0.0.2" to clipboard
techprocess: ^0.0.2 copied to clipboard

discontinued
PlatformAndroidiOS

tech process payment gateway

example/lib/main.dart

import 'dart:async';
import 'dart:math';


import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:techprocess/techprocess.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String result = "";

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    // We also handle the message potentially returning null.
    try {
      platformVersion =
          await Techprocess.platformVersion ?? 'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
            // child: Text('Running on: $_platformVersion\n'),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('Running on: $_platformVersion\n'),
            ElevatedButton(
              child: const Text("Call TechProcess"),
              onPressed: () => _startTransaction(),
            ),
            Text(result),
          ],
        )),
      ),
    );
  }

  Future<void> _startTransaction() async {
    dynamic techMerchantCode = "";
    dynamic transactionNo = Random.secure().nextInt(1 << 32).toString();
    dynamic techTransactionReference = "";
    dynamic techTransactionType = "";
    dynamic techTransactionSubType = "";
    dynamic techCurrency = "";
    dynamic amount = "1";
    dynamic emailId = "panneer060@gmail.com";
    dynamic mobileNo = "";
    dynamic schemaCode = "";
    dynamic publicKey = "";
    dynamic mode = "DC";

    var sendMap = <String, dynamic>{
      "techMerchantCode": techMerchantCode,
      "transactionNo": transactionNo,
      "techTransactionReference": techTransactionReference,
      "techTransactionType": techTransactionType,
      "techTransactionSubType": techTransactionSubType,
      "techCurrency": techCurrency,
      "amount": amount,
      "emailId": emailId,
      "mobileNo": mobileNo,
      "schemaCode": schemaCode,
      "publicKey": publicKey,
      "mode": mode
    };
    debugPrint(sendMap.toString());
    try {
      var response = Techprocess.startTransaction(
          techMerchantCode,
          transactionNo,
          techTransactionReference,
          techTransactionType,
          techTransactionSubType,
          techCurrency,
          amount,
          emailId,
          mobileNo,
          schemaCode,
          publicKey,
          mode);
      response.then((value) {
        debugPrint(value.toString());
        setState(() {
          result = value.toString();
        });
      }).catchError((onError) {
        if (onError is PlatformException) {
          setState(() {
            result = onError.message.toString() +
                " \n  " +
                onError.details.toString();
          });
        } else {
          setState(() {
            result = onError.toString();
          });
        }
      });
    } catch (err) {
      result = err.toString();
    }
  }
}
0
likes
120
points
3
downloads

Publisher

unverified uploader

Weekly Downloads

tech process payment gateway

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on techprocess

Packages that implement techprocess