nps_sdk 1.0.0

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

Dart SDK

Availability

Supports Dart from 2.0 to above

How to install

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

dependencies:
  nps_sdk: "^1.0.0"

If pub get wasn't automatically ejecuted, you can do it manually by opening a terminal in your project and executing the 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.

1.0.0

  • Upgrade to Dart 2

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: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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:nps_sdk/nps_sdk.dart';
  
Version Uploaded Documentation Archive
1.0.0 Aug 31, 2018 Go to the documentation of nps_sdk 1.0.0 Download nps_sdk 1.0.0 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]
23
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]
57
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:nps_sdk/nps_sdk.dart.

Health suggestions

Format lib/nps_sdk.dart.

Run dartfmt to format lib/nps_sdk.dart.

Format lib/src/constants.dart.

Run dartfmt to format lib/src/constants.dart.

Format lib/src/deserializer.dart.

Run dartfmt to format lib/src/deserializer.dart.

Fix additional 4 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/serializer.dart (Run dartfmt to format lib/src/serializer.dart.)
  • lib/src/services.dart (Run dartfmt to format lib/src/services.dart.)
  • lib/src/soap_client.dart (Run dartfmt to format lib/src/soap_client.dart.)
  • lib/src/utilities.dart (Run dartfmt to format lib/src/utilities.dart.)

Maintenance suggestions

The description is too short. (-20 points)

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 >=2.0.0-dev <3.0.0
http ^0.11.3+17 0.11.3+17 0.12.0
xml ^3.2.0 3.2.3
xml2json ^3.0.1 3.0.3
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.6
path 1.6.2
petitparser 2.0.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6