nps_sdk 0.0.9

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

Dart SDK

Availability

Supports Dart from 1.2 to above

How to install

Add the following line in dependencies in your pubspec.yaml file:

dependencies:
  nps_sdk: "^0.0.9"

Then open a terminal in your project and execute the following command:

pub get

Now you are ready to import our SDK:

import 'package:nps_sdk/nps_sdk.dart';

Configuration

It's a basic configuration of the SDK

import 'dart:async';

import 'package:nps_sdk/nps_sdk.dart';

main(List<String> arguments) async {
  Nps nps = new Nps(sandbox);
}

Here is an simple example request:

import 'dart:async';

import 'package:nps_sdk/nps_sdk.dart';

main(List<String> arguments) async {
  Nps nps = new Nps(sandbox);

  Map createPaymentMethodTokenParams = {
    "psp_Version": "2.2",
    "psp_MerchantId": "sdk_test",
    "psp_CardInputDetails": {
      "Number": "4507990000000010",
      "ExpirationDate": "2501",
      "SecurityCode": "123",
      "HolderName": "JOHN DOE"
    },
    "psp_ClientSession": "YOUR_CLIENT_SESSION_HERE"
  };

  Future response = nps.createPaymentMethodToken(nps, createPaymentMethodTokenParams);
  response.then((resp) {
            print(resp["psp_ResponseCod"]); //Only one key
            jsonPrettyPrint(resp); //All the XML
          })
          .catchError((error) => print);
}

Environments

import 'package:nps_sdk/nps_sdk.dart';

Nps nps = new Nps(sandbox);
Nps nps = new Nps(staging);
Nps nps = new Nps(production);

Error handling

With this SDK you will be able to handle errors as you prefer. In order to do this, you just need to specify what you want to do with the error in the catchError callback:

import 'dart:async';

import 'package:nps_sdk/nps_sdk.dart';

main(List<String> arguments) async {
    //Code
    
    Future response = nps.createPaymentMethodToken(nps, createPaymentMethodTokenParams);
      response.then((resp) => print(resp["psp_ResponseCod"]))
              .catchError((error) {
                //Your code to handle the error
              });
}

Flutter

This SDK can be imported in Flutter's projects. For a Flutter example, click here.

0.0.9

  • Fixed pub warnings

0.0.8

  • Added Flutter example

0.0.7

  • Changed xml's library version

0.0.6

  • Refactored code

0.0.5

  • Added methods for validation
  • Changed hosts' paths
  • Fixed getInstallmentsOptions method

0.0.4

  • Made changes in README.md

0.0.3

  • Made changes in README.md

0.0.2

  • Made changes in the example

0.0.1

  • First SDK's commit

example/nps_sdk_example.dart

import 'dart:async';

import 'package:nps_sdk/nps_sdk.dart';

main(List<String> arguments) async {
  Nps nps = new Nps(sandbox);

  Map createPaymentMethodTokenParams = {
    "psp_Version": "2.2",
    "psp_MerchantId": "sdk_test",
    "psp_CardInputDetails": {
      "Number": "4507990000000010",
      "ExpirationDate": "2501",
      "SecurityCode": "123",
      "HolderName": "JOHN DOE"
    },
    "psp_ClientSession": "YOUR_CLIENT_SESSION"
  };

  Future response = nps.createPaymentMethodToken(nps, createPaymentMethodTokenParams);
  response.then((resp) => jsonPrettyPrint(resp))
          .catchError((error) => print);
}

Use this package as a library

1. Depend on it

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


dependencies:
  nps_sdk: ^0.0.9

2. Install it

You can install packages from the command line:

with pub:


$ pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:nps_sdk/nps_sdk.dart';
  
Version Uploaded Documentation Archive
0.0.9 Jul 24, 2018 Go to the documentation of nps_sdk 0.0.9 Download nps_sdk 0.0.9 archive
0.0.7 Jul 4, 2018 Go to the documentation of nps_sdk 0.0.7 Download nps_sdk 0.0.7 archive
0.0.6 Jun 14, 2018 Go to the documentation of nps_sdk 0.0.6 Download nps_sdk 0.0.6 archive
0.0.5 Jun 14, 2018 Go to the documentation of nps_sdk 0.0.5 Download nps_sdk 0.0.5 archive
0.0.4 Jun 7, 2018 Go to the documentation of nps_sdk 0.0.4 Download nps_sdk 0.0.4 archive
0.0.3 Jun 6, 2018 Go to the documentation of nps_sdk 0.0.3 Download nps_sdk 0.0.3 archive
0.0.2 Jun 5, 2018 Go to the documentation of nps_sdk 0.0.2 Download nps_sdk 0.0.2 archive
0.0.1 Jun 5, 2018 Go to the documentation of nps_sdk 0.0.1 Download nps_sdk 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
7
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
3
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0