Coder Social home page Coder Social logo

kottidev / react-native-oppwa Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 12.0 12.53 MB

A well Tested feature rich Oppwa implementation for React Native, supporting both iOS & Android platforms

License: MIT License

Java 28.90% JavaScript 54.47% Objective-C 14.54% Ruby 2.09%

react-native-oppwa's Introduction

react-native-oppwa

A React Native library for Oppwa, the Open Payment Platform

NPM

Installation

1. Add Oppwa to your project

  • First, set up Oppwa in your app as instructed on Oppwa. This includes downloading the oppwa app and walking through the setup steps (downloading the SDK, adding it to your project and making some changes to your project).

2. Add react-native-oppwa

Automatically

react-native install react-native-oppwa, or with yarn: rnpm install react-native-oppwa

React Native / rnpm will automatically link all the necessary libraries for both iOS and Android.

If the installation goes off without a hitch, you can now skip to the Usage section

Manually

yarn add react-native-oppwa --save

  • Alternatively for Android, if you don't use Android studio you can skip the first step and instead follow the steps described in Android as well as the steps in Android without Android Studio.
Manually iOS support

Download the Open Payment Platform SDK and place the two frameworks in the ios directory. You may want to add this directory to your .gitignore as they take up a decent amount of space and will slow down Git.

You will also need to modify the Run Script Phase that you likely added to Build Phases so that it points to the correct location for the Oppwa framework. If you placed the framework directly under ios/Oppwa as specified above,t the contents of the script will then be:

Then do the following:

  • Open your project in Xcode
  • Run open node_modules/react-native-oppwa/ios
  • Drag RNOppwa.xcodeproj into your Libraries group
  • Select your main project in the navigator to bring up settings
  • Under Build Phases expand the Link Binary With Libraries header
  • Scroll down and click the + to add a library
  • Find and add libRNOppwa.a under the Workspace group
  • โŒ˜+B

Android

*Note: Android support requires React Native 0.16 or later

  • Edit android/settings.gradle to look like this (without the +):

    rootProject.name = 'MyApp'
    
    include ':app'
    
    + include ':react-native-oppwa'
    + project(':react-native-oppwa').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-oppwa/android')
  • Edit android/app/build.gradle (note: app folder) to look like this:

    apply plugin: 'com.android.application'
    
    android {
      ...
    }
    
    dependencies {    
      compile 'com.android.support:appcompat-v7:23.0.0'
      compile 'com.facebook.react:react-native:0.19.+'
    + compile project(':react-native-oppwa')
    }
  • Edit your MainActivity.java (deep in android/app/src/main/java/...) to look like this (note two places to edit):

package com.myapp;

+ import com.oppwa.OppwaPackage;

....
public class MainActivity extends ReactActivity {
  @Override
  protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
+         new OppwaPackage(),
          new MainReactPackage()
      );
  }
}

Make sure you also follow the steps described in Android.

  • Edit your AndroidManifest.xml (in android/app/src/main/) to look like this. Make sure to enter your oppwa API key after android:value=, you can find your key on your oppwa organisation page.

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        [...]
        <application
          [...]
    +       <service
    +      android:name="com.oppwa.mobile.connect.service.ConnectService"
    +    android:exported="false"/>
        </application>
    +   <uses-permission android:name="android.permission.INTERNET" />
    </manifest>

Usage

Note: .

License

MIT Mohamed Anouar KOTTI ยฉ 2017

react-native-oppwa's People

Contributors

kottidev avatar tukaemad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-oppwa's Issues

Get resourcePath from transaction

Hi, I have some trouble in getting resourcePath from transaction in Android. It seem to be result from promise transactionPayment just like this {"OS": "android"}. Can you give me some clue?

example usage in react-native

Hi,

I am getting hard times trying to make it to work in react native.

is there any example implementation or snippet?

Anything would be really helpful.

A problem occurred evaluating project ':react-native-oppwa'.

  • Where:
    Build file '\node_modules\react-native-oppwa\android\build.gradle' line: 35

  • What went wrong:
    A problem occurred evaluating project ':react-native-oppwa'.

Project with path ':oppwa.mobile-2.30.0' could not be found in project ':react-native-oppwa'.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.