UNPKG

qm-mposkit

Version:

qmpos payment

35 lines (31 loc) 1.41 kB
import { Platform, NativeModules, DeviceEventEmitter, NativeEventEmitter } from "react-native"; const LklPayment = NativeModules.LklPayment; var subscription = null; export default { create: () => { if (LklPayment) LklPayment.create(); }, destroy: () => { if (LklPayment) LklPayment.destroy(); if (null == subscription) { return; } if ('android' === Platform.OS) { DeviceEventEmitter.removeSubscription(subscription); } }, startPay: (money,tid,time) => { if (LklPayment) LklPayment.startActivityForResult(money,tid,time); }, //格式请参考BalanceRechargeBill对象,参数为string类型 listen: (_code) => { if (typeof _code != "function") return; subscription = DeviceEventEmitter.addListener("LKL_RESULT_CODE", _code)}, printEmptyLine:()=>{LklPayment.printEmptyLine()}, printShopName:(shopName)=>{LklPayment.printShopName(shopName)}, printLineWrap:(text)=>{LklPayment.printLineWrap(text,true)}, printDashLine:()=>{LklPayment.printDashLine()}, printColumnName:()=>{LklPayment.printColumnName()}, printColumnData:(goodsName,price,count,total)=>{LklPayment.printColumnData(goodsName,price,count,total)}, printHalfColumnData:(paramLeft,paramRight) => {LklPayment.printHalfColumnData(paramLeft,paramRight)}, printLineBottom:(text) => {LklPayment.printLineBottom(text)}, printReceipt:() => {LklPayment.printReceipt()} };