react-native-cashfree-pg-sdk 0.1.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/LICENSE +21 -0
- package/README.md +27 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileChanges/last-build.bin +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/6.8/fileHashes/resourceHashesCache.bin +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/6.8/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.8/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.8/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.8/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- 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/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/jarRepositories.xml +45 -0
- package/android/.idea/libraries/Gradle__androidx_activity_activity_1_2_3_aar.xml +17 -0
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_2_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_annotation_annotation_experimental_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_3_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_resources_1_3_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_1_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_1_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_cardview_cardview_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_collection_collection_1_1_0.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_constraintlayout_constraintlayout_2_1_3_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_1_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_core_core_1_5_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +17 -0
- package/android/.idea/libraries/Gradle__androidx_dynamicanimation_dynamicanimation_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_3_4_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_gridlayout_gridlayout_1_0_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_3_1.xml +11 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_3_1_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_3_1_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_3_1_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_savedstate_2_3_1_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +17 -0
- package/android/.idea/libraries/Gradle__androidx_recyclerview_recyclerview_1_1_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_savedstate_savedstate_1_1_0_aar.xml +13 -0
- package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +17 -0
- package/android/.idea/libraries/Gradle__androidx_transition_transition_1_2_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_1_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_1_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_1_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__androidx_viewpager2_viewpager2_1_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +14 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_analytics_1_0_6_aar.xml +11 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_api_1_0_9_aar.xml +11 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_base_1_0_1_aar.xml +12 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_core_1_0_9_aar.xml +11 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_image_caching_1_0_1_aar.xml +12 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_network_1_0_0_aar.xml +12 -0
- package/android/.idea/libraries/Gradle__com_cashfree_pg_ui_1_0_9_aar.xml +11 -0
- package/android/.idea/libraries/Gradle__com_facebook_fbjni_fbjni_java_only_0_0_3.xml +13 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_2_0_0_aar.xml +15 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_2_0_0_aar.xml +19 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_2_0_0_aar.xml +19 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_2_0_0_aar.xml +19 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_2_0_0_aar.xml +19 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_2_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagefilters_2_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagetranscoder_2_0_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_11_2.xml +13 -0
- package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_63_4_aar.xml +18 -0
- package/android/.idea/libraries/Gradle__com_facebook_soloader_annotation_0_9_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_facebook_soloader_nativeloader_0_9_0.xml +13 -0
- package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_9_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_facebook_yoga_proguard_annotations_1_14_1.xml +13 -0
- package/android/.idea/libraries/Gradle__com_google_android_material_material_1_4_0_aar.xml +16 -0
- package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_12_12.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_3_12_12.xml +13 -0
- package/android/.idea/libraries/Gradle__com_squareup_okio_okio_1_15_0.xml +13 -0
- package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/modules/android.iml +114 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +75 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/local.properties +8 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativecashfreepgapi/CashfreePgApiModule.java +80 -0
- package/android/src/main/java/com/reactnativecashfreepgapi/CashfreePgApiPackage.java +28 -0
- package/android/src/main/java/com/reactnativecashfreepgapi/DropPaymentParser.java +54 -0
- package/ios/CashfreeEmitter.swift +36 -0
- package/ios/CashfreeEventEmitter.m +16 -0
- package/ios/CashfreeEventEmitter.swift +24 -0
- package/ios/CashfreePgApi-Bridging-Header.h +5 -0
- package/ios/CashfreePgApi.m +10 -0
- package/ios/CashfreePgApi.swift +165 -0
- package/ios/CashfreePgApi.xcodeproj/project.pbxproj +293 -0
- package/ios/CashfreePgApi.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/lib/commonjs/index.js +116 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +105 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/index.d.ts +27 -0
- package/package.json +150 -0
- package/react-native-cashfree-pg-api.podspec +20 -0
- package/src/index.js +86 -0
- package/src/index.tsx +128 -0
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
// !$*UTF8*$!
|
|
2
|
+
{
|
|
3
|
+
archiveVersion = 1;
|
|
4
|
+
classes = {
|
|
5
|
+
};
|
|
6
|
+
objectVersion = 46;
|
|
7
|
+
objects = {
|
|
8
|
+
|
|
9
|
+
/* Begin PBXBuildFile section */
|
|
10
|
+
|
|
11
|
+
5E555C0D2413F4C50049A1A2 /* CashfreePgApi.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* CashfreePgApi.m */; };
|
|
12
|
+
F4FF95D7245B92E800C19C63 /* CashfreePgApi.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4FF95D6245B92E800C19C63 /* CashfreePgApi.swift */; };
|
|
13
|
+
|
|
14
|
+
/* End PBXBuildFile section */
|
|
15
|
+
|
|
16
|
+
/* Begin PBXCopyFilesBuildPhase section */
|
|
17
|
+
58B511D91A9E6C8500147676 /* CopyFiles */ = {
|
|
18
|
+
isa = PBXCopyFilesBuildPhase;
|
|
19
|
+
buildActionMask = 2147483647;
|
|
20
|
+
dstPath = "include/$(PRODUCT_NAME)";
|
|
21
|
+
dstSubfolderSpec = 16;
|
|
22
|
+
files = (
|
|
23
|
+
);
|
|
24
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
25
|
+
};
|
|
26
|
+
/* End PBXCopyFilesBuildPhase section */
|
|
27
|
+
|
|
28
|
+
/* Begin PBXFileReference section */
|
|
29
|
+
134814201AA4EA6300B7C361 /* libCashfreePgApi.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCashfreePgApi.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
30
|
+
|
|
31
|
+
B3E7B5891CC2AC0600A0062D /* CashfreePgApi.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CashfreePgApi.m; sourceTree = "<group>"; };
|
|
32
|
+
F4FF95D5245B92E700C19C63 /* CashfreePgApi-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CashfreePgApi-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
33
|
+
F4FF95D6245B92E800C19C63 /* CashfreePgApi.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CashfreePgApi.swift; sourceTree = "<group>"; };
|
|
34
|
+
|
|
35
|
+
/* End PBXFileReference section */
|
|
36
|
+
|
|
37
|
+
/* Begin PBXFrameworksBuildPhase section */
|
|
38
|
+
58B511D81A9E6C8500147676 /* Frameworks */ = {
|
|
39
|
+
isa = PBXFrameworksBuildPhase;
|
|
40
|
+
buildActionMask = 2147483647;
|
|
41
|
+
files = (
|
|
42
|
+
);
|
|
43
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
44
|
+
};
|
|
45
|
+
/* End PBXFrameworksBuildPhase section */
|
|
46
|
+
|
|
47
|
+
/* Begin PBXGroup section */
|
|
48
|
+
134814211AA4EA7D00B7C361 /* Products */ = {
|
|
49
|
+
isa = PBXGroup;
|
|
50
|
+
children = (
|
|
51
|
+
134814201AA4EA6300B7C361 /* libCashfreePgApi.a */,
|
|
52
|
+
);
|
|
53
|
+
name = Products;
|
|
54
|
+
sourceTree = "<group>";
|
|
55
|
+
};
|
|
56
|
+
58B511D21A9E6C8500147676 = {
|
|
57
|
+
isa = PBXGroup;
|
|
58
|
+
children = (
|
|
59
|
+
|
|
60
|
+
F4FF95D6245B92E800C19C63 /* CashfreePgApi.swift */,
|
|
61
|
+
B3E7B5891CC2AC0600A0062D /* CashfreePgApi.m */,
|
|
62
|
+
F4FF95D5245B92E700C19C63 /* CashfreePgApi-Bridging-Header.h */,
|
|
63
|
+
|
|
64
|
+
134814211AA4EA7D00B7C361 /* Products */,
|
|
65
|
+
);
|
|
66
|
+
sourceTree = "<group>";
|
|
67
|
+
};
|
|
68
|
+
/* End PBXGroup section */
|
|
69
|
+
|
|
70
|
+
/* Begin PBXNativeTarget section */
|
|
71
|
+
58B511DA1A9E6C8500147676 /* CashfreePgApi */ = {
|
|
72
|
+
isa = PBXNativeTarget;
|
|
73
|
+
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CashfreePgApi" */;
|
|
74
|
+
buildPhases = (
|
|
75
|
+
58B511D71A9E6C8500147676 /* Sources */,
|
|
76
|
+
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
77
|
+
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
78
|
+
);
|
|
79
|
+
buildRules = (
|
|
80
|
+
);
|
|
81
|
+
dependencies = (
|
|
82
|
+
);
|
|
83
|
+
name = CashfreePgApi;
|
|
84
|
+
productName = RCTDataManager;
|
|
85
|
+
productReference = 134814201AA4EA6300B7C361 /* libCashfreePgApi.a */;
|
|
86
|
+
productType = "com.apple.product-type.library.static";
|
|
87
|
+
};
|
|
88
|
+
/* End PBXNativeTarget section */
|
|
89
|
+
|
|
90
|
+
/* Begin PBXProject section */
|
|
91
|
+
58B511D31A9E6C8500147676 /* Project object */ = {
|
|
92
|
+
isa = PBXProject;
|
|
93
|
+
attributes = {
|
|
94
|
+
LastUpgradeCheck = 0920;
|
|
95
|
+
ORGANIZATIONNAME = Facebook;
|
|
96
|
+
TargetAttributes = {
|
|
97
|
+
58B511DA1A9E6C8500147676 = {
|
|
98
|
+
CreatedOnToolsVersion = 6.1.1;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CashfreePgApi" */;
|
|
103
|
+
compatibilityVersion = "Xcode 3.2";
|
|
104
|
+
developmentRegion = English;
|
|
105
|
+
hasScannedForEncodings = 0;
|
|
106
|
+
knownRegions = (
|
|
107
|
+
English,
|
|
108
|
+
en,
|
|
109
|
+
);
|
|
110
|
+
mainGroup = 58B511D21A9E6C8500147676;
|
|
111
|
+
productRefGroup = 58B511D21A9E6C8500147676;
|
|
112
|
+
projectDirPath = "";
|
|
113
|
+
projectRoot = "";
|
|
114
|
+
targets = (
|
|
115
|
+
58B511DA1A9E6C8500147676 /* CashfreePgApi */,
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
/* End PBXProject section */
|
|
119
|
+
|
|
120
|
+
/* Begin PBXSourcesBuildPhase section */
|
|
121
|
+
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
122
|
+
isa = PBXSourcesBuildPhase;
|
|
123
|
+
buildActionMask = 2147483647;
|
|
124
|
+
files = (
|
|
125
|
+
|
|
126
|
+
F4FF95D7245B92E800C19C63 /* CashfreePgApi.swift in Sources */,
|
|
127
|
+
B3E7B58A1CC2AC0600A0062D /* CashfreePgApi.m in Sources */,
|
|
128
|
+
|
|
129
|
+
);
|
|
130
|
+
runOnlyForDeploymentPostprocessing = 0;
|
|
131
|
+
};
|
|
132
|
+
/* End PBXSourcesBuildPhase section */
|
|
133
|
+
|
|
134
|
+
/* Begin XCBuildConfiguration section */
|
|
135
|
+
58B511ED1A9E6C8500147676 /* Debug */ = {
|
|
136
|
+
isa = XCBuildConfiguration;
|
|
137
|
+
buildSettings = {
|
|
138
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
139
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
140
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
141
|
+
CLANG_ENABLE_MODULES = YES;
|
|
142
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
143
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
144
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
145
|
+
CLANG_WARN_COMMA = YES;
|
|
146
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
147
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
148
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
149
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
150
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
151
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
152
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
153
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
154
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
155
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
156
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
157
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
158
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
159
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
160
|
+
COPY_PHASE_STRIP = NO;
|
|
161
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
162
|
+
ENABLE_TESTABILITY = YES;
|
|
163
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
164
|
+
GCC_DYNAMIC_NO_PIC = NO;
|
|
165
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
166
|
+
GCC_OPTIMIZATION_LEVEL = 0;
|
|
167
|
+
GCC_PREPROCESSOR_DEFINITIONS = (
|
|
168
|
+
"DEBUG=1",
|
|
169
|
+
"$(inherited)",
|
|
170
|
+
);
|
|
171
|
+
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
|
172
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
173
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
174
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
175
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
176
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
177
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
178
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
179
|
+
MTL_ENABLE_DEBUG_INFO = YES;
|
|
180
|
+
ONLY_ACTIVE_ARCH = YES;
|
|
181
|
+
SDKROOT = iphoneos;
|
|
182
|
+
};
|
|
183
|
+
name = Debug;
|
|
184
|
+
};
|
|
185
|
+
58B511EE1A9E6C8500147676 /* Release */ = {
|
|
186
|
+
isa = XCBuildConfiguration;
|
|
187
|
+
buildSettings = {
|
|
188
|
+
ALWAYS_SEARCH_USER_PATHS = NO;
|
|
189
|
+
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
|
190
|
+
CLANG_CXX_LIBRARY = "libc++";
|
|
191
|
+
CLANG_ENABLE_MODULES = YES;
|
|
192
|
+
CLANG_ENABLE_OBJC_ARC = YES;
|
|
193
|
+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
|
194
|
+
CLANG_WARN_BOOL_CONVERSION = YES;
|
|
195
|
+
CLANG_WARN_COMMA = YES;
|
|
196
|
+
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
|
197
|
+
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
|
198
|
+
CLANG_WARN_EMPTY_BODY = YES;
|
|
199
|
+
CLANG_WARN_ENUM_CONVERSION = YES;
|
|
200
|
+
CLANG_WARN_INFINITE_RECURSION = YES;
|
|
201
|
+
CLANG_WARN_INT_CONVERSION = YES;
|
|
202
|
+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
|
203
|
+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
|
204
|
+
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
|
205
|
+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
|
206
|
+
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
|
207
|
+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
|
208
|
+
CLANG_WARN_UNREACHABLE_CODE = YES;
|
|
209
|
+
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
|
210
|
+
COPY_PHASE_STRIP = YES;
|
|
211
|
+
ENABLE_NS_ASSERTIONS = NO;
|
|
212
|
+
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
|
213
|
+
GCC_C_LANGUAGE_STANDARD = gnu99;
|
|
214
|
+
GCC_NO_COMMON_BLOCKS = YES;
|
|
215
|
+
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
|
216
|
+
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
|
217
|
+
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
|
218
|
+
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
|
219
|
+
GCC_WARN_UNUSED_FUNCTION = YES;
|
|
220
|
+
GCC_WARN_UNUSED_VARIABLE = YES;
|
|
221
|
+
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
|
222
|
+
MTL_ENABLE_DEBUG_INFO = NO;
|
|
223
|
+
SDKROOT = iphoneos;
|
|
224
|
+
VALIDATE_PRODUCT = YES;
|
|
225
|
+
};
|
|
226
|
+
name = Release;
|
|
227
|
+
};
|
|
228
|
+
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
229
|
+
isa = XCBuildConfiguration;
|
|
230
|
+
buildSettings = {
|
|
231
|
+
HEADER_SEARCH_PATHS = (
|
|
232
|
+
"$(inherited)",
|
|
233
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
234
|
+
"$(SRCROOT)/../../../React/**",
|
|
235
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
236
|
+
);
|
|
237
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
238
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
239
|
+
PRODUCT_NAME = CashfreePgApi;
|
|
240
|
+
SKIP_INSTALL = YES;
|
|
241
|
+
|
|
242
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CashfreePgApi-Bridging-Header.h";
|
|
243
|
+
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
|
244
|
+
SWIFT_VERSION = 5.0;
|
|
245
|
+
|
|
246
|
+
};
|
|
247
|
+
name = Debug;
|
|
248
|
+
};
|
|
249
|
+
58B511F11A9E6C8500147676 /* Release */ = {
|
|
250
|
+
isa = XCBuildConfiguration;
|
|
251
|
+
buildSettings = {
|
|
252
|
+
HEADER_SEARCH_PATHS = (
|
|
253
|
+
"$(inherited)",
|
|
254
|
+
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
|
|
255
|
+
"$(SRCROOT)/../../../React/**",
|
|
256
|
+
"$(SRCROOT)/../../react-native/React/**",
|
|
257
|
+
);
|
|
258
|
+
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
|
259
|
+
OTHER_LDFLAGS = "-ObjC";
|
|
260
|
+
PRODUCT_NAME = CashfreePgApi;
|
|
261
|
+
SKIP_INSTALL = YES;
|
|
262
|
+
|
|
263
|
+
SWIFT_OBJC_BRIDGING_HEADER = "CashfreePgApi-Bridging-Header.h";
|
|
264
|
+
SWIFT_VERSION = 5.0;
|
|
265
|
+
|
|
266
|
+
};
|
|
267
|
+
name = Release;
|
|
268
|
+
};
|
|
269
|
+
/* End XCBuildConfiguration section */
|
|
270
|
+
|
|
271
|
+
/* Begin XCConfigurationList section */
|
|
272
|
+
58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "CashfreePgApi" */ = {
|
|
273
|
+
isa = XCConfigurationList;
|
|
274
|
+
buildConfigurations = (
|
|
275
|
+
58B511ED1A9E6C8500147676 /* Debug */,
|
|
276
|
+
58B511EE1A9E6C8500147676 /* Release */,
|
|
277
|
+
);
|
|
278
|
+
defaultConfigurationIsVisible = 0;
|
|
279
|
+
defaultConfigurationName = Release;
|
|
280
|
+
};
|
|
281
|
+
58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "CashfreePgApi" */ = {
|
|
282
|
+
isa = XCConfigurationList;
|
|
283
|
+
buildConfigurations = (
|
|
284
|
+
58B511F01A9E6C8500147676 /* Debug */,
|
|
285
|
+
58B511F11A9E6C8500147676 /* Release */,
|
|
286
|
+
);
|
|
287
|
+
defaultConfigurationIsVisible = 0;
|
|
288
|
+
defaultConfigurationName = Release;
|
|
289
|
+
};
|
|
290
|
+
/* End XCConfigurationList section */
|
|
291
|
+
};
|
|
292
|
+
rootObject = 58B511D31A9E6C8500147676 /* Project object */;
|
|
293
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CFPaymentGatewayService = exports.CFErrorResponse = void 0;
|
|
7
|
+
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
|
|
12
|
+
const LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
13
|
+
ios: "- You have run 'pod install'\n",
|
|
14
|
+
default: ''
|
|
15
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
16
|
+
const CashfreePgApi = _reactNative.NativeModules.CashfreePgApi ? _reactNative.NativeModules.CashfreePgApi : new Proxy({}, {
|
|
17
|
+
get() {
|
|
18
|
+
throw new Error(LINKING_ERROR);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}); // noinspection JSVoidFunctionReturnValueUsed,TypeScriptValidateJSTypes
|
|
22
|
+
|
|
23
|
+
class CFPaymentGateway {
|
|
24
|
+
constructor() {
|
|
25
|
+
_defineProperty(this, "emitter", void 0);
|
|
26
|
+
|
|
27
|
+
_defineProperty(this, "successSubscription", null);
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "failureSubscription", null);
|
|
30
|
+
|
|
31
|
+
this.emitter = _reactNative.Platform.OS === 'ios' ? new _reactNative.NativeEventEmitter(_reactNative.NativeModules.CashfreeEventEmitter) : _reactNative.NativeAppEventEmitter;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
doPayment(checkoutPayment) {
|
|
35
|
+
return CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
setCallback(cfCallback) {
|
|
39
|
+
// this.cfCallback = cfCallback;
|
|
40
|
+
let successFunction = orderID => {
|
|
41
|
+
console.log('response is : ' + JSON.stringify(orderID));
|
|
42
|
+
cfCallback.onVerify(orderID);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
let failureFunction = error => {
|
|
46
|
+
console.log('reason: ' + JSON.stringify(error));
|
|
47
|
+
const response = new CFErrorResponse(); // @ts-ignore
|
|
48
|
+
|
|
49
|
+
const message = JSON.parse(error);
|
|
50
|
+
response.fromJSON(message.error); // @ts-ignore
|
|
51
|
+
|
|
52
|
+
cfCallback.onError(response, message.orderID);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);
|
|
56
|
+
this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);
|
|
57
|
+
CashfreePgApi.setCallback();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
removeCallback() {
|
|
61
|
+
if (this.successSubscription !== undefined && this.successSubscription !== null) {
|
|
62
|
+
this.emitter.removeSubscription(this.successSubscription);
|
|
63
|
+
this.successSubscription = null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (this.failureSubscription !== undefined && this.failureSubscription !== null) {
|
|
67
|
+
this.emitter.removeSubscription(this.failureSubscription);
|
|
68
|
+
this.failureSubscription = null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class CFErrorResponse {
|
|
75
|
+
constructor() {
|
|
76
|
+
_defineProperty(this, "status", 'FAILED');
|
|
77
|
+
|
|
78
|
+
_defineProperty(this, "message", 'payment has failed');
|
|
79
|
+
|
|
80
|
+
_defineProperty(this, "code", 'payment_failed');
|
|
81
|
+
|
|
82
|
+
_defineProperty(this, "type", 'request_failed');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
fromJSON(errorString) {
|
|
86
|
+
console.log('errorString :' + errorString);
|
|
87
|
+
const object = JSON.parse(errorString);
|
|
88
|
+
console.log('errorStringObject :' + object);
|
|
89
|
+
this.status = object.status;
|
|
90
|
+
this.message = object.message;
|
|
91
|
+
this.code = object.code;
|
|
92
|
+
this.type = object.type;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getStatus() {
|
|
96
|
+
return this.status;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getMessage() {
|
|
100
|
+
return this.message;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
getCode() {
|
|
104
|
+
return this.code;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
getType() {
|
|
108
|
+
return this.type;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.CFErrorResponse = CFErrorResponse;
|
|
114
|
+
var CFPaymentGatewayService = new CFPaymentGateway();
|
|
115
|
+
exports.CFPaymentGatewayService = CFPaymentGatewayService;
|
|
116
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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","JSON","stringify","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","parse","fromJSON","onError","successSubscription","addListener","failureSubscription","removeCallback","undefined","removeSubscription","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.tsx"],"sourcesContent":["import {\n EmitterSubscription,\n EventEmitter,\n NativeAppEventEmitter,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\nimport type { CheckoutPayment } from 'cashfree-pg-api-contract';\n\nconst LINKING_ERROR =\n `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';\n\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\n// noinspection JSVoidFunctionReturnValueUsed,TypeScriptValidateJSTypes\nclass CFPaymentGateway {\n private emitter: EventEmitter;\n private successSubscription: EmitterSubscription | null = null;\n private failureSubscription: EmitterSubscription | null = null;\n\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n\n doPayment(checkoutPayment: CheckoutPayment) {\n return CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n\n setCallback(cfCallback: CFCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID: string) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error: string) => {\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(\n 'cfSuccess',\n successFunction\n );\n this.failureSubscription = this.emitter.addListener(\n 'cfFailure',\n failureFunction\n );\n CashfreePgApi.setCallback();\n }\n\n removeCallback() {\n if (\n this.successSubscription !== undefined &&\n this.successSubscription !== null\n ) {\n this.emitter.removeSubscription(this.successSubscription);\n this.successSubscription = null;\n }\n if (\n this.failureSubscription !== undefined &&\n this.failureSubscription !== null\n ) {\n this.emitter.removeSubscription(this.failureSubscription);\n this.failureSubscription = null;\n }\n }\n}\n\nexport interface CFCallback {\n onVerify(orderID: string): void;\n\n onError(error: CFErrorResponse, orderID: string): void;\n}\n\nexport class CFErrorResponse {\n private status: string = 'FAILED';\n private message: string = 'payment has failed';\n private code: string = 'payment_failed';\n private type: string = 'request_failed';\n\n fromJSON(errorString: string) {\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\n getStatus(): string {\n return this.status;\n }\n\n getMessage(): string {\n return this.message;\n }\n\n getCode(): string {\n return this.code;\n }\n\n getType(): string {\n return this.type;\n }\n}\n\nexport var CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;;;;;;AAAA;;;;AAUA,MAAMA,aAAa,GAChB,uFAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGC,0BAAA,CAAcD,aAAd,GAClBC,0BAAA,CAAcD,aADI,GAElB,IAAIE,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUT,aAAV,CAAN;EACD;;AAHH,CAFF,CAFJ,C,CAWA;;AACA,MAAMU,gBAAN,CAAuB;EAKrBC,WAAW,GAAG;IAAA;;IAAA,6CAH4C,IAG5C;;IAAA,6CAF4C,IAE5C;;IACZ,KAAKC,OAAL,GACEX,qBAAA,CAASY,EAAT,KAAgB,KAAhB,GACI,IAAIC,+BAAJ,CAAuBR,0BAAA,CAAcS,oBAArC,CADJ,GAEIC,kCAHN;EAID;;EAEDC,SAAS,CAACC,eAAD,EAAmC;IAC1C,OAAOb,aAAa,CAACY,SAAd,CAAwBE,IAAI,CA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DoB;;AAkEhB,MAAMP,eAAN,CAAsB;EAAA;IAAA,gCACF,QADE;;IAAA,iCAED,oBAFC;;IAAA,8BAGJ,gBAHI;;IAAA,8BAIJ,gBAJI;EAAA;;EAM3BG,QAAQ,CAACQ,WAAD,EAAsB;IAC5BjB,OAAO,CAACC,GAAR,CAAY,kBAAkBgB,WAA9B;IACA,MAAMC,MAAM,GAAGxB,IAAI,CAACc,KAAL,CAAWS,WAAX,CAAf;IACAjB,OAAO,CAACC,GAAR,CAAY,wBAAwBiB,MAApC;IACA,KAAKC,MAAL,GAAcD,MAAM,CAACC,MAArB;IACA,KAAKZ,OAAL,GAAeW,MAAM,CAACX,OAAtB;IACA,KAAKa,IAAL,GAAYF,MAAM,CAACE,IAAnB;IACA,KAAKC,IAAL,GAAYH,MAAM,CAACG,IAAnB;EACD;;EAEDC,SAAS,GAAW;IAClB,OAAO,KAAKH,MAAZ;EACD;;EAEDI,UAAU,GAAW;IACnB,OAAO,KAAKhB,OAAZ;EACD;;EAEDiB,OAAO,GAAW;IAChB,OAAO,KAAKJ,IAAZ;EACD;;EAEDK,OAAO,GAAW;IAChB,OAAO,KAAKJ,IAAZ;EACD;;AA9B0B;;;AAiCtB,IAAIK,uBAAuB,GAAG,IAAIzC,gBAAJ,EAA9B"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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
|
+
|
|
3
|
+
import { NativeAppEventEmitter, NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
4
|
+
const LINKING_ERROR = `The package 'react-native-cashfree-pg-api' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
5
|
+
ios: "- You have run 'pod install'\n",
|
|
6
|
+
default: ''
|
|
7
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
8
|
+
const CashfreePgApi = NativeModules.CashfreePgApi ? NativeModules.CashfreePgApi : new Proxy({}, {
|
|
9
|
+
get() {
|
|
10
|
+
throw new Error(LINKING_ERROR);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
}); // noinspection JSVoidFunctionReturnValueUsed,TypeScriptValidateJSTypes
|
|
14
|
+
|
|
15
|
+
class CFPaymentGateway {
|
|
16
|
+
constructor() {
|
|
17
|
+
_defineProperty(this, "emitter", void 0);
|
|
18
|
+
|
|
19
|
+
_defineProperty(this, "successSubscription", null);
|
|
20
|
+
|
|
21
|
+
_defineProperty(this, "failureSubscription", null);
|
|
22
|
+
|
|
23
|
+
this.emitter = Platform.OS === 'ios' ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter) : NativeAppEventEmitter;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
doPayment(checkoutPayment) {
|
|
27
|
+
return CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
setCallback(cfCallback) {
|
|
31
|
+
// this.cfCallback = cfCallback;
|
|
32
|
+
let successFunction = orderID => {
|
|
33
|
+
console.log('response is : ' + JSON.stringify(orderID));
|
|
34
|
+
cfCallback.onVerify(orderID);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let failureFunction = error => {
|
|
38
|
+
console.log('reason: ' + JSON.stringify(error));
|
|
39
|
+
const response = new CFErrorResponse(); // @ts-ignore
|
|
40
|
+
|
|
41
|
+
const message = JSON.parse(error);
|
|
42
|
+
response.fromJSON(message.error); // @ts-ignore
|
|
43
|
+
|
|
44
|
+
cfCallback.onError(response, message.orderID);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
this.successSubscription = this.emitter.addListener('cfSuccess', successFunction);
|
|
48
|
+
this.failureSubscription = this.emitter.addListener('cfFailure', failureFunction);
|
|
49
|
+
CashfreePgApi.setCallback();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
removeCallback() {
|
|
53
|
+
if (this.successSubscription !== undefined && this.successSubscription !== null) {
|
|
54
|
+
this.emitter.removeSubscription(this.successSubscription);
|
|
55
|
+
this.successSubscription = null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (this.failureSubscription !== undefined && this.failureSubscription !== null) {
|
|
59
|
+
this.emitter.removeSubscription(this.failureSubscription);
|
|
60
|
+
this.failureSubscription = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class CFErrorResponse {
|
|
67
|
+
constructor() {
|
|
68
|
+
_defineProperty(this, "status", 'FAILED');
|
|
69
|
+
|
|
70
|
+
_defineProperty(this, "message", 'payment has failed');
|
|
71
|
+
|
|
72
|
+
_defineProperty(this, "code", 'payment_failed');
|
|
73
|
+
|
|
74
|
+
_defineProperty(this, "type", 'request_failed');
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
fromJSON(errorString) {
|
|
78
|
+
console.log('errorString :' + errorString);
|
|
79
|
+
const object = JSON.parse(errorString);
|
|
80
|
+
console.log('errorStringObject :' + object);
|
|
81
|
+
this.status = object.status;
|
|
82
|
+
this.message = object.message;
|
|
83
|
+
this.code = object.code;
|
|
84
|
+
this.type = object.type;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getStatus() {
|
|
88
|
+
return this.status;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
getMessage() {
|
|
92
|
+
return this.message;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getCode() {
|
|
96
|
+
return this.code;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
getType() {
|
|
100
|
+
return this.type;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
}
|
|
104
|
+
export var CFPaymentGatewayService = new CFPaymentGateway();
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeAppEventEmitter","NativeEventEmitter","NativeModules","Platform","LINKING_ERROR","select","ios","default","CashfreePgApi","Proxy","get","Error","CFPaymentGateway","constructor","emitter","OS","CashfreeEventEmitter","doPayment","checkoutPayment","JSON","stringify","setCallback","cfCallback","successFunction","orderID","console","log","onVerify","failureFunction","error","response","CFErrorResponse","message","parse","fromJSON","onError","successSubscription","addListener","failureSubscription","removeCallback","undefined","removeSubscription","errorString","object","status","code","type","getStatus","getMessage","getCode","getType","CFPaymentGatewayService"],"sources":["index.tsx"],"sourcesContent":["import {\n EmitterSubscription,\n EventEmitter,\n NativeAppEventEmitter,\n NativeEventEmitter,\n NativeModules,\n Platform,\n} from 'react-native';\nimport type { CheckoutPayment } from 'cashfree-pg-api-contract';\n\nconst LINKING_ERROR =\n `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';\n\nconst CashfreePgApi = NativeModules.CashfreePgApi\n ? NativeModules.CashfreePgApi\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\n// noinspection JSVoidFunctionReturnValueUsed,TypeScriptValidateJSTypes\nclass CFPaymentGateway {\n private emitter: EventEmitter;\n private successSubscription: EmitterSubscription | null = null;\n private failureSubscription: EmitterSubscription | null = null;\n\n constructor() {\n this.emitter =\n Platform.OS === 'ios'\n ? new NativeEventEmitter(NativeModules.CashfreeEventEmitter)\n : NativeAppEventEmitter;\n }\n\n doPayment(checkoutPayment: CheckoutPayment) {\n return CashfreePgApi.doPayment(JSON.stringify(checkoutPayment));\n }\n\n setCallback(cfCallback: CFCallback) {\n // this.cfCallback = cfCallback;\n let successFunction = (orderID: string) => {\n console.log('response is : ' + JSON.stringify(orderID));\n cfCallback.onVerify(orderID);\n };\n let failureFunction = (error: string) => {\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(\n 'cfSuccess',\n successFunction\n );\n this.failureSubscription = this.emitter.addListener(\n 'cfFailure',\n failureFunction\n );\n CashfreePgApi.setCallback();\n }\n\n removeCallback() {\n if (\n this.successSubscription !== undefined &&\n this.successSubscription !== null\n ) {\n this.emitter.removeSubscription(this.successSubscription);\n this.successSubscription = null;\n }\n if (\n this.failureSubscription !== undefined &&\n this.failureSubscription !== null\n ) {\n this.emitter.removeSubscription(this.failureSubscription);\n this.failureSubscription = null;\n }\n }\n}\n\nexport interface CFCallback {\n onVerify(orderID: string): void;\n\n onError(error: CFErrorResponse, orderID: string): void;\n}\n\nexport class CFErrorResponse {\n private status: string = 'FAILED';\n private message: string = 'payment has failed';\n private code: string = 'payment_failed';\n private type: string = 'request_failed';\n\n fromJSON(errorString: string) {\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\n getStatus(): string {\n return this.status;\n }\n\n getMessage(): string {\n return this.message;\n }\n\n getCode(): string {\n return this.code;\n }\n\n getType(): string {\n return this.type;\n }\n}\n\nexport var CFPaymentGatewayService = new CFPaymentGateway();\n"],"mappings":";;AAAA,SAGEA,qBAHF,EAIEC,kBAJF,EAKEC,aALF,EAMEC,QANF,QAOO,cAPP;AAUA,MAAMC,aAAa,GAChB,uFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAMA,MAAMC,aAAa,GAAGN,aAAa,CAACM,aAAd,GAClBN,aAAa,CAACM,aADI,GAElB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUP,aAAV,CAAN;EACD;;AAHH,CAFF,C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ateway {
|
|
3
|
+
private emitter;
|
|
4
|
+
private successSubscription;
|
|
5
|
+
private failureSubscription;
|
|
6
|
+
constructor();
|
|
7
|
+
doPayment(checkoutPayment: CheckoutPayment): any;
|
|
8
|
+
setCallback(cfCallback: CFCallback): void;
|
|
9
|
+
removeCallback(): void;
|
|
10
|
+
}
|
|
11
|
+
export interface CFCallback {
|
|
12
|
+
onVerify(orderID: string): void;
|
|
13
|
+
onError(error: CFErrorResponse, orderID: string): void;
|
|
14
|
+
}
|
|
15
|
+
export declare class CFErrorResponse {
|
|
16
|
+
private status;
|
|
17
|
+
private message;
|
|
18
|
+
private code;
|
|
19
|
+
private type;
|
|
20
|
+
fromJSON(errorString: string): void;
|
|
21
|
+
getStatus(): string;
|
|
22
|
+
getMessage(): string;
|
|
23
|
+
getCode(): string;
|
|
24
|
+
getType(): string;
|
|
25
|
+
}
|
|
26
|
+
export declare var CFPaymentGatewayService: CFPaymentGateway;
|
|
27
|
+
export {};
|