Skip to content

nozdogan/react-native-masterpass-tr

 
 

Repository files navigation

React Native Masterpass TR

Masterpass Turkey Package for React Native

Installation

npm install @macellan/react-native-masterpass-tr --save

or

yarn add @macellan/react-native-masterpass-tr

Install Dependencies

Please, install dependencies for using this package.

yarn add react-native-webview react-native-event-listeners

Usage

Wrap your parent component in Provider from react-native-masterpass-tr.

import * as React from 'react';
import { MasterPassProvider, IConfig } from 'react-native-masterpass-tr';

const ParentComponent: React.FC = () => {

  /* MasterPass Config Object */
  const config: IConfig = {
    token: '',
    serviceUrl: '',
    clientId: '',
    userId: '',
    sendSmsLanguage: '',
    sendSms: '',
    referenceNo: '',
    clientIp: '',
  };

  return (
    <MasterPassProvider config={config}>
      <ChildComponent />
      {/* Other Child Components */}
    </MasterPassProvider>;
  );
}

export default ParentComponent;

Add MasterPassTurkey to the component you want to use.

import * as React from 'react';
import {
  MasterPassTurkey,
  IMasterPassTurkeyRefs,
} from 'react-native-masterpass-tr';

const ChildComponent: React.FC = () => {
  const masterpass = React.useRef<IMasterPassTurkeyRefs>(null);

  const onRegistrationCheck = React.useCallback(() => {
    masterpass.current
      ?.registrationCheck()
      .then((result) => {
        console.log(result);
      })
      .catch((error) => {
        console.log(error);
      });
  }, []);

  return <MasterPassTurkey ref={ref} />;
};

export default ChildComponent;

License

MIT

Credits

Made with ❤️ at Macellan by @nrzky

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 93.5%
  • Java 3.4%
  • Objective-C 1.8%
  • JavaScript 0.8%
  • Ruby 0.3%
  • Shell 0.1%
  • Other 0.1%