react-native-cashfree-pg-sdk 2.0.2 → 2.0.4-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.
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.4.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.4.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.4.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/jarRepositories.xml +10 -20
- package/android/.idea/misc.xml +2 -1
- package/android/.idea/sonarlint/issuestore/3/e/3e1984987c20cd21984de8c97894175bd94b0037 +3 -0
- package/android/.idea/sonarlint/issuestore/4/4/44aaf172f11159c609e569cf1b49bcd49376a770 +8 -0
- package/android/.idea/sonarlint/issuestore/f/0/f07866736216be0ee2aba49e392191aeae700a35 +0 -0
- package/android/.idea/sonarlint/issuestore/index.pb +7 -0
- package/android/build.gradle +1 -8
- package/android/local.properties +2 -2
- package/android/src/main/java/com/reactnativecashfreepgsdk/CashfreePgApiModule.java +33 -0
- package/lib/commonjs/index.js +10 -37
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +10 -33
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/index.js +3 -0
- package/src/index.ts +5 -1
- package/android/.idea/.gitignore +0 -3
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_1_3_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_dynamicanimation_dynamicanimation_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_gridlayout_gridlayout_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +0 -11
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -13
- package/android/.idea/libraries/Gradle__com_cashfree_pg_analytics_1_0_6_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_api_1_0_11_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_base_1_0_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_core_1_0_11_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_image_caching_1_0_2_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_network_1_0_1_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_cashfree_pg_ui_1_0_11_aar.xml +0 -11
- package/android/.idea/libraries/Gradle__com_facebook_fbjni_fbjni_java_only_0_0_3.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_2_0_0_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagefilters_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagetranscoder_2_0_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_11_2.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_63_4_aar.xml +0 -18
- package/android/.idea/libraries/Gradle__com_facebook_soloader_annotation_0_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_soloader_nativeloader_0_9_0.xml +0 -13
- package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_9_0_aar.xml +0 -15
- package/android/.idea/libraries/Gradle__com_facebook_yoga_proguard_annotations_1_14_1.xml +0 -13
- package/android/.idea/libraries/Gradle__com_google_android_material_material_1_4_0_aar.xml +0 -16
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_12_12.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_3_12_12.xml +0 -13
- package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_15_0.xml +0 -13
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -13
- package/android/.idea/modules/android.androidTest.iml +0 -106
- package/android/.idea/modules/android.iml +0 -40
- package/android/.idea/modules/android.main.iml +0 -113
- package/android/.idea/modules/android.unitTest.iml +0 -101
- package/android/.idea/modules.xml +0 -11
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/ios/CashfreePgApi.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -4
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#
|
|
1
|
+
#Fri Feb 24 12:18:36 IST 2023
|
|
2
2
|
gradle.version=6.8
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
<option name="name" value="JBoss Community repository" />
|
|
12
12
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
|
13
13
|
</remote-repository>
|
|
14
|
+
<remote-repository>
|
|
15
|
+
<option name="id" value="MavenLocal" />
|
|
16
|
+
<option name="name" value="MavenLocal" />
|
|
17
|
+
<option name="url" value="file:$USER_HOME$/.m2/repository/" />
|
|
18
|
+
</remote-repository>
|
|
19
|
+
<remote-repository>
|
|
20
|
+
<option name="id" value="maven" />
|
|
21
|
+
<option name="name" value="maven" />
|
|
22
|
+
<option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
|
|
23
|
+
</remote-repository>
|
|
14
24
|
<remote-repository>
|
|
15
25
|
<option name="id" value="MavenRepo" />
|
|
16
26
|
<option name="name" value="MavenRepo" />
|
|
@@ -21,30 +31,10 @@
|
|
|
21
31
|
<option name="name" value="maven2" />
|
|
22
32
|
<option name="url" value="https://maven.cashfree.com/release" />
|
|
23
33
|
</remote-repository>
|
|
24
|
-
<remote-repository>
|
|
25
|
-
<option name="id" value="BintrayJCenter2" />
|
|
26
|
-
<option name="name" value="BintrayJCenter2" />
|
|
27
|
-
<option name="url" value="https://jcenter.bintray.com/" />
|
|
28
|
-
</remote-repository>
|
|
29
|
-
<remote-repository>
|
|
30
|
-
<option name="id" value="maven" />
|
|
31
|
-
<option name="name" value="maven" />
|
|
32
|
-
<option name="url" value="file:$PROJECT_DIR$/../node_modules/react-native/android/" />
|
|
33
|
-
</remote-repository>
|
|
34
|
-
<remote-repository>
|
|
35
|
-
<option name="id" value="MavenLocal" />
|
|
36
|
-
<option name="name" value="MavenLocal" />
|
|
37
|
-
<option name="url" value="file:$USER_HOME$/.m2/repository" />
|
|
38
|
-
</remote-repository>
|
|
39
34
|
<remote-repository>
|
|
40
35
|
<option name="id" value="Google2" />
|
|
41
36
|
<option name="name" value="Google2" />
|
|
42
37
|
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
|
|
43
38
|
</remote-repository>
|
|
44
|
-
<remote-repository>
|
|
45
|
-
<option name="id" value="MavenLocal" />
|
|
46
|
-
<option name="name" value="MavenLocal" />
|
|
47
|
-
<option name="url" value="file:$USER_HOME$/.m2/repository/" />
|
|
48
|
-
</remote-repository>
|
|
49
39
|
</component>
|
|
50
40
|
</project>
|
package/android/.idea/misc.xml
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
2
|
<project version="4">
|
|
3
|
-
<component name="
|
|
3
|
+
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
|
4
|
+
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
|
|
4
5
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
6
|
</component>
|
|
6
7
|
<component name="ProjectType">
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
|
|
2
|
+
�
|
|
3
|
+
java:S1598"�This file "CashfreePgApiPackage.java" should be located in "com/reactnativecashfreepgapi" directory, not in "/Users/kishankumarmaurya/Development/ReactNative/RN_PG_APP/react-native-cashfree-pg-sdk/android/src/main/java/com/reactnativecashfreepgsdk".(ٻ�������8�����0
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
�
|
|
3
|
+
java:S1598"�This file "CashfreePgApiModule.java" should be located in "com/reactnativecashfreepgapi" directory, not in "/Users/kishankumarmaurya/Development/ReactNative/RN_PG_APP/react-native-cashfree-pg-sdk/android/src/main/java/com/reactnativecashfreepgsdk".(ٻ�������
|
|
4
|
+
> java:S108b")Either remove or fill this block of code.(����
|
|
5
|
+
C java:S108j")Either remove or fill this block of code.(Ƹۂ�����
|
|
6
|
+
C java:S108r")Either remove or fill this block of code.(Ƹۂ�����
|
|
7
|
+
P
|
|
8
|
+
java:S2864�"4Iterate over the "entrySet" instead of the "keySet".(�ֲ������
|
|
File without changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
|
|
2
|
+
<
|
|
3
|
+
build.gradle,f/0/f07866736216be0ee2aba49e392191aeae700a35
|
|
4
|
+
t
|
|
5
|
+
Dsrc/main/java/com/reactnativecashfreepgsdk/CashfreePgApiPackage.java,3/e/3e1984987c20cd21984de8c97894175bd94b0037
|
|
6
|
+
s
|
|
7
|
+
Csrc/main/java/com/reactnativecashfreepgsdk/CashfreePgApiModule.java,4/4/44aaf172f11159c609e569cf1b49bcd49376a770
|
package/android/build.gradle
CHANGED
|
@@ -56,13 +56,6 @@ rootProject.allprojects {
|
|
|
56
56
|
repositories {
|
|
57
57
|
google()
|
|
58
58
|
mavenCentral()
|
|
59
|
-
maven {
|
|
60
|
-
url 'https://maven.cashfree.com/release'
|
|
61
|
-
content {
|
|
62
|
-
// Does only include this group
|
|
63
|
-
includeGroup "com.cashfree.pg"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
59
|
}
|
|
67
60
|
}
|
|
68
61
|
|
|
@@ -73,7 +66,7 @@ dependencies {
|
|
|
73
66
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
|
74
67
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
|
75
68
|
|
|
76
|
-
implementation 'com.cashfree.pg:api:2.0.
|
|
69
|
+
implementation 'com.cashfree.pg:api:2.0.6'
|
|
77
70
|
|
|
78
71
|
implementation "com.facebook.react:react-native:+" // From node_modules
|
|
79
72
|
}
|
package/android/local.properties
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
# Location of the SDK. This is only used by Gradle.
|
|
5
5
|
# For customization when using a Version Control System, please read the
|
|
6
6
|
# header note.
|
|
7
|
-
#
|
|
8
|
-
sdk.dir=/Users/
|
|
7
|
+
#Fri Feb 24 12:17:22 IST 2023
|
|
8
|
+
sdk.dir=/Users/kishankumarmaurya/Library/Android/sdk
|
|
@@ -9,10 +9,12 @@ import androidx.annotation.Nullable;
|
|
|
9
9
|
import com.cashfree.pg.api.CFPaymentGatewayService;
|
|
10
10
|
import com.cashfree.pg.cf_analytics.CFAnalyticsService;
|
|
11
11
|
import com.cashfree.pg.cf_analytics.CFEventsSubscriber;
|
|
12
|
+
import com.cashfree.pg.core.api.CFSession;
|
|
12
13
|
import com.cashfree.pg.core.api.base.CFPayment;
|
|
13
14
|
import com.cashfree.pg.core.api.callback.CFCheckoutResponseCallback;
|
|
14
15
|
import com.cashfree.pg.core.api.exception.CFException;
|
|
15
16
|
import com.cashfree.pg.core.api.utils.CFErrorResponse;
|
|
17
|
+
import com.cashfree.pg.core.api.webcheckout.CFWebCheckoutPayment;
|
|
16
18
|
import com.cashfree.pg.ui.api.CFDropCheckoutPayment;
|
|
17
19
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
20
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
@@ -58,6 +60,37 @@ public class CashfreePgApiModule extends ReactContextBaseJavaModule implements C
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
@ReactMethod
|
|
64
|
+
public void doWebPayment(String sessionString) {
|
|
65
|
+
Log.d("CashfreePgApiModule Web", sessionString);
|
|
66
|
+
CFSession cfSession = null;
|
|
67
|
+
try {
|
|
68
|
+
JSONObject jsonObject = new JSONObject(sessionString);
|
|
69
|
+
cfSession = new CFSession.CFSessionBuilder()
|
|
70
|
+
.setEnvironment(CFSession.Environment.valueOf(jsonObject.getString("environment")))
|
|
71
|
+
.setOrderId(jsonObject.getString("orderID"))
|
|
72
|
+
.setPaymentSessionID(jsonObject.getString("payment_session_id"))
|
|
73
|
+
.build();
|
|
74
|
+
} catch (Exception exception) {
|
|
75
|
+
throw new IllegalStateException("Session is invalid");
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
Activity activity = getCurrentActivity();
|
|
79
|
+
CFWebCheckoutPayment cfWebCheckoutPayment = new CFWebCheckoutPayment.CFWebCheckoutPaymentBuilder()
|
|
80
|
+
.setSession(cfSession)
|
|
81
|
+
.build();
|
|
82
|
+
cfWebCheckoutPayment.setCfsdkFramework(CFPayment.CFSDKFramework.REACT_NATIVE);
|
|
83
|
+
cfWebCheckoutPayment.setCfSDKFlavour(CFPayment.CFSDKFlavour.WEB_CHECKOUT);
|
|
84
|
+
if (activity != null) {
|
|
85
|
+
CFPaymentGatewayService.getInstance().doPayment(activity, cfWebCheckoutPayment);
|
|
86
|
+
} else {
|
|
87
|
+
throw new IllegalStateException("activity is null");
|
|
88
|
+
}
|
|
89
|
+
} catch (Exception e) {
|
|
90
|
+
e.printStackTrace();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
61
94
|
@ReactMethod
|
|
62
95
|
public void setCallback() {
|
|
63
96
|
try {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.CFPaymentGatewayService = exports.CFErrorResponse = void 0;
|
|
7
|
-
|
|
8
7
|
var _reactNative = require("react-native");
|
|
9
|
-
|
|
10
8
|
var _package = require("../package.json");
|
|
11
|
-
|
|
12
|
-
function
|
|
13
|
-
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
12
|
const LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
15
13
|
ios: '- You have run \'pod install\'\n',
|
|
16
14
|
default: ''
|
|
@@ -19,97 +17,78 @@ const CashfreePgApi = _reactNative.NativeModules.CashfreePgApi ? _reactNative.Na
|
|
|
19
17
|
get() {
|
|
20
18
|
throw new Error(LINKING_ERROR);
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
});
|
|
24
|
-
|
|
25
21
|
class CFPaymentGateway {
|
|
26
22
|
constructor() {
|
|
27
23
|
_defineProperty(this, "emitter", void 0);
|
|
28
|
-
|
|
29
24
|
_defineProperty(this, "successSubscription", null);
|
|
30
|
-
|
|
31
25
|
_defineProperty(this, "failureSubscription", null);
|
|
32
|
-
|
|
33
26
|
_defineProperty(this, "eventSubscription", null);
|
|
34
|
-
|
|
35
27
|
this.emitter = _reactNative.Platform.OS === 'ios' ? new _reactNative.NativeEventEmitter(_reactNative.NativeModules.CashfreeEventEmitter) : _reactNative.NativeAppEventEmitter;
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
doPayment(checkoutPayment) {
|
|
39
30
|
checkoutPayment.version = _package.version;
|
|
40
31
|
CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));
|
|
41
32
|
}
|
|
42
|
-
|
|
33
|
+
doWebPayment(cfSession) {
|
|
34
|
+
CashfreePgApi.doWebPayment(cfSession);
|
|
35
|
+
}
|
|
43
36
|
setEventSubscriber(cfEventCallback) {
|
|
44
37
|
if (_reactNative.Platform.OS === 'android') {
|
|
45
38
|
let eventFunction = event => {
|
|
46
39
|
let data = JSON.parse(event);
|
|
47
40
|
cfEventCallback.onReceivedEvent(data.eventName, data.meta);
|
|
48
41
|
};
|
|
49
|
-
|
|
50
42
|
this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
|
|
51
43
|
CashfreePgApi.setEventSubscriber();
|
|
52
44
|
}
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
removeEventSubscriber() {
|
|
56
47
|
if (_reactNative.Platform.OS === 'android') {
|
|
57
48
|
if (this.eventSubscription !== undefined && this.eventSubscription !== null) {
|
|
58
49
|
this.eventSubscription.remove();
|
|
59
50
|
this.eventSubscription = null;
|
|
60
51
|
}
|
|
61
|
-
|
|
62
52
|
CashfreePgApi.removeEventSubscriber();
|
|
63
53
|
}
|
|
64
54
|
}
|
|
65
|
-
|
|
66
55
|
setCallback(cfCallback) {
|
|
67
56
|
// this.cfCallback = cfCallback;
|
|
68
57
|
let successFunction = orderID => {
|
|
69
58
|
console.log('response is : ' + JSON.stringify(orderID));
|
|
70
59
|
cfCallback.onVerify(orderID);
|
|
71
60
|
};
|
|
72
|
-
|
|
73
61
|
let failureFunction = error => {
|
|
74
62
|
console.log('reason: ' + JSON.stringify(error));
|
|
75
|
-
const response = new CFErrorResponse();
|
|
76
|
-
|
|
63
|
+
const response = new CFErrorResponse();
|
|
64
|
+
// @ts-ignore
|
|
77
65
|
const message = JSON.parse(error);
|
|
78
|
-
response.fromJSON(message.error);
|
|
79
|
-
|
|
66
|
+
response.fromJSON(message.error);
|
|
67
|
+
// @ts-ignore
|
|
80
68
|
cfCallback.onError(response, message.orderID);
|
|
81
69
|
};
|
|
82
|
-
|
|
83
70
|
this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);
|
|
84
71
|
this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);
|
|
85
72
|
CashfreePgApi.setCallback();
|
|
86
73
|
}
|
|
87
|
-
|
|
88
74
|
removeCallback() {
|
|
89
75
|
if (this.successSubscription !== undefined && this.successSubscription !== null) {
|
|
90
76
|
this.successSubscription.remove();
|
|
91
77
|
this.successSubscription = null;
|
|
92
78
|
}
|
|
93
|
-
|
|
94
79
|
if (this.failureSubscription !== undefined && this.failureSubscription !== null) {
|
|
95
80
|
this.failureSubscription.remove();
|
|
96
81
|
this.failureSubscription = null;
|
|
97
82
|
}
|
|
98
83
|
}
|
|
99
|
-
|
|
100
84
|
}
|
|
101
|
-
|
|
102
85
|
class CFErrorResponse {
|
|
103
86
|
constructor() {
|
|
104
87
|
_defineProperty(this, "status", 'FAILED');
|
|
105
|
-
|
|
106
88
|
_defineProperty(this, "message", 'payment has failed');
|
|
107
|
-
|
|
108
89
|
_defineProperty(this, "code", 'payment_failed');
|
|
109
|
-
|
|
110
90
|
_defineProperty(this, "type", 'request_failed');
|
|
111
91
|
}
|
|
112
|
-
|
|
113
92
|
fromJSON(errorString) {
|
|
114
93
|
console.log('errorString :' + errorString);
|
|
115
94
|
const object = JSON.parse(errorString);
|
|
@@ -119,25 +98,19 @@ class CFErrorResponse {
|
|
|
119
98
|
this.code = object.code;
|
|
120
99
|
this.type = object.type;
|
|
121
100
|
}
|
|
122
|
-
|
|
123
101
|
getStatus() {
|
|
124
102
|
return this.status;
|
|
125
103
|
}
|
|
126
|
-
|
|
127
104
|
getMessage() {
|
|
128
105
|
return this.message;
|
|
129
106
|
}
|
|
130
|
-
|
|
131
107
|
getCode() {
|
|
132
108
|
return this.code;
|
|
133
109
|
}
|
|
134
|
-
|
|
135
110
|
getType() {
|
|
136
111
|
return this.type;
|
|
137
112
|
}
|
|
138
|
-
|
|
139
113
|
}
|
|
140
|
-
|
|
141
114
|
exports.CFErrorResponse = CFErrorResponse;
|
|
142
115
|
const CFPaymentGatewayService = new CFPaymentGateway();
|
|
143
116
|
exports.CFPaymentGatewayService = CFPaymentGatewayService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","CashfreePgApi","NativeModules","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","NativeEventEmitter","CashfreeEventEmitter","NativeAppEventEmitter","doPayment","checkoutPayment","version","JSON","stringify","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","CashfreePgApi","NativeModules","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","NativeEventEmitter","CashfreeEventEmitter","NativeAppEventEmitter","doPayment","checkoutPayment","version","JSON","stringify","doWebPayment","cfSession","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.js"],"sourcesContent":["import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform, } from 'react-native';\nimport { version } from '../package.json';\nconst LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: '- You have run \\'pod install\\'\\n', default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy({}, {\n get() {\n throw new Error(LINKING_ERROR);\n },\n });\nclass CFPaymentGateway {\n emitter;\n successSubscription = null;\n failureSubscription = null;\n eventSubscription = null;\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n doPayment(checkoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n doWebPayment(cfSession) {\n CashfreePgApi.doWebPayment(cfSession);\n }\n setEventSubscriber(cfEventCallback) {\n if (Platform.OS === 'android') {\n let eventFunction = (event) => {\n let data = JSON.parse(event);\n cfEventCallback.onReceivedEvent(data.eventName, data.meta);\n };\n this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);\n CashfreePgApi.setEventSubscriber();\n }\n }\n removeEventSubscriber() {\n if (Platform.OS === 'android') {\n if (this.eventSubscription !== undefined &&\n this.eventSubscription !== null) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n }\n setCallback(cfCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error) => {\n console.log('reason: ' + JSON.stringify(error));\n const response = new CFErrorResponse();\n // @ts-ignore\n const message = JSON.parse(error);\n response.fromJSON(message.error);\n // @ts-ignore\n cfCallback.onError(response, message.orderID);\n };\n this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);\n this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);\n CashfreePgApi.setCallback();\n }\n removeCallback() {\n if (this.successSubscription !== undefined &&\n this.successSubscription !== null) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (this.failureSubscription !== undefined &&\n this.failureSubscription !== null) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\nexport class CFErrorResponse {\n status = 'FAILED';\n message = 'payment has failed';\n code = 'payment_failed';\n type = 'request_failed';\n fromJSON(errorString) {\n console.log('errorString :' + errorString);\n const object = JSON.parse(errorString);\n console.log('errorStringObject :' + object);\n this.status = object.status;\n this.message = object.message;\n this.code = object.code;\n this.type = object.type;\n }\n getStatus() {\n return this.status;\n }\n getMessage() {\n return this.message;\n }\n getCode() {\n return this.code;\n }\n getType() {\n return this.type;\n }\n}\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;AAAA;AACA;AAA0C;AAAA;AAAA;AAC1C,MAAMA,aAAa,GAAI,uFAAsF,GACzGC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,kCAAkC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACzE,sDAAsD,GACtD,6CAA6C;AACjD,MAAMC,aAAa,GAAGC,0BAAa,CAACD,aAAa,GAC3CC,0BAAa,CAACD,aAAa,GAC3B,IAAIE,KAAK,CAAC,C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,CAACA,mBAAmB,CAAChB,MAAM,EAAE;MACjC,IAAI,CAACgB,mBAAmB,GAAG,IAAI;IACnC;EACJ;AACJ;AACO,MAAML,eAAe,CAAC;EAAA;IAAA,gCAChB,QAAQ;IAAA,iCACP,oBAAoB;IAAA,8BACvB,gBAAgB;IAAA,8BAChB,gBAAgB;EAAA;EACvBE,QAAQ,CAACK,WAAW,EAAE;IAClBb,OAAO,CAACC,GAAG,CAAC,eAAe,GAAGY,WAAW,CAAC;IAC1C,MAAMC,MAAM,GAAGpC,IAAI,CAACS,KAAK,CAAC0B,WAAW,CAAC;IACtCb,OAAO,CAACC,GAAG,CAAC,qBAAqB,GAAGa,MAAM,CAAC;IAC3C,IAAI,CAACC,MAAM,GAAGD,MAAM,CAACC,MAAM;IAC3B,IAAI,CAACR,OAAO,GAAGO,MAAM,CAACP,OAAO;IAC7B,IAAI,CAACS,IAAI,GAAGF,MAAM,CAACE,IAAI;IACvB,IAAI,CAACC,IAAI,GAAGH,MAAM,CAACG,IAAI;EAC3B;EACAC,SAAS,GAAG;IACR,OAAO,IAAI,CAACH,MAAM;EACtB;EACAI,UAAU,GAAG;IACT,OAAO,IAAI,CAACZ,OAAO;EACvB;EACAa,OAAO,GAAG;IACN,OAAO,IAAI,CAACJ,IAAI;EACpB;EACAK,OAAO,GAAG;IACN,OAAO,IAAI,CAACJ,IAAI;EACpB;AACJ;AAAC;AACM,MAAMK,uBAAuB,GAAG,IAAItD,gBAAgB,EAAE;AAAC"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
1
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3
4
|
import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
4
5
|
import { version } from '../package.json';
|
|
5
6
|
const LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
@@ -10,97 +11,78 @@ const CashfreePgApi = NativeModules.CashfreePgApi ? NativeModules.CashfreePgApi
|
|
|
10
11
|
get() {
|
|
11
12
|
throw new Error(LINKING_ERROR);
|
|
12
13
|
}
|
|
13
|
-
|
|
14
14
|
});
|
|
15
|
-
|
|
16
15
|
class CFPaymentGateway {
|
|
17
16
|
constructor() {
|
|
18
17
|
_defineProperty(this, "emitter", void 0);
|
|
19
|
-
|
|
20
18
|
_defineProperty(this, "successSubscription", null);
|
|
21
|
-
|
|
22
19
|
_defineProperty(this, "failureSubscription", null);
|
|
23
|
-
|
|
24
20
|
_defineProperty(this, "eventSubscription", null);
|
|
25
|
-
|
|
26
21
|
this.emitter = Platform.OS === 'ios' ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter) : NativeAppEventEmitter;
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
doPayment(checkoutPayment) {
|
|
30
24
|
checkoutPayment.version = version;
|
|
31
25
|
CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));
|
|
32
26
|
}
|
|
33
|
-
|
|
27
|
+
doWebPayment(cfSession) {
|
|
28
|
+
CashfreePgApi.doWebPayment(cfSession);
|
|
29
|
+
}
|
|
34
30
|
setEventSubscriber(cfEventCallback) {
|
|
35
31
|
if (Platform.OS === 'android') {
|
|
36
32
|
let eventFunction = event => {
|
|
37
33
|
let data = JSON.parse(event);
|
|
38
34
|
cfEventCallback.onReceivedEvent(data.eventName, data.meta);
|
|
39
35
|
};
|
|
40
|
-
|
|
41
36
|
this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);
|
|
42
37
|
CashfreePgApi.setEventSubscriber();
|
|
43
38
|
}
|
|
44
39
|
}
|
|
45
|
-
|
|
46
40
|
removeEventSubscriber() {
|
|
47
41
|
if (Platform.OS === 'android') {
|
|
48
42
|
if (this.eventSubscription !== undefined && this.eventSubscription !== null) {
|
|
49
43
|
this.eventSubscription.remove();
|
|
50
44
|
this.eventSubscription = null;
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
CashfreePgApi.removeEventSubscriber();
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
|
-
|
|
57
49
|
setCallback(cfCallback) {
|
|
58
50
|
// this.cfCallback = cfCallback;
|
|
59
51
|
let successFunction = orderID => {
|
|
60
52
|
console.log('response is : ' + JSON.stringify(orderID));
|
|
61
53
|
cfCallback.onVerify(orderID);
|
|
62
54
|
};
|
|
63
|
-
|
|
64
55
|
let failureFunction = error => {
|
|
65
56
|
console.log('reason: ' + JSON.stringify(error));
|
|
66
|
-
const response = new CFErrorResponse();
|
|
67
|
-
|
|
57
|
+
const response = new CFErrorResponse();
|
|
58
|
+
// @ts-ignore
|
|
68
59
|
const message = JSON.parse(error);
|
|
69
|
-
response.fromJSON(message.error);
|
|
70
|
-
|
|
60
|
+
response.fromJSON(message.error);
|
|
61
|
+
// @ts-ignore
|
|
71
62
|
cfCallback.onError(response, message.orderID);
|
|
72
63
|
};
|
|
73
|
-
|
|
74
64
|
this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);
|
|
75
65
|
this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);
|
|
76
66
|
CashfreePgApi.setCallback();
|
|
77
67
|
}
|
|
78
|
-
|
|
79
68
|
removeCallback() {
|
|
80
69
|
if (this.successSubscription !== undefined && this.successSubscription !== null) {
|
|
81
70
|
this.successSubscription.remove();
|
|
82
71
|
this.successSubscription = null;
|
|
83
72
|
}
|
|
84
|
-
|
|
85
73
|
if (this.failureSubscription !== undefined && this.failureSubscription !== null) {
|
|
86
74
|
this.failureSubscription.remove();
|
|
87
75
|
this.failureSubscription = null;
|
|
88
76
|
}
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
}
|
|
92
|
-
|
|
93
79
|
export class CFErrorResponse {
|
|
94
80
|
constructor() {
|
|
95
81
|
_defineProperty(this, "status", 'FAILED');
|
|
96
|
-
|
|
97
82
|
_defineProperty(this, "message", 'payment has failed');
|
|
98
|
-
|
|
99
83
|
_defineProperty(this, "code", 'payment_failed');
|
|
100
|
-
|
|
101
84
|
_defineProperty(this, "type", 'request_failed');
|
|
102
85
|
}
|
|
103
|
-
|
|
104
86
|
fromJSON(errorString) {
|
|
105
87
|
console.log('errorString :' + errorString);
|
|
106
88
|
const object = JSON.parse(errorString);
|
|
@@ -110,23 +92,18 @@ export class CFErrorResponse {
|
|
|
110
92
|
this.code = object.code;
|
|
111
93
|
this.type = object.type;
|
|
112
94
|
}
|
|
113
|
-
|
|
114
95
|
getStatus() {
|
|
115
96
|
return this.status;
|
|
116
97
|
}
|
|
117
|
-
|
|
118
98
|
getMessage() {
|
|
119
99
|
return this.message;
|
|
120
100
|
}
|
|
121
|
-
|
|
122
101
|
getCode() {
|
|
123
102
|
return this.code;
|
|
124
103
|
}
|
|
125
|
-
|
|
126
104
|
getType() {
|
|
127
105
|
return this.type;
|
|
128
106
|
}
|
|
129
|
-
|
|
130
107
|
}
|
|
131
108
|
export const CFPaymentGatewayService = new CFPaymentGateway();
|
|
132
109
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeAppEventEmitter","NativeEventEmitter","NativeModules","Platform","version","LINKING_ERROR","select","ios","default","CashfreePgApi","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","CashfreeEventEmitter","doPayment","checkoutPayment","JSON","stringify","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.
|
|
1
|
+
{"version":3,"names":["NativeAppEventEmitter","NativeEventEmitter","NativeModules","Platform","version","LINKING_ERROR","select","ios","default","CashfreePgApi","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","CashfreeEventEmitter","doPayment","checkoutPayment","JSON","stringify","doWebPayment","cfSession","setEventSubscriber","cfEventCallback","eventFunction","event","data","parse","onReceivedEvent","eventName","meta","eventSubscription","addListener","removeEventSubscriber","undefined","remove","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","fromJSON","onError","successSubscription","failureSubscription","removeCallback","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.js"],"sourcesContent":["import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform, } from 'react-native';\nimport { version } from '../package.json';\nconst LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: '- You have run \\'pod install\\'\\n', default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy({}, {\n get() {\n throw new Error(LINKING_ERROR);\n },\n });\nclass CFPaymentGateway {\n emitter;\n successSubscription = null;\n failureSubscription = null;\n eventSubscription = null;\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n doPayment(checkoutPayment) {\n checkoutPayment.version = version;\n CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n doWebPayment(cfSession) {\n CashfreePgApi.doWebPayment(cfSession);\n }\n setEventSubscriber(cfEventCallback) {\n if (Platform.OS === 'android') {\n let eventFunction = (event) => {\n let data = JSON.parse(event);\n cfEventCallback.onReceivedEvent(data.eventName, data.meta);\n };\n this.eventSubscription = this.emitter.addListener('cfEvent', eventFunction);\n CashfreePgApi.setEventSubscriber();\n }\n }\n removeEventSubscriber() {\n if (Platform.OS === 'android') {\n if (this.eventSubscription !== undefined &&\n this.eventSubscription !== null) {\n this.eventSubscription.remove();\n this.eventSubscription = null;\n }\n CashfreePgApi.removeEventSubscriber();\n }\n }\n setCallback(cfCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error) => {\n console.log('reason: ' + JSON.stringify(error));\n const response = new CFErrorResponse();\n // @ts-ignore\n const message = JSON.parse(error);\n response.fromJSON(message.error);\n // @ts-ignore\n cfCallback.onError(response, message.orderID);\n };\n this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);\n this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);\n CashfreePgApi.setCallback();\n }\n removeCallback() {\n if (this.successSubscription !== undefined &&\n this.successSubscription !== null) {\n this.successSubscription.remove();\n this.successSubscription = null;\n }\n if (this.failureSubscription !== undefined &&\n this.failureSubscription !== null) {\n this.failureSubscription.remove();\n this.failureSubscription = null;\n }\n }\n}\nexport class CFErrorResponse {\n status = 'FAILED';\n message = 'payment has failed';\n code = 'payment_failed';\n type = 'request_failed';\n fromJSON(errorString) {\n console.log('errorString :' + errorString);\n const object = JSON.parse(errorString);\n console.log('errorStringObject :' + object);\n this.status = object.status;\n this.message = object.message;\n this.code = object.code;\n this.type = object.type;\n }\n getStatus() {\n return this.status;\n }\n getMessage() {\n return this.message;\n }\n getCode() {\n return this.code;\n }\n getType() {\n return this.type;\n }\n}\nexport const CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;AAAA,SAASA,qBAAqB,EAAEC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAS,cAAc;AAClG,SAASC,OAAO,QAAQ,iBAAiB;AACzC,MAAMC,aAAa,GAAI,uFAAsF,GACzGF,QAAQ,CAACG,MAAM,CAAC;EAAEC,GAAG,EAAE,kCAAkC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACzE,sDAAsD,GACtD,6CAA6C;AACjD,MAAMC,aAAa,GAAGP,aAAa,CAACO,aAAa,GAC3CP,aAAa,CAACO,aAAa,GAC3B,IAAIC,KAAK,CAAC,CAAC,CAAC,EAAE;EACZC,GAAG,GAAG;IACF,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAClC;AACJ,CAAC,CAAC;AACN,MAAMQ,gBAAgB,CAAC;EAKnBC,WAAW,GAAG;IAAA;IAAA,6CAHQ,IAAI;IAAA,6CACJ,IAAI;IAAA,2CACN,IAAI;IAEpB,IAAI,CAACC,OAAO,GACRZ,QAAQ,CAACa,EAAE,KAAK,KAAK,GACf,IAAIf,kBAAkB,CAACC,aAAa,CAACe,oBAAoB,CAAC,GAC1DjB,qBAAqB;EACnC;EACAkB,SAAS,CAACC,eAAe,EAAE;IACvBA,eAAe,CAACf,OAAO,GAAGA,OAAO;IACjCK,aAAa,CAACS,SAAS,CAACE,IAAI,CAACC,SAAS,CAACF,eAAe,CAAC,CAAC;EAC5D;EACAG,YAAY,CAACC,SAAS,EAAE;IACpBd,aAAa,CAACa,YAAY,CAACC,SAAS,CAAC;EACzC;EACAC,kBAAkB,CAACC,eAAe,EAAE;IAChC,IAAItB,QAAQ,CAACa,EAAE,KAAK,SAAS,EAAE;MAC3B,IAAIU,aAAa,GAAIC,KAAK,IAAK;QAC3B,IAAIC,IAAI,GAAGR,IAAI,CAACS,KAAK,CAACF,KAAK,CAAC;QAC5BF,eAAe,C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