UNPKG

fiuu-react-native-expo

Version:

31 lines (26 loc) 1.06 kB
import { requireNativeModule } from 'expo-modules-core'; const { FiuuPayment } = requireNativeModule('FiuuPayment'); const FiuuPaymentModule = { /** * Calls the native setPaymentDetails method. * @param {Object} paymentDetails - The payment details object. * @param {Function} successCallback - Called with the result on success. * @param {Function} errorCallback - Called with an error message if an error occurs. */ setPaymentDetails(paymentDetails, successCallback, errorCallback) { if (!Beast) { console.error("Beast native module is not linked properly."); if (errorCallback) errorCallback("Native module not found"); return; } if (typeof paymentDetails !== "object") { console.error("Invalid payment details format. Expected an object."); if (errorCallback) errorCallback("Invalid payment details format"); return; } FiuuPayment.setPaymentDetails(paymentDetails, (result) => { if (successCallback) successCallback(result); }); } }; export default FiuuPaymentModule;