pagarme_flutter_card_hash 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 69

pagarme_flutter_card_hash #

Build Status

A Flutter package that allows you to generate card hashes to be used with pagar.me's payment platform.

Is this safe? #

Well, that's something I wondered too when I was looking for a third party package to use to generate card hashes when facing the fact that generating the card_hash using pagarme.js library wasn't neat enough in Flutter.

I began looking into pagar.me's C# and PHP libraries and found out that what they do is basically the process documented here.

So I basically replicated that process.

I tried to keep the code as simple as possible so that people could see that there's no monkey business amidst the lines.

Enjoy

Getting Started #

First, add pagarme_flutter_card_hash as a dependency in your pubspec.yaml file.

Then all you have to do is the following:

String pagarMeApiKey = "ek_test_yCRumKDVQgqFkjlQojnTSHgWw7UI5g";

PagarMeCard pagarMeCard = new PagarMeCard(
      cardHolderName: "John Snow",
      cardCvv: "235",
      cardNumber: "5448280000000007",
      cardExpirationDate: "0620");

PagarMeFlutterCardHash pagarMeFlutterCardHash = new PagarMeFlutterCardHash(
    pagarMeApiKey: pagarMeApiKey, 
    pagarMeCard: pagarMeCard);

String cardHash = await pagarMeFlutterCardHash.generateCardHash();

print(cardHash); //Outputs something like: 1842883_Ha6Q2D/xYkuKXpgbDwy3HnrJpO2oX3c...

P.S.: This package assumes that the card data you are using has already been validated.

TODO:

Improve exceptions
Write (more) tests
Improve documentation

Author #

  • Charles Washington de Aquino dos Santos - Caws

0.1.0 #

  • Add example, bump version to 0.1.0 and format pagarme_public_key.dart file.

0.0.3 #

  • Add comments to a few methods. Fix formatting for a few files.

0.0.2 #

  • Add PagarMeCard model to clean up the code a bit. Correct typo in a few classes. Add basic tests for basic coverage.

0.0.1 #

  • Initial Release

example/README.md

pagarme_flutter_card_hash_example #

An example flutter app showcasing the usage of the package pagarme_flutter_card_hash.

Enjoy

Author #

  • Charles Washington de Aquino dos Santos - Caws

Use this package as a library

1. Depend on it

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


dependencies:
  pagarme_flutter_card_hash: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:pagarme_flutter_card_hash/pagarme_flutter_card_hash.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (dio).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
dio ^2.1.5 2.2.2 3.0.5
encrypt ^3.2.0 3.3.1
flutter 0.0.0
Transitive dependencies
args 1.5.2
asn1lib 0.5.14
charcode 1.1.2
clock 1.0.1
collection 1.14.11 1.14.12
convert 2.1.1
cookie_jar 1.0.1
crypto 2.1.3
meta 1.1.7 1.1.8
pointycastle 1.0.2
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test