Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-sp-reader-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-sp-reader-sdk

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-sp-reader-sdk

Dependencies

react-native version >0.40

Installation

Check the wiki for instructions.

Usage


import ReaderSDK from 'react-native-sp-reader-sdk';

Example

class testApp extends Component {
  constructor() {
    super();
    const readerSdk = new ReaderSDK();


    // initialize the sdk
    readerSdk.initSdk();


    // login with an auth code
    readerSDK.authorizeWithCode("1234567").then(() => {
      // success
    }).catch((err) => {
      // failure
    })

    // find out if already logged into readerSDK
    const isLoggedIn = await readerSdk.isLoggedIn();


    // set other settings
    readerSDK.setCheckoutParameters(
      ReaderSDK
        .AdditionalPaymentTypes
        .MANUAL_CARD_ENTRY, // additional payment types
      null, // tip percentages arr
      tipsEnabled, // tips enabled
      false, // custom tip field visible
      false, // separate tip screen visible
      true, // skip receipt
      false, // always require signature
      false, // allow split tender
    );

    // present the settings screen
    readerSDK.presentReaderSettingsScreen(
      true, // animate modal window
    );

    // find out if logged in
    const isLoggedIn = readerSDK.isLoggedIn()
      .then(isLoggedIn => {
        // isLoggedIn is either true or false
      });

    readerSDK.requestPermissions() // so try asking for permissions (needed for iOS)
      .then((permissions) => {
        if (permissions != null) {
          let permissionsGranted;
          if (notAndroid) {
            const {
              appLocationPermission,
              deviceLocationEnabled,
              appRecordingPermission,
            } = permissions;
            // do sth?
          }
        }
      });

     readerSDK.checkoutWithAmount(
        100, // amount to pay (in cents)
        'This is a transaction', // transaction notes
      ).then((result) => { // transactionRequestWithCentsAmount success
         /*
          {
              "transaction": {
                createdAt:"2018-07-25T18:13:02+03:00"
                locationID:"18K28ZA1PZF1T"
                tenderCnt:1
                totalMoneyAmount:115 (in cents, aka 1,15$)
                totalMoneyCurrency:"USD"
                totalTipMoneyAmount:15 (in cents, aka 0,15$)
                totalTipMoneyCurrency:"USD"
                transactionClientID:"EE8E7FF7-D16E-4350-91AD-47F2S6C7B447"
                transactionID:"Wo5JKw2fOp7dfwai7Gv3FlO14D9eV"
              }
          }
          */

        // Do something with the result
      })
      .catch((e) => { // checkoutWithAmount error
      });

      readerSDK.deauthorize(); // logout
    }
  ...
}

Keywords

FAQs

Package last updated on 26 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc