1.0.4 • Published 2 months ago

react-native-lio v1.0.4

Weekly downloads
-
License
Unlicense
Repository
github
Last release
2 months ago

Version NPM

react-native-lio fornece a integração de aplicações que usam React Native à máquina CIELO Lio, implementando os principais métodos usados, baseado na documentação https://developercielo.github.io/manual/cielo-lio

Features

  1. Fornece as operações básicas de integração, compra e impressão usando Cielo LIO.
  2. Fornece outros métodos auxiliares para capturar informações e estados da máquina.

Installation

Vale ressaltar que este pacote tem suporte apenas para Android, visto que é o SO utilizado pela LIO.

  1. Instale o pacote

    from npm

    npm install react-native-lio

    from yarn

    yarn add react-native-lio
  2. Adicione ao final do arquivo /android/build.gradle

allprojects {
   ...
   repositories {
      maven {
        ...
        jcenter()
        maven {
            url("$rootDir/../node_modules/react-native-lio/android/cielo-sdk")
        }
    }
}
  1. Adicione ou altere no android/app/src/main/AndroidManifest.xml o allowBackup para true
android:allowBackup="true"

Supported react-native versions

react-native-lioreact-native
1.0.0<= 0.64.5
1.0.1<= 0.64.5
1.0.2> 0.64.5

API

- setup(clientID, accessToken, ec)

Load library with client ID, accessToken and ec.

  • Client-Id Access identification. It's generation takes place at the time of creation by the developer panel. Its value can be viewed in the Client ID column, within the ‘Client ID Registered’ menu;
  • Access-Token Access token identification, which stores the access rules allowed to the Client ID. Its generation takes place when the Client ID is created by the developer panel. It's value can be viewed by clicking on 'details' in the 'Access Tokens' column, within the 'Client ID Registered' menu;
  • Ec is an client code;

- requestPaymentCrashCredit(amount, orderId)

Request payment with credit on sight. amout, value to pay; orderId, order number to transaction;

requestPaymentCreditInstallment(amount, orderId, installments)

Request payment with credit in installments. amout, value to pay; orderId, order number to transaction; *installments, number of installments

requestPaymentDebit(amount, orderId)

Request payment with credit on sight. amout, value to pay; orderId, order number to transaction;

getMachineInformation()

Gets the machine informations.

getOrderList()

Gets order list.

createDraftOrder()

Creats a draft order.

addItems()

Add items to order.

placeOrder()

checkoutOrder()

printText(text, style)

Print one line text using machine printter.

  • text: texto to print;
  • style: style of text;

printImage(encodedImage, style = {})

Print an image using machine printter.

  • encodedImage: Image encoded with base64 to print;
  • style: style of image;

addListener()

Troubleshooting

Unexpected behavior

If you have unexpected behavior, please create a clean project with the latest versions of react-native and react-native-lio

react-native init CleanProject
cd CleanProject/
yarn add react-native-lio

Make a reproduction of the problem in App.js

react-native run-android

Opening issues

Verify that it is still an issue with the latest version as specified in the previous step. If so, open a new issue, include the entire App.js file, specify what platforms you've tested, and the results of running this command:

react-native info