mobilepay_appswitch 0.9.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new75

Flutter plugin for MobilePay AppSwitch SDK

This is an unofficial Flutter plugin wrapping the MobilePay AppSwitch libraries for iOS and Android to enable Flutter apps to use the MobilePay AppSwitch SDK.

This plugin is not developed, published or otherwise affiliated with Danske Bank or MobilePay, but is a private project released "as-is" to the public by the author.

iOS

For iOS support add the following to your info.plist. Replace mobilepayappswitchexample with your own URL Scheme.

<array>
    <dict>
        <key>CFBundleURLSchemes</key>
        <array>
            <string>mobilepayappswitchexample</string>
        </array>
        <key>CFBundleURLName</key>
        <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    </dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
    <string>mobilepay</string>
    <string>mobilepayno</string>
    <string>mobilepayfi</string>
</array>

Limitations

Some pararmeters are not supported like accepted url. But the essentials should work well.

And iOS is not supported... yet.

[0.9.0] - 6. september 2018

  • Support for iOS 9.0 and above

[0.8.1] - 30. august 2018

  • Fixed pubspec.yaml to allow higher Flutter versions

[0.8.0] - 28. august 2018

  • Added support for settings capture type

[0.0.2] - 24. august 2018

  • Fixed wrong return type in init.

[0.0.1] - 24. august 2018

  • Support on Android for essential SDK features.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:mobilepay_appswitch/mobilepay_appswitch.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  initState() {
    super.initState();
    initAppSwitch();
  }

  initAppSwitch() async {
    await MobilepayAppswitch.init(
      merchantId: "APPDK0000000000", 
      country: Country.DENMARK,
      urlScheme: 'mobilepayappswitchexample');
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(home: PaymentTest());
  }
}

class PaymentTest extends StatelessWidget {
  makePayment(BuildContext context, double price) async {
    PaymentResponse paymentResponse =
        await MobilepayAppswitch.makePayment(orderId: "TESTINGS_ID", price: price);

    if (paymentResponse.success) {
      showDialog(
          context: context,
          builder: (_) => AlertDialog(
                content: Text("yay"),
                title: Text("Payment successful"),
              ));
    } else {
      showDialog(
          context: context,
          builder: (_) => AlertDialog(
                title: Text("Failed to complete payment"),
                content: Text("${paymentResponse.error.errorMessage}\nError code: ${paymentResponse.error.errorCode}"),
              ));
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: new AppBar(
        title: new Text('Plugin example app'),
      ),
      body: new Center(
        child: RaisedButton(
            onPressed: () => makePayment(context, 10.0),
            child: Text("Make payment")),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  mobilepay_appswitch: ^0.9.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:mobilepay_appswitch/mobilepay_appswitch.dart';
  
Version Uploaded Documentation Archive
0.9.0 Sep 6, 2018 Go to the documentation of mobilepay_appswitch 0.9.0 Download mobilepay_appswitch 0.9.0 archive
0.8.1 Aug 29, 2018 Go to the documentation of mobilepay_appswitch 0.8.1 Download mobilepay_appswitch 0.8.1 archive
0.8.0 Aug 28, 2018 Go to the documentation of mobilepay_appswitch 0.8.0 Download mobilepay_appswitch 0.8.0 archive
0.0.2 Aug 24, 2018 Go to the documentation of mobilepay_appswitch 0.0.2 Download mobilepay_appswitch 0.0.2 archive
0.0.1 Aug 24, 2018 Go to the documentation of mobilepay_appswitch 0.0.1 Download mobilepay_appswitch 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Sep 18, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.3
  • Flutter: 0.8.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Suggestions

The description is too short.

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.19.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8