@cashfreepayments/react-native-cashfree-cn-sdk 1.0.0-dev.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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +79 -0
  3. package/android/.gradle/7.2/dependencies-accessors/dependencies-accessors.lock +0 -0
  4. package/android/.gradle/7.2/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/7.2/executionHistory/executionHistory.lock +0 -0
  6. package/android/.gradle/7.2/fileChanges/last-build.bin +0 -0
  7. package/android/.gradle/7.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/7.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/7.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/7.2/gc.properties +0 -0
  11. package/android/.gradle/7.5/checksums/checksums.lock +0 -0
  12. package/android/.gradle/7.5/checksums/md5-checksums.bin +0 -0
  13. package/android/.gradle/7.5/checksums/sha1-checksums.bin +0 -0
  14. package/android/.gradle/7.5/dependencies-accessors/dependencies-accessors.lock +0 -0
  15. package/android/.gradle/7.5/dependencies-accessors/gc.properties +0 -0
  16. package/android/.gradle/7.5/executionHistory/executionHistory.lock +0 -0
  17. package/android/.gradle/7.5/fileChanges/last-build.bin +0 -0
  18. package/android/.gradle/7.5/fileHashes/fileHashes.bin +0 -0
  19. package/android/.gradle/7.5/fileHashes/fileHashes.lock +0 -0
  20. package/android/.gradle/7.5/fileHashes/resourceHashesCache.bin +0 -0
  21. package/android/.gradle/7.5/gc.properties +0 -0
  22. package/android/.gradle/8.5/checksums/checksums.lock +0 -0
  23. package/android/.gradle/8.5/checksums/md5-checksums.bin +0 -0
  24. package/android/.gradle/8.5/checksums/sha1-checksums.bin +0 -0
  25. package/android/.gradle/8.5/dependencies-accessors/dependencies-accessors.lock +0 -0
  26. package/android/.gradle/8.5/dependencies-accessors/gc.properties +0 -0
  27. package/android/.gradle/8.5/fileChanges/last-build.bin +0 -0
  28. package/android/.gradle/8.5/fileHashes/fileHashes.lock +0 -0
  29. package/android/.gradle/8.5/gc.properties +0 -0
  30. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  31. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  32. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  33. package/android/.gradle/checksums/checksums.lock +0 -0
  34. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  35. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  36. package/android/.gradle/config.properties +2 -0
  37. package/android/.gradle/nb-cache/trust/5D9F4D2F872AE83553369BAEF9EF62F30CBE0A19F76FE265082C658DB033E1DA +1 -0
  38. package/android/.gradle/nb-cache/trust/811DB8418F399FDF2AFA5CB6893343C7013E03D6360FA7A8FBFC8B0C8A38EE77 +1 -0
  39. package/android/.gradle/vcs-1/gc.properties +0 -0
  40. package/android/.idea/compiler.xml +6 -0
  41. package/android/.idea/gradle.xml +18 -0
  42. package/android/.idea/migrations.xml +10 -0
  43. package/android/.idea/misc.xml +9 -0
  44. package/android/.idea/other.xml +549 -0
  45. package/android/.idea/vcs.xml +6 -0
  46. package/android/build.gradle +77 -0
  47. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  48. package/android/local.properties +8 -0
  49. package/android/src/main/AndroidManifest.xml +4 -0
  50. package/android/src/main/java/com/reactnativecashfreecnsdk/CashfreePgApiModule.java +319 -0
  51. package/android/src/main/java/com/reactnativecashfreecnsdk/CashfreePgApiPackage.java +28 -0
  52. package/ios/CashfreeEmitter.swift +36 -0
  53. package/ios/CashfreeEventEmitter.m +16 -0
  54. package/ios/CashfreeEventEmitter.swift +28 -0
  55. package/ios/CashfreePgApi-Bridging-Header.h +5 -0
  56. package/ios/CashfreePgApi.m +21 -0
  57. package/ios/CashfreePgApi.swift +410 -0
  58. package/ios/CashfreePgApi.xcodeproj/project.pbxproj +293 -0
  59. package/ios/CashfreePgApi.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  60. package/ios/CashfreePgApi.xcodeproj/project.xcworkspace/xcuserdata/nikhil.kushwah.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  61. package/ios/CashfreePgApi.xcodeproj/xcuserdata/nikhil.kushwah.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
  62. package/lib/commonjs/Card/CFCardComponent.js +287 -0
  63. package/lib/commonjs/Card/CFCardComponent.js.map +1 -0
  64. package/lib/commonjs/Card/index.js +14 -0
  65. package/lib/commonjs/Card/index.js.map +1 -0
  66. package/lib/commonjs/index.js +168 -0
  67. package/lib/commonjs/index.js.map +1 -0
  68. package/lib/module/Card/CFCardComponent.js +279 -0
  69. package/lib/module/Card/CFCardComponent.js.map +1 -0
  70. package/lib/module/Card/index.js +2 -0
  71. package/lib/module/Card/index.js.map +1 -0
  72. package/lib/module/index.js +159 -0
  73. package/lib/module/index.js.map +1 -0
  74. package/lib/typescript/src/Card/CFCardComponent.d.ts +12 -0
  75. package/lib/typescript/src/Card/index.d.ts +1 -0
  76. package/lib/typescript/src/index.d.ts +43 -0
  77. package/package.json +157 -0
  78. package/react-native-cashfree-cn-sdk.podspec +20 -0
  79. package/src/Card/CFCardComponent.js +238 -0
  80. package/src/Card/CFCardComponent.tsx +323 -0
  81. package/src/Card/index.js +1 -0
  82. package/src/Card/index.ts +1 -0
  83. package/src/index.js +167 -0
  84. package/src/index.ts +219 -0
@@ -0,0 +1,4 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.reactnativecashfreecnsdk">
3
+
4
+ </manifest>
@@ -0,0 +1,319 @@
1
+ package com.reactnativecashfreecnsdk;
2
+
3
+ import android.app.Activity;
4
+ import android.content.Intent;
5
+ import android.content.pm.PackageManager;
6
+ import android.content.pm.ResolveInfo;
7
+ import android.net.Uri;
8
+ import android.util.Log;
9
+
10
+ import androidx.annotation.NonNull;
11
+ import androidx.annotation.Nullable;
12
+
13
+ import com.cashfree.pg.api.CFPaymentGatewayService;
14
+ import com.cashfree.pg.cf_analytics.CFAnalyticsService;
15
+ import com.cashfree.pg.cf_analytics.CFEventsSubscriber;
16
+ import com.cashfree.pg.core.api.CFCorePaymentGatewayService;
17
+ import com.cashfree.pg.core.api.CFSession;
18
+ import com.cashfree.pg.core.api.base.CFPayment;
19
+ import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
20
+ import com.cashfree.pg.core.api.card.CFCard;
21
+ import com.cashfree.pg.core.api.card.CFCardPayment;
22
+ import com.cashfree.pg.core.api.exception.CFException;
23
+ import com.cashfree.pg.core.api.exception.CFInvalidArgumentException;
24
+ import com.cashfree.pg.core.api.persistence.CFPersistence;
25
+ import com.cashfree.pg.core.api.upi.CFUPI;
26
+ import com.cashfree.pg.core.api.upi.CFUPIPayment;
27
+ import com.cashfree.pg.core.api.utils.CFErrorResponse;
28
+ import com.cashfree.pg.core.api.webcheckout.CFWebCheckoutPayment;
29
+ import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
30
+ import com.cashfree.pg.ui.api.upi.intent.CFUPIIntentCheckoutPayment;
31
+ import com.facebook.react.bridge.Callback;
32
+ import com.facebook.react.bridge.ReactApplicationContext;
33
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
34
+ import com.facebook.react.bridge.ReactMethod;
35
+ import com.facebook.react.module.annotations.ReactModule;
36
+ import com.facebook.react.modules.core.RCTNativeAppEventEmitter;
37
+ import com.cashfree.pg.api.util.DropPaymentParser;
38
+
39
+ import org.json.JSONArray;
40
+ import org.json.JSONException;
41
+ import org.json.JSONObject;
42
+
43
+ import java.util.List;
44
+ import java.util.Map;
45
+
46
+ @ReactModule(name = CashfreePgApiModule.NAME)
47
+ public class CashfreePgApiModule extends ReactContextBaseJavaModule implements CFCheckoutResponseCallback, CFEventsSubscriber {
48
+ public static final String NAME = "CashfreePgApi";
49
+
50
+ public CashfreePgApiModule(ReactApplicationContext reactContext) {
51
+ super(reactContext);
52
+ }
53
+
54
+ @Override
55
+ @NonNull
56
+ public String getName() {
57
+ return NAME;
58
+ }
59
+
60
+ @ReactMethod
61
+ public void doPayment(String cfPaymentString,String baseUrl) {
62
+ Log.d("CashfreePgApiModule", cfPaymentString);
63
+ try {
64
+ Activity activity = getCurrentActivity();
65
+ CFPersistence.getInstance().storeBaseUrl(baseUrl);
66
+ CFDropCheckoutPayment cfDropCheckoutPayment = DropPaymentParser.getDropCheckoutPayment(cfPaymentString);
67
+ cfDropCheckoutPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
68
+ cfDropCheckoutPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.DROP);
69
+ if (activity != null) {
70
+ CFPaymentGatewayService.getInstance().doPayment(activity, cfDropCheckoutPayment);
71
+ } else {
72
+ throw new IllegalStateException("activity is null");
73
+ }
74
+ } catch (Exception e) {
75
+ e.printStackTrace();
76
+ }
77
+ }
78
+
79
+ @ReactMethod
80
+ public void doUPIPayment(String cfPaymentString,String baseUrl) {
81
+ Log.d("CashfreePgApiModule", cfPaymentString);
82
+ try {
83
+ Activity activity = getCurrentActivity();
84
+ CFPersistence.getInstance().storeBaseUrl(baseUrl);
85
+
86
+ CFUPIIntentCheckoutPayment cfupiIntentCheckoutPayment = DropPaymentParser.getUPICheckoutPayment(cfPaymentString);
87
+ cfupiIntentCheckoutPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
88
+ cfupiIntentCheckoutPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.INTENT);
89
+ if (activity != null) {
90
+ CFPaymentGatewayService.getInstance().doPayment(activity, cfupiIntentCheckoutPayment);
91
+ } else {
92
+ throw new IllegalStateException("activity is null");
93
+ }
94
+ } catch (Exception e) {
95
+ e.printStackTrace();
96
+ }
97
+ }
98
+
99
+ @ReactMethod
100
+ public void doWebPayment(String sessionString,String baseUrl) {
101
+ Log.d("CashfreePgApiModule Web", sessionString);
102
+ CFSession cfSession = null;
103
+ try {
104
+ JSONObject jsonObject = new JSONObject(sessionString);
105
+ CFPersistence.getInstance().storeBaseUrl(baseUrl);
106
+ cfSession = new CFSession.CFSessionBuilder()
107
+ .setEnvironment(CFSession.Environment.valueOf(jsonObject.getString("environment")))
108
+ .setOrderId(jsonObject.getString("orderID"))
109
+ .setBaseUrl(baseUrl)
110
+ .setPaymentSessionID(jsonObject.getString("payment_session_id"))
111
+ .build();
112
+ } catch (Exception exception) {
113
+ throw new IllegalStateException("Session is invalid");
114
+ }
115
+ try {
116
+ Activity activity = getCurrentActivity();
117
+ CFWebCheckoutPayment cfWebCheckoutPayment = new CFWebCheckoutPayment.CFWebCheckoutPaymentBuilder()
118
+ .setSession(cfSession)
119
+ .build();
120
+ cfWebCheckoutPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
121
+ cfWebCheckoutPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.WEB_CHECKOUT);
122
+ if (activity != null) {
123
+ CFPaymentGatewayService.getInstance().doPayment(activity, cfWebCheckoutPayment);
124
+ } else {
125
+ throw new IllegalStateException("activity is null");
126
+ }
127
+ } catch (Exception e) {
128
+ e.printStackTrace();
129
+ }
130
+ }
131
+
132
+ @ReactMethod
133
+ public void doCardPayment(String data,String baseUrl) {
134
+ CFSession cfSession = null;
135
+ CFCard card = null;
136
+ boolean saveCard;
137
+ try {
138
+ JSONObject jsonObject = new JSONObject(data);
139
+ JSONObject session = jsonObject.getJSONObject("session");
140
+ JSONObject cardObject = jsonObject.getJSONObject("card");
141
+ saveCard = cardObject.optBoolean("saveCard", false);
142
+ CFPersistence.getInstance().storeBaseUrl(baseUrl);
143
+ cfSession = new CFSession.CFSessionBuilder()
144
+ .setEnvironment(CFSession.Environment.valueOf(session.getString("environment")))
145
+ .setBaseUrl(baseUrl)
146
+ .setOrderId(session.getString("orderID"))
147
+ .setPaymentSessionID(session.getString("payment_session_id"))
148
+ .build();
149
+ if (cardObject.has("instrumentId")) {
150
+ card = new CFCard.CFCardBuilder()
151
+ .setInstrumentId(cardObject.getString("instrumentId"))
152
+ .setCVV(cardObject.getString("cardCvv"))
153
+ .build();
154
+ } else {
155
+ card = new CFCard.CFCardBuilder()
156
+ .setCardNumber(cardObject.getString("cardNumber"))
157
+ .setCardHolderName(cardObject.getString("cardHolderName"))
158
+ .setCardExpiryMonth(cardObject.getString("cardExpiryMM"))
159
+ .setCardExpiryYear(cardObject.getString("cardExpiryYY"))
160
+ .setCVV(cardObject.getString("cardCvv"))
161
+ .setChannel("post")
162
+ .build();
163
+ }
164
+ } catch (Exception exception) {
165
+ throw new IllegalStateException(exception.getMessage());
166
+ }
167
+ try {
168
+ Activity activity = getCurrentActivity();
169
+ CFCardPayment cardPayment = new CFCardPayment.CFCardPaymentBuilder()
170
+ .setSession(cfSession)
171
+ .setCard(card)
172
+ .setSaveCardDetail(saveCard)
173
+ .build();
174
+ cardPayment.setCfSDKFlow(CFPayment.CFSDKFlow.WITH_CASHFREE_FULLSCREEN_LOADER);
175
+ cardPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
176
+ cardPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.ELEMENT);
177
+ if (activity != null) {
178
+ CFPaymentGatewayService.getInstance().doPayment(activity, cardPayment);
179
+ } else {
180
+ throw new IllegalStateException("activity is null");
181
+ }
182
+ } catch (Exception e) {
183
+ e.printStackTrace();
184
+ }
185
+ }
186
+
187
+ @ReactMethod
188
+ public void getInstalledUpiApps(Callback cb){
189
+ Activity activity = getCurrentActivity();
190
+ final Intent intent = new Intent();
191
+ intent.setAction(Intent.ACTION_VIEW);
192
+ intent.setData(Uri.parse("upi://pay"));
193
+ PackageManager pm = activity.getPackageManager();
194
+ final List<ResolveInfo> resInfo = pm.queryIntentActivities(intent, 0);
195
+ JSONArray packageNames = new JSONArray();
196
+ try {
197
+ for (ResolveInfo info : resInfo) {
198
+ JSONObject appInfo = new JSONObject();
199
+ String appName = (String)activity.getPackageManager().getApplicationLabel(info.activityInfo.applicationInfo);
200
+ appInfo.put("appName", appName);
201
+ appInfo.put("appPackage", info.activityInfo.packageName);
202
+ packageNames.put(appInfo);
203
+ }
204
+ } catch (Exception ex) {
205
+ ex.printStackTrace();
206
+ }
207
+ Log.d("CashfreePgApiModule", "getInstalledUpiApps::--" + packageNames);
208
+ cb.invoke(packageNames.toString());
209
+ }
210
+
211
+ @ReactMethod
212
+ public void doElementUPIPayment(String upiPaymentData,String baseUrl) {
213
+ Log.d("CashfreePgApiModule", upiPaymentData);
214
+ CFSession cfSession = null;
215
+ CFUPI cfupi = null;
216
+ try {
217
+ CFPersistence.getInstance().storeBaseUrl(baseUrl);
218
+ JSONObject jsonObject = new JSONObject(upiPaymentData);
219
+ JSONObject session = jsonObject.getJSONObject("session");
220
+ JSONObject upiObject = jsonObject.getJSONObject("upi");
221
+ cfSession = new CFSession.CFSessionBuilder()
222
+ .setEnvironment(CFSession.Environment.valueOf(session.getString("environment")))
223
+ .setOrderId(session.getString("orderID"))
224
+ .setBaseUrl(baseUrl)
225
+ .setPaymentSessionID(session.getString("payment_session_id"))
226
+ .build();
227
+ CFUPI.Mode mode = CFUPI.Mode.valueOf(upiObject.getString("mode"));
228
+ String upiId = upiObject.getString("id");
229
+ cfupi = new CFUPI.CFUPIBuilder()
230
+ .setMode(mode)
231
+ .setUPIID(upiId)
232
+ .build();
233
+ } catch (Exception exception) {
234
+ throw new IllegalStateException(exception.getMessage());
235
+ }
236
+ try {
237
+ CFUPIPayment cfupiPayment = new CFUPIPayment.CFUPIPaymentBuilder()
238
+ .setSession(cfSession)
239
+ .setCfUPI(cfupi)
240
+ .build();
241
+ cfupiPayment.setCfSDKFlow(CFPayment.CFSDKFlow.WITH_CASHFREE_FULLSCREEN_LOADER);
242
+ cfupiPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
243
+ cfupiPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.ELEMENT);
244
+ Activity activity = getCurrentActivity();
245
+ if (activity != null) {
246
+ CFCorePaymentGatewayService.getInstance().doPayment(activity, cfupiPayment);
247
+ } else {
248
+ throw new IllegalStateException("activity is null");
249
+ }
250
+ } catch (CFException exception) {
251
+ exception.printStackTrace();
252
+ }
253
+ }
254
+
255
+ @ReactMethod
256
+ public void setCallback() {
257
+ try {
258
+ CFPaymentGatewayService.getInstance().setCheckoutCallback(this);
259
+ } catch (CFException cfException) {
260
+ }
261
+ }
262
+
263
+ @ReactMethod
264
+ public void setEventSubscriber() {
265
+ try {
266
+ CFAnalyticsService.getInstance().setSubscriber(this);
267
+ } catch (Exception ignored) {
268
+ }
269
+ }
270
+
271
+ @ReactMethod
272
+ public void removeEventSubscriber() {
273
+ try {
274
+ CFAnalyticsService.getInstance().removeSubscriber();
275
+ } catch (Exception ignored) {
276
+ }
277
+ }
278
+
279
+ @Override
280
+ public void onPaymentVerify(String orderID) {
281
+ this.getReactApplicationContext()
282
+ .getJSModule(RCTNativeAppEventEmitter.class)
283
+ .emit("cfSuccess", orderID);
284
+ }
285
+
286
+ @Override
287
+ public void onPaymentFailure(CFErrorResponse cfErrorResponse, String orderID) {
288
+ JSONObject jsonObject = new JSONObject();
289
+ try {
290
+ jsonObject.put("error", cfErrorResponse.toJSON().toString());
291
+ jsonObject.put("orderID", orderID);
292
+ } catch (JSONException e) {
293
+ e.printStackTrace();
294
+ }
295
+ this.getReactApplicationContext()
296
+ .getJSModule(RCTNativeAppEventEmitter.class)
297
+ .emit("cfFailure", jsonObject.toString());
298
+ }
299
+
300
+ @Override
301
+ public void receivedEvent(String s, @Nullable Map<String, String> map) {
302
+ JSONObject jsonObject = new JSONObject();
303
+ JSONObject jsonMeta = new JSONObject();
304
+ try {
305
+ if (map != null) {
306
+ for (String key : map.keySet()) {
307
+ jsonMeta.put(key, map.get(key));
308
+ }
309
+ }
310
+ jsonObject.put("eventName", s);
311
+ jsonObject.put("meta", jsonMeta);
312
+ } catch (JSONException e) {
313
+ e.printStackTrace();
314
+ }
315
+ this.getReactApplicationContext()
316
+ .getJSModule(RCTNativeAppEventEmitter.class)
317
+ .emit("cfEvent", jsonObject.toString());
318
+ }
319
+ }
@@ -0,0 +1,28 @@
1
+ package com.reactnativecashfreecnsdk;
2
+
3
+ import androidx.annotation.NonNull;
4
+
5
+ import com.facebook.react.ReactPackage;
6
+ import com.facebook.react.bridge.NativeModule;
7
+ import com.facebook.react.bridge.ReactApplicationContext;
8
+ import com.facebook.react.uimanager.ViewManager;
9
+
10
+ import java.util.ArrayList;
11
+ import java.util.Collections;
12
+ import java.util.List;
13
+
14
+ public class CashfreePgApiPackage implements ReactPackage {
15
+ @NonNull
16
+ @Override
17
+ public List<NativeModule> createNativeModules(@NonNull ReactApplicationContext reactContext) {
18
+ List<NativeModule> modules = new ArrayList<>();
19
+ modules.add(new CashfreePgApiModule(reactContext));
20
+ return modules;
21
+ }
22
+
23
+ @NonNull
24
+ @Override
25
+ public List<ViewManager> createViewManagers(@NonNull ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
@@ -0,0 +1,36 @@
1
+ //
2
+ // CashfreeEmitter.swift
3
+ // react-native-cashfree-pg-api
4
+ //
5
+ // Created by Aabhas Jindal on 14/06/22.
6
+ //
7
+
8
+ class CashfreeEmitter {
9
+
10
+ /// Shared Instance.
11
+ public static var sharedInstance = CashfreeEmitter()
12
+
13
+ // ReactNativeEventEmitter is instantiated by React Native with the bridge.
14
+ private var eventEmitter: CashfreeEventEmitter!
15
+
16
+ private init() {}
17
+
18
+ // When React Native instantiates the emitter it is registered here.
19
+ func registerEventEmitter(eventEmitter: CashfreeEventEmitter) {
20
+ self.eventEmitter = eventEmitter
21
+ }
22
+
23
+ func dispatch(name: String, body: Any?) {
24
+ eventEmitter.sendEvent(withName: name, body: body)
25
+ }
26
+
27
+ /// All Events which must be support by React Native.
28
+ lazy var allEvents: [String] = {
29
+ var allEventNames: [String] = ["cfSuccess", "cfFailure", "cfEvent", "cfUpiApps"]
30
+
31
+ // Append all events here
32
+
33
+ return allEventNames
34
+ }()
35
+
36
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // CashfreeEventEmitter.m
3
+ // DoubleConversion
4
+ //
5
+ // Created by Aabhas Jindal on 13/06/22.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+ #import <React/RCTBridgeModule.h>
10
+ #import <React/RCTEventEmitter.h>
11
+
12
+ @interface RCT_EXTERN_MODULE(CashfreeEventEmitter, RCTEventEmitter)
13
+
14
+ RCT_EXTERN_METHOD(supportedEvents)
15
+
16
+ @end
@@ -0,0 +1,28 @@
1
+ //
2
+ // CashfreeEventEmitter.swift
3
+ // DoubleConversion
4
+ //
5
+ // Created by Aabhas Jindal on 13/06/22.
6
+ //
7
+
8
+ import Foundation
9
+
10
+ @objc(CashfreeEventEmitter)
11
+ open class CashfreeEventEmitter: RCTEventEmitter {
12
+
13
+ override init() {
14
+ super.init()
15
+ CashfreeEmitter.sharedInstance.registerEventEmitter(eventEmitter: self)
16
+ }
17
+
18
+ /// Base overide for RCTEventEmitter.
19
+ ///
20
+ /// - Returns: all supported events
21
+ @objc open override func supportedEvents() -> [String] {
22
+ return CashfreeEmitter.sharedInstance.allEvents
23
+ }
24
+
25
+ @objc public override static func requiresMainQueueSetup() -> Bool {
26
+ return false
27
+ }
28
+ }
@@ -0,0 +1,5 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTViewManager.h>
3
+ #import <React/RCTUtils.h>
4
+ #import <Foundation/Foundation.h>
5
+ #import <React/RCTEventEmitter.h>
@@ -0,0 +1,21 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTUtils.h>
3
+
4
+ @interface RCT_EXTERN_MODULE(CashfreePgApi, NSObject)
5
+
6
+ RCT_EXTERN_METHOD(doPayment:(NSString)paymentObject)
7
+
8
+ RCT_EXTERN_METHOD(doUPIPayment:(NSString)paymentObject)
9
+
10
+ RCT_EXTERN_METHOD(doWebPayment:(NSString)paymentObject,(NSString)baseUrl)
11
+ RCT_EXTERN_METHOD(doCardPayment:(NSString)paymentObject)
12
+ RCT_EXTERN_METHOD(doElementUPIPayment:(NSString)paymentObject)
13
+ RCT_EXTERN_METHOD(getInstalledUpiApps)
14
+
15
+ RCT_EXTERN_METHOD(setCallback)
16
+
17
+ RCT_EXTERN_METHOD(setEventSubscriber)
18
+
19
+ RCT_EXTERN_METHOD(removeEventSubscriber)
20
+
21
+ @end