npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-stone-pos

v1.0.0

Published

test

Downloads

35

Readme

react-native-stone-pos

Stone Android POS Native Module

Installation

Stone has a private packageCloud repository, so we need to have your token before hand in order to communicate with package cloud.

So you have two options:

Environment variable / Project properties

We support both options, as adding the variables to your gradle.properties in your android folder, or setting it as a global environment variable. (This is useful when you are building it from CI)

The most important variable you need is: StonePos_packageCloudToken. This variable is used to authenticate with Stone private package Cloud repo, so we can download our dependencies.

Other variables you might want:

| Name | Default Value | Description | | ------------------------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | StonePos_posMode | pos | Set this to anything other than pos to remove the HAL dependencies all together, this is useful if you are building an app to mobile devices other than the POS | | StonePos_includeIngenico | true | Set this to anything other than true to remove the Ingenico hal dependencies | | StonePos_includeSunmi | true | Set this to anything other than true to remove the Sunmi hal dependencies | | StonePos_includeGertec | true | Set this to anything other than true to remove the Gertec hal dependencies | | StonePos_includePositivo | true | Set this to anything other than true to remove the Positivo hal dependencies |

Install Steps:

npm install react-native-stone-pos

Android

YOU NEED TO DO THIS

Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:

apply from: "../../node_modules/react-native-stone-pos/android/stone-repo.gradle"

If you are building with the POS in mind, you will also need to apply this here:

apply from: "../../node_modules/react-native-stone-pos/android/dynamic-hal.gradle"

This will enable the HAL modules of your choosing, or all of them as long as you are in POS mode, or the StonePos_include* variables are true

Troubleshooting

MinSDK

You need to use minSDK to 22, otherwise it will fail (Stone Requires this)

Manifest merger failed : Attribute application@allowBackup value=(false)

You might get an error when you are using the default React Native Manifest, which is:

Manifest merger failed : Attribute application@allowBackup value=(false) from AndroidManifest.xml:12:7-34
  	is also present at [br.com.stone:stone-sdk:4.1.1] AndroidManifest.xml:20:9-35 value=(true).
  	Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-12:19 to override.

So, as per the suggestion, you can add tools:replace="android:allowBackup" to your <application> element at your android/app/src/main/AndroidManifest.xml file, like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.yourapp.here">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:allowBackup="true"
      tools:replace="android:allowBackup"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>
More than one file was found with OS independent path 'META-INF/client_release.kotlin_module'

If you get this error:

More than one file was found with OS independent path 'META-INF/client_release.kotlin_module'

Try modifying android/app/build.gradle and add this inside the android section:

packagingOptions {
  exclude 'META-INF/api_release.kotlin_module'
  exclude 'META-INF/client_release.kotlin_module'
}

Usage

import * as StonePOS from 'react-native-stone-pos';

// ...

const isRunningInPOS = StonePOS.IS_RUNNING_IN_POS;
const activationResult = await StonePOS.initSDK('My Awesome App', '12345-PIX-KEY', '54321-PIX-SECRET');

if (!isRunningInPos) {
  //Ask user to select the bluetooth pinpad (use any library you like), and then you can connect using:
  const pinpadConnectResult = await StonePOS.connectToPinPad(
    'My beauty pinpad',
    '00:11:22:33:44'
  );
}

Example

Checkout the example project, which was made with the intention of running all the required homologation tests. There you will see how to void, execute a charge, print, and so on.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT