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

unlistedoutdated

A flutter plugin to connect flutter app with Clover payment devices.

clover_connect #

A flutter plugin to connect flutter app with Clover payment devices.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Clover Semi-Integration #

Learn more about Clover development basics

Secure Network Pay Display #

Installing a Pay Display app

Configuring Secure Network Pay Display

Clover Connector iOS SDK #

This plugin uses Clover Connector iOS SDK

Installation #

Add following dependencies into Podfile in ios directory like this

pod 'Starscream', :git => 'https://github.com/clover/Starscream.git', :branch => 'queuePriority-3.0.0'

pod 'CloverConnector', :git => 'https://github.com/clover/remote-pay-ios.git', :tag => '4.0.0'

Continue to follow installation steps here

Usage #

Refer full example here

Connect #

String _connectionStatus = 'Unknown';

final cloverEndpointTextEditingController = TextEditingController(text: 'wss://192.168.1.123:12345/remote_pay');

Future<void> connect() async {
  String connectionStatus;
  String endpoint = cloverEndpointTextEditingController.text;

  try {
    var cloverConfig = CloverConfig(endpoint: endpoint);
    connectionStatus = await CloverConnect.connect(cloverConfig);
  } on PlatformException {
    connectionStatus = 'Failed to connect Clover.';
  }

  setState(() {
    _connectionStatus = connectionStatus;
  });
}

Get Pairing Code #

String _pairingCode = 'Unknown';

Future<void> getPairingCode() async {
  String pairingCode;

  try {
    pairingCode = await CloverConnect.pairingCode;
  } on PlatformException {
    pairingCode = 'Failed to get pairing code.';
  }

  setState(() {
    _pairingCode = pairingCode;
  });
}

Get Current Status #

String _currentStatus = 'Unknown';

Future<void> getCurrentStatus() async {
  String currentStatus;

  try {
    currentStatus = await CloverConnect.currentStatus;
  } on PlatformException {
    currentStatus = 'Failed to get current status.';
  }

  setState(() {
    _currentStatus = currentStatus;
  });
}

Sale #

String _saleStatus = 'Unknown';

final saleAmountTextEditingController = TextEditingController(text: '1.23');
final saleExternalIdTextEditingController = TextEditingController(text: '123456');

Future<void> sale() async {
  String saleStatus;
  int amount = (double.parse(saleAmountTextEditingController.text) * 100).toInt();
  String externalId = saleExternalIdTextEditingController.text;

  try {
    var saleRequest = SaleRequest(amount: amount, externalId: externalId);
    saleStatus = await CloverConnect.sale(saleRequest);
  } on PlatformException {
    saleStatus = 'Failed to connect Clover.';
  }

  setState(() {
    _saleStatus = saleStatus;
  });
}

Disconnect #

Future<void> disconnect() async {
  String connectionStatus;

  try {
    connectionStatus = await CloverConnect.disconnect();
  } on PlatformException {
    connectionStatus = 'Failed to disconnect Clover.';
  }

  setState(() {
    _connectionStatus = connectionStatus;
  });
}
1
likes
0
pub points
0%
popularity

Publisher

verified publisherphan.dev

A flutter plugin to connect flutter app with Clover payment devices.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on clover_connect