npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tusitupi-sdk

v0.5.3

Published

React Native Bridge to 2c2p SDK

Downloads

2

Readme

tusitupi-sdk

A minimal react-native bridge to 2c2p sdk.

Installation

$ npm install tusitupi-sdk --save

or

$ yarn add tusitupi-sdk

Automatic Linking

$ react-native link tusitupi-sdk

Manual Linking

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulestusitupi-sdk and add RNMy2c2pSdk.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNMy2c2pSdk.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.wednesdaynight.rn2c2p.RNMy2c2pSdkPackage; to the imports at the top of the file
  • Add new RNMy2c2pSdkPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':tusitupi-sdk'
    project(':tusitupi-sdk').projectDir = new File(rootProject.projectDir, 	'../node_modules/tusitupi-sdk/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':tusitupi-sdk')

Setup My2c2pSDK

Follow instruction on 2c2p (android, iOS) to generate private keys.

iOS

Install via cocoa pods: Add pod 'my2c2pSDK' to the ios/Podfile and run pod install.

Android

  1. Download My2c2pSDK library from https://s.2c2p.com/manuals/android/download/my2c2psdk.html. Convert library to gradle module (See example) and put into directory: your-react-native-project/android/app/my2c2psdk.

  2. Append the following lines to android/settings.gradle:

    include ':my2c2psdk'
    project(':my2c2psdk').projectDir = new File(rootProject.projectDir, './app/my2c2psdk')
  3. Insert the following lines inside the dependencies block in android/app/build.gradle:

    compile project(':my2c2psdk')
  4. Add activity to app AndroidManifest.xml

    <activity android:name="com.ccpp.my2c2psdk.cores.My3DSActivity"
            android:theme="@style/My2c2pSDK.Theme"
            android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
    
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- For 123 payment : eNETS (Direct Debit/Web Payment) Only -->
            <!-- For demo server -->
            <data
                android:scheme="my2c2pjt"
                android:host="123" />
            <!-- For demo server -->
            <data
                android:scheme="my2c2pjt01"
                android:host="123" />
            <!-- For prod server -->
            <data
                android:scheme="my2c2p1001"
                android:host="123" />
            <!-- End -->
        </intent-filter>
    </activity>
    <activity android:name="com.ccpp.my2c2psdk.cores.OTPActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar"/>

Usage

import React, { Component } from 'react';
import My2c2pSDK from 'tusitupi-sdk';
import { ScrollView, TouchableHighlight, Text, StyleSheet } from 'react-native';
...

const privateKey = 'YOUR PRIVATE KEY';
const merchantID = 'YOUR MERCHANT ID';
const secretKey = 'YOUR SECRET KEY';
const productionMode = false;

export default class PaymentScreen extends Component {
  componentDidMount() {
    My2c2pSDK.init(privateKey, productionMode);
  }

  handlePayment = async () => {
    try {
      const response = await My2c2pSDK.requestPayment({
        paymentUI: false,
        merchantID: merchantID,
        uniqueTransactionCode: '123456789',
        desc: 'Transaction description',
        amount: 19.0,
        currencyCode: '702',
        cardHolderName: 'John Doe',
        cardHolderEmail: '[email protected]',
        pan: '4111111111111111',
        cardExpireMonth: 2,
        cardExpireYear: 2019,
        securityCode: '123',
        panCountry: 'SG',
        secretKey: secretKey
      });
      console.log(response);
    } catch(error) {
      if (error.code === 'TRANSACTION_CANCELED') {
        // transaction is canceled from OTP
      }
      console.log(error);
    }
  }

  render() {
    return (
      <ScrollView>
        // Form ...
        <TouchableHighlight onPress={this.handlePayment}>
          <Text>Submit</Text>
        </TouchableHighlight>
      </ScrollView>
    );
  }

  ...
}

Credit card payment (Non-UI)

My2c2pSDK.requestPayment({
  paymentUI: false,
  merchantID: merchantID,
  uniqueTransactionCode: "123456789",
  desc: "Transaction description",
  amount: 19.0,
  currencyCode: "702",
  cardHolderName: "John Doe",
  cardHolderEmail: "[email protected]",
  pan: "4111111111111111",
  cardExpireMonth: 2,
  cardExpireYear: 2019,
  securityCode: "123",
  panCountry: "SG",
  secretKey: secretKey
});

Credit card payment (UI)

My2c2pSDK.requestPayment({
  paymentUI: true,
  merchantID: merchantID,
  uniqueTransactionCode: "123456789",
  desc: "Transaction description",
  amount: 19.0,
  currencyCode: "702",
  secretKey: secretKey
});

Check the full document for payment request and response

Example app:

https://github.com/oun/react-native-2c2p-example