omnipay-reactnative-sdk 0.8.8 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,6 +26,8 @@ public class OmnipayActivityModule extends ReactContextBaseJavaModule {
26
26
  private static final String ACTIVITY_DOES_NOT_EXIST = "ACTIVITY_DOES_NOT_EXIST";
27
27
  private static final int ACTIVITY_REQUEST_CODE = 1;
28
28
  private String returnKey = "";
29
+ private final int RC_KEY_EXCHANGE = 52477;
30
+ private final int RC_PURCHASE = 135689;
29
31
 
30
32
  private Promise mPromise;
31
33
  private Promise iPromise;
@@ -53,62 +55,31 @@ public class OmnipayActivityModule extends ReactContextBaseJavaModule {
53
55
 
54
56
  private void sendEvent(ReactContext reactContext,
55
57
  String eventName,
56
- @Nullable WritableMap params) {
57
- reactContext
58
- .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
59
- .emit(eventName, params);
58
+ WritableMap params) {
59
+ reactContext
60
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
61
+ .emit(eventName, params);
60
62
  }
61
63
 
62
64
  private int listenerCount = 0;
63
65
 
64
66
  @ReactMethod
65
67
  public void addListener(String eventName) {
66
- if (listenerCount == 0) {
67
- // Set up any upstream listeners or background tasks as necessary
68
- }
68
+ if (listenerCount == 0) {
69
+ // Set up any upstream listeners or background tasks as necessary
70
+ }
69
71
 
70
- listenerCount += 1;
72
+ listenerCount += 1;
71
73
  }
72
74
 
73
75
  @ReactMethod
74
76
  public void removeListeners(Integer count) {
75
- listenerCount -= count;
76
- if (listenerCount == 0) {
77
- // Remove upstream listeners, stop unnecessary background tasks
78
- }
77
+ listenerCount -= count;
78
+ if (listenerCount == 0) {
79
+ // Remove upstream listeners, stop unnecessary background tasks
80
+ }
79
81
  }
80
-
81
- // @ReactMethod
82
- // public void startActivity(String key, Promise promise) {
83
- // Activity currentActivity = getCurrentActivity();
84
-
85
- // if (currentActivity == null) {
86
- // promise.reject(ACTIVITY_DOES_NOT_EXIST, "Activity doesn't exist");
87
- // return;
88
- // }
89
-
90
- // mPromise = promise;
91
-
92
- // try {
93
- // String intentAction = options.getString("action") == null ? Intent.ACTION_VIEW : options.getString("action");
94
- // Intent intent = new Intent(intentAction);
95
-
96
- // if (options.getString("uri") != null) {
97
- // intent.setData(Uri.parse(options.getString("uri")));
98
- // }
99
- // if (options.getMap("extra") != null) {
100
- // intent.putExtras(Arguments.toBundle(options.getMap("extra")));
101
- // }
102
-
103
- // returnKey = key;
104
-
105
- // currentActivity.startActivityForResult(intent, ACTIVITY_REQUEST_CODE);
106
-
107
- // } catch (Exception e) {
108
- // mPromise.reject(ERROR, e);
109
- // mPromise = null;
110
- // }
111
- // }
82
+
112
83
 
113
84
  @ReactMethod
114
85
  public void isPackageInstalled(String packageName, Promise promise) {
@@ -149,8 +120,13 @@ public class OmnipayActivityModule extends ReactContextBaseJavaModule {
149
120
 
150
121
  fmIntent.putExtra("requestData", purchase);
151
122
 
152
-
153
- currentActivity.startActivityForResult(fmIntent, 1);
123
+ if(tranType == "PURCHASE") {
124
+ currentActivity.startActivityForResult(fmIntent, RC_PURCHASE);
125
+ }
126
+ else {
127
+ currentActivity.startActivityForResult(fmIntent, RC_KEY_EXCHANGE);
128
+ }
129
+
154
130
  } catch (Exception ex) {
155
131
  ex.printStackTrace();
156
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnipay-reactnative-sdk",
3
- "version": "0.8.8",
3
+ "version": "0.9.0",
4
4
  "description": "Omnipay react native sdk",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",