RMabroukS / react-native-hyperpay-sdk

MIT License
4 stars 2 forks source link

TypeError: undefined is not an object (evaluating '_NativeModules.HyperPaySDK') #2

Open Bilalwarind opened 1 year ago

Bilalwarind commented 1 year ago

HI @RMabroukS thanks for the library. When try to import in android "import HyperPay from 'react-native-hyperpay-sdk';" i am getting error Error: Requiring module "node_modules/react-native-hyperpay-sdk/src/index.tsx", which threw an exception: TypeError: undefined is not an object (evaluating '_NativeModules.HyperPaySDK')

SulimanF96 commented 1 year ago

Same, I am using expo by the way is it compatible with it ? if no is it possible ?

Bilalwarind commented 1 year ago

I guess the issue is due to old sdk version is used I removed the library and using hyperpay using bridging with native sides and it's working for me

On Sun, Jan 8, 2023, 1:19 PM Suliman Alfowzan @.***> wrote:

Same, I am using expo by the way is it compatible with it ? if no is it possible ?

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1374754866, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L7IT6TFPGPRMG3L5CLWRJZ7XANCNFSM6AAAAAATN6FIZM . You are receiving this because you authored the thread.Message ID: @.***>

SulimanF96 commented 1 year ago

Are you using expo ? And does you solution work with it ?

Bilalwarind commented 1 year ago

No i am using CLI and yes working on native modules and bridging it in React Native worked for me

On Sun, Jan 8, 2023, 8:23 PM Suliman Alfowzan @.***> wrote:

Are you using expo ? And does you solution work wit it ?

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1374861147, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L7TSP57INE54VLLUDDWRLLVRANCNFSM6AAAAAATN6FIZM . You are receiving this because you authored the thread.Message ID: @.***>

SulimanF96 commented 1 year ago

I am trying to implement it with expo and did not find any way yet for that. I cannot go the react native cli way just for hyperpay and sacrifice the easy DX of expo

RMabroukS commented 1 year ago

HI @RMabroukS thanks for the library. When try to import in android "import HyperPay from 'react-native-hyperpay-sdk';" i am getting error Error: Requiring module "node_modules/react-native-hyperpay-sdk/src/index.tsx", which threw an exception: TypeError: undefined is not an object (evaluating '_NativeModules.HyperPaySDK')

@Bilalwarind What is the react native version & react-native-hyperpay-sdk version ? And this problem on android or ios ? and your project using typescript or javascript template ?

RMabroukS commented 1 year ago

@SulimanF96 This library working only with react-native cli, you can eject your project to use it

Bilalwarind commented 1 year ago

hi @RMabroukS/react-native-hyperpay-sdk @.***> i am using react-native-hyperpay-sdk version version 0.30.0 and reactnative version i tried on 0.70 and 0.66 and on both it returns the error and i have tested only for android .

On Sun, 8 Jan 2023 at 23:19, Ragab Mabrouk @.***> wrote:

@SulimanF96 https://github.com/SulimanF96 This library working only with react-native cli, you can eject your project to use it

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1374896269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L3ZTLK6DWSRQQ4CFHLWRMALBANCNFSM6AAAAAATN6FIZM . You are receiving this because you were mentioned.Message ID: @.***>

Bilalwarind commented 1 year ago

@RMabroukS/react-native-hyperpay-sdk @.***> i get this error when i import the sdk even did not started implementation .

On Mon, 9 Jan 2023 at 07:37, Bilal Warind @.***> wrote:

hi @RMabroukS/react-native-hyperpay-sdk @.***> i am using react-native-hyperpay-sdk version version 0.30.0 and reactnative version i tried on 0.70 and 0.66 and on both it returns the error and i have tested only for android .

On Sun, 8 Jan 2023 at 23:19, Ragab Mabrouk @.***> wrote:

@SulimanF96 https://github.com/SulimanF96 This library working only with react-native cli, you can eject your project to use it

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1374896269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L3ZTLK6DWSRQQ4CFHLWRMALBANCNFSM6AAAAAATN6FIZM . You are receiving this because you were mentioned.Message ID: @.***>

stargamerboy786 commented 1 year ago

hi @RMabroukS i am using @RMabroukS/react-native-hyperpay-sdk version 0.33.0 for my project in which "react-native": "0.61.3" and i am getting the same error, did you find any solutions

RMabroukS commented 1 year ago

hi @RMabroukS i am using @RMabroukS/react-native-hyperpay-sdk version 0.33.0 for my project in which "react-native": "0.61.3" and i am getting the same error, did you find any solutions

Hello @stargamerboy786 Can you update to react-native-hyperpay-sdk@0.34.0 and try again, if you getting the same error, please share with me more details for your environment

stargamerboy786 commented 1 year ago

@RMabroukS this is my system info and System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 94.31 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.9.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.1 - /opt/homebrew/bin/npm Watchman: 2022.09.05.00 - /opt/homebrew/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.2/14C18 - /usr/bin/xcodebuild npmPackages: react-native: file:./packages/blocks/core/node_modules/react-native => 0.61.3 npmGlobalPackages: react-native-cli: 2.0.1.
current react-native-hyperpay-sdk@0.34.0 screeenshot of error comming in adb log

Screenshot 2023-01-27 at 3 25 15 PM
RMabroukS commented 1 year ago

Thanks @stargamerboy786, this error occurs on Android only or android & ios ?

stargamerboy786 commented 1 year ago

Thanks @stargamerboy786, this error occurs on Android only or android & ios ?

this happens on both Android and ios

RMabroukS commented 1 year ago

@stargamerboy786 I've tried on more than one react native version and this problem doesn't occur with me at all, if is possible to send me demo app that have the problem until I catch the problem and solve it, I'd be thankful.

stargamerboy786 commented 1 year ago

@stargamerboy786 I've tried on more than one react native version and this problem doesn't occur with me at all, if is possible to send me demo app that have the problem until I catch the problem and solve it, I'd be thankful.

import {
    StyleSheet,
    View,
    SafeAreaView,
    TouchableOpacity,
    ScrollView,
    Dimensions,
} from "react-native";

import PaymentMethodController, { Props } from "./PaymentMethodController";
import { CreditCardInput } from "react-native-credit-card-input-plus";
import Scale, { verticalScale } from "components/src/Scale";
import HyperPay from 'react-native-hyperpay-sdk';

export default class AddingPaymentDetails extends PaymentMethodController {
    constructor(props: Props) {
        super(props);

    }
    _onChange = () => form => console.log(form);
    values = () =>{
        console.log("card details found ");
        this.payment()

        // this.props.navigation.navigate("PlanDetailsSuccessfully" ,{ endDate: this.state.endDate, upgradeStatus: this.state.upgradeStatus })

    }
    payment = async() => {
        HyperPay.init({
            shopperResultURL:"shopperResultURL",
            countryCode:"IN",
            // merchantIdentifier:"merchantIdentifier",
            mode:"TestMode"
            })

            const result=await HyperPay.createPaymentTransaction(
                { paymentBrand: "VISA",
                  holderName: "Test Test",
                  cardNumber: '4111111111111111',
                  expiryYear: '2027',
                  expiryMonth: '12',
                  cvv: '123',
                  checkoutID: `E0B5C712EBF1FFD33F69B98690AC4963.uat01-vm-tx02`,
                  shopperResultURL: "[YOUR_APP_IDENTIFIER]://[URL_SCHEMES]" 
                  })
                  const resultpayment=HyperPay.getPaymentStatus("000.000.000")
                  console.log("result",result);
                  console.log("result payment ",resultpayment);

    }

    render() {
        return (
            <>
                {/* <StatusBar backgroundColor="white" barStyle="dark-content" /> */}
                <SafeAreaView style={styles.rootContainer}>
                    <ScrollView>
                        <View style={styles.rootContainer}>
                        <CreditCardInput onChange={this._onChange} />
                        </View>
                    </ScrollView>
                    <TouchableOpacity
                      style={[
                        styles.startedView,
                        {
                          backgroundColor: this.state.selected1
                            ? "rgba(234, 67, 93, 1)"
                            : "rgba(122, 123, 127, 1)",
                        },
                      ]}
                      onPress={() => this.values()}
                    ></TouchableOpacity>
                </SafeAreaView>
            </>
        );
    }
}

const styles = StyleSheet.create({
    rootContainer: {
        backgroundColor: "white",
    },
    startedView: {
        marginTop: verticalScale(50),
        marginBottom: verticalScale(20),
        alignSelf: "center",
        height: Scale(45),
        width: Scale(145),
        backgroundColor: "rgba(33,35,47,255)",
        borderColor: "white",
        borderRadius: Scale(10),
        justifyContent: "center",
        borderWidth: 1,
        marginLeft:5
      },
});

its just a normal page

RMabroukS commented 1 year ago

Thanks @stargamerboy786, I mean fully react native app

enganasalsaadi commented 1 year ago

sme issue here, any solution @RMabroukS @stargamerboy786 ?

Bilalwarind commented 1 year ago

This issue is still not resolved I tried a few days ago on React Native cli

On Fri, Jun 9, 2023, 2:16 PM enganasalsaadi @.***> wrote:

sme issue here, any solution @RMabroukS https://github.com/RMabroukS @stargamerboy786 https://github.com/stargamerboy786 ?

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1584244839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L44A3PTEVTUDI4AW5TXKLSVHANCNFSM6AAAAAATN6FIZM . You are receiving this because you were mentioned.Message ID: @.***>

RMabroukS commented 1 year ago

@Bilalwarind @enganasalsaadi Can any one create a new repo with demo app included this issue and send me it, even i can fix it, because I can’t catch this issue

Bilalwarind commented 1 year ago

Ok, I will try today

On Fri, Jun 9, 2023, 4:56 PM Ragab Mabrouk @.***> wrote:

@Bilalwarind https://github.com/Bilalwarind @enganasalsaadi https://github.com/enganasalsaadi Can any one create a new repo with demo app included this issue and send me it, even i can fix it, because I can’t catch this issue

— Reply to this email directly, view it on GitHub https://github.com/RMabroukS/react-native-hyperpay-sdk/issues/2#issuecomment-1584459655, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQK7L5CLDD4L3SGAA7CD73XKMFN3ANCNFSM6AAAAAATN6FIZM . You are receiving this because you were mentioned.Message ID: @.***>

enganasalsaadi commented 1 year ago

@RMabroukS i catch the issue, is is from name module u r using HyperPaySDK but should be HyperPay,

i implemented native modules and i use NativeModule.HyperPay

RMabroukS commented 1 year ago

@enganasalsaadi No, because I have exported the module with HyperPaySDK name, if possible to share with me an example app included this issue. I'll be grateful to you