rafaelsalves / react-native-lio

Utilizar o lio em aplicações com react native.
The Unlicense
5 stars 4 forks source link

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")
        }
    }
    }
  3. Adicione ou altere no android/app/src/main/AndroidManifest.xml o allowBackup para true

    android:allowBackup="true"

Supported react-native versions

react-native-lio react-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.

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

printImage(encodedImage, style = {})

Print an image using machine printter.

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