nps_sdk 0.0.6

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

Dart SDK (Under Development)

Availability

Supports Dart from 1.2 to 2.0

How to install

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

dependencies:
  nps_sdk: "^0.0.6"

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"]))
          .catchError((error) => print);
}

You can also print all the response in the console instead of just accessing to one key:

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"]);
            jsonPrettyPrint(resp);
          })
          .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
              });
}

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_HERE"
  };

  Future response = nps.getINNDetails(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.6"

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
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

Analysis

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

  • Dart: 2.0.0-dev.63.0
  • pana: 0.11.3

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
95 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100 / 100
Overall score:
Weighted score of the above. [more]
49
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

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

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.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 7 hints.

    Run dartfmt to format lib/nps_sdk.dart.

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

    Similar analysis of the following files failed:

    • lib/src/serializer.dart (hint)
    • lib/src/services.dart (hint)
    • lib/src/soap_client.dart (hint)
    • lib/src/utilities.dart (hint)

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <2.0.0
http ^0.11.3+16 0.11.3+16
xml ^2.6.0 2.6.0 3.0.0
xml2json ^2.0.13 2.0.13 2.0.14
Transitive dependencies
async 2.0.7
charcode 1.1.1
collection 1.14.10
http_parser 3.1.2
matcher 0.12.3
path 1.6.1
petitparser 1.7.6
source_span 1.4.0
stack_trace 1.9.2
string_scanner 1.0.2
typed_data 1.1.5
Dev dependencies
test ^0.12.0