0.1.14 • Published 2 years ago

rn-pagseguro-plugin v0.1.14

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React-Native-Plugin Pagseguro

A react-native plugin to connect pagseguro to your machine credit card using react-native, machine-credit-card like a "morderninha" or other's.

Getting started

  npm install react-native-plug-pag-service --save

Mostly automatic installation

  react-native link react-native-plug-pag-service

Manual installation

  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.reactlibrary.PlugPagServicePackage; to the imports at the top of the file
  • Add new PlugPagServicePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-plug-pag-service'
    project(':react-native-plug-pag-service').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-plug-pag-service/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-plug-pag-service')
  3. AndroidManifest.xml
  • Permissions To integrate the library with the PlugPagService library in Android applications you must add the following permission to AndroidManifest.xml.

    <uses-permission android:name="br.com.uol.pagseguro.permission.MANAGE_PAYMENTS"/>

    This permission allows the library to bind to PlugPagService , Moderninha Smart's embedded service , which manages all payment transactions.

  • Intent-filter In order for your app to be chosen as the default payment app and receive Card Insertion Intents, you need to add the following code to your AndroidManifest.xml within your main Activity.

    <intent-filter>
          <action android:name="br.com.uol.pagseguro.PAYMENT"/>
          <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>

Usage

import PlugPagService, { PlugPag, PlugPagPaymentData, PlugPagActivationData } from 'rn-pagseguro-plugin';

Functions

ParameterDescription
A_VISTA_INSTALLMENT_QUANTITYDefault installment quantity for cash sales.
AUTHENTICATION_FAILEDCode used when PlugPagService is not enabled.
BUFFER_SIZE_ERRORCode used to indicate transaction message generation failure due to buffer size.
COMMUNICATION_ERRORCode used for communication errors.
DISABLED_FUNCTIONCode used to indicate that a given functionality is not available for the terminal.
ERROR_CODE_OKCode used for successful transaction.
INSTALLMENT_TYPE_A_VISTAInstallment type: Cash.
INSTALLMENT_TYPE_PARC_COMPRADORInstallment type: Buyer installment.
INSTALLMENT_TYPE_PARC_VENDEDORInstallment type: Seller installment.
INVALID_AMOUNT_FORMATCode used to indicate that the transaction amount is invalid, possibly due to a typing or formatting error.
INVALID_BUFFER_DATACode used to indicate that the response buffer is invalid and needs to be reestablished.
INVALID_LENGTH_USER_REFERENCECode used to indicate that the sale code exceeds the size limit (10 characters).
MIN_PRINTER_STEPSMinimum number of lines printed after the printing process finishes.
MODE_PARTIAL_PAYCode used for partial payment.
NFC_RET_ERRORCode used to indicate NFC operation failure.
NFC_RET_OKCode used to indicate success in NFC operations.
NO_PRINTER_DEVICECode used when no printer is available on the device.
NO_TRANSACTION_DATACode used for transaction without data.
NULL_AMOUNTCode used to indicate that the transaction amount is null.
NULL_APPLICATION_PARAMETERCode used to indicate that the application parameter is null.
NULL_TOTAL_AMOUNTCode used to indicate that the total transaction amount is null.
NULL_TRANSACTION_RESULTCode used to indicate that the transaction result value is null.
NULL_USER_REFERENCECode used to indicate that the sale code is null.
OPERATION_ABORTEDCode used as a return for a canceled transaction.
PLUGPAG_ASYNC_CONFIRMATIONRemote configuration constant for asynchronous confirmation.
PLUGPAG_ASYNC_METRICSRemote configuration constant for sending metrics.
PLUGPAG_CDCVMRemote configuration constant for CDCVM.
PLUGPAG_CRASHLOG_SENDINGRemote configuration constant for sending crash logs.
PLUGPAG_PRE_PRINTINGRemote configuration constant for pre-printing.
POS_NOT_READYCode used to indicate that the terminal is not ready for transaction.
RET_OKCode used to indicate success in operations.
SHARE_MODE_NOT_ALLOWEDCode used to indicate that Bluetooth transaction is not allowed in shared mode.
TRANSACTION_DENIEDCode used to indicate unsuccessful transaction.
TYPE_CREDITOPayment type: Credit.
TYPE_DEBITOPayment type: Debit.
TYPE_PIXPayment type: Pix QR Code.
TYPE_PREAUTO_CARDPayment type: Pre-authorization via card.
TYPE_PREAUTO_KEYEDPayment type: Pre-authorization via manual entry.
TYPE_QRCODEPayment type: Debit QR Code.
TYPE_QRCODE_CREDITOPayment type: Credit QR Code.
TYPE_VOUCHERPayment type: Voucher (meal voucher).
VOID_PAYMENTCode used for payment reversal.
VOID_QRCODECode used for QR Code reversal.