skipcash-reactnative 0.0.2

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 ADDED
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 SkipCash
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ of this software and associated documentation files (the "Software"), to deal
6
+ in the Software without restriction, including without limitation the rights
7
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is
9
+ furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,334 @@
1
+ # skipcash-reactnative
2
+
3
+ integrate skipcash in react native app.
4
+
5
+ ## Installation
6
+
7
+ ```sh
8
+ npm install skipcash-reactnative
9
+ ```
10
+
11
+ ## Usage
12
+
13
+
14
+
15
+ # Breif
16
+
17
+ SkipCash React Native Package; This package facilitates SkipCash integration within your ReacNative app.
18
+
19
+
20
+ # Example
21
+
22
+ ```jsx
23
+ import { useEffect, useState } from 'react';
24
+
25
+ import { StyleSheet, View, NativeEventEmitter, NativeModules, Platform, Alert } from 'react-native';
26
+ import { initiateApplePay, PaymentData, PaymentResponse,
27
+ isWalletHasCards, setupNewCard, initiatePaymentModel
28
+ } from 'skipcash-reactnative';
29
+
30
+ import { TextInput, Button, Title } from 'react-native-paper';
31
+
32
+
33
+ export default function App() {
34
+
35
+ const paymentData = new PaymentData();
36
+
37
+ const [firstName, setFirstName] = useState('');
38
+ const [lastName, setLastName] = useState('');
39
+ const [phone, setPhone] = useState('');
40
+ const [email, setEmail] = useState('');
41
+ const [amount, setAmount] = useState('');
42
+
43
+ /**********************************
44
+ - THIS PACKAGE PROVIDES TWO PAYMENT OPTIONS FOR YOUR CUSTOMER -
45
+ 1. IN-APP APPLE PAY using 'initiateApplePay()' function.
46
+ 2. IN-APP WEB VIEW (INCLUDES ALL PAYMENT OPTIONS THAT SKIPCASH OFFERS).
47
+ - THIS EXAMPLE APP, DEMONESTRATES HOW TO USE THE DIFFERENT OPTIONS MENTIONED ABOVE
48
+ ***********************************/
49
+
50
+ /*
51
+ Here In case if you want to implement IN-APP Apple Pay
52
+ you have to pass the name of the merchant identifier
53
+ (you need to create a new one from apple developer account of your app ).
54
+ please reachout to https://dev.skipcash.app/ mobile apple pay section to
55
+ know how to generate your merchant identifier and setup Xcode.
56
+ */
57
+
58
+ paymentData.setMerchantIdentifier("");
59
+ /*
60
+ Add your payment endpoint; You need to create an endpoint for your merchant account.
61
+ For more information on how to request a new payment, Please refer to https://dev.skipcash.app/doc/api-integration/.
62
+
63
+ You will need to implement this functionality on your backend server to create an endpoint that requests a new payment and returns the details you receive from the SkipCash server to this package. Of course your endpoint will receive the customer's details from this package request, Upon receiving the details response from your server this package will use that details to process your customer's payment via Apple Pay.
64
+
65
+ Once you have completed setting up and testing your endpoint, please provide the link to the setPaymentLinkEndPoint below.
66
+ */
67
+ paymentData.setPaymentLinkEndPoint("")
68
+ paymentData.setAuthorizationHeader("");
69
+ /* add authorizartion header; used to protect your endpoint from unathorized access */
70
+
71
+ useEffect(() => {
72
+ // subscriptions list: Holds the events subscriptions to receive data from native side.
73
+ const subscriptions: any = [];
74
+
75
+ if(Platform.OS === 'android'){
76
+ // for payment page response
77
+ subscriptions.push(new NativeEventEmitter().addListener(
78
+ 'responseScPaymentData',
79
+ (paymentResponse: any) => {
80
+ console.log(paymentResponse); // json
81
+ /*
82
+ Handle payment response here...
83
+ */
84
+ }
85
+ ));
86
+ }else if(Platform.OS === 'ios'){
87
+ // for payment page response
88
+ subscriptions.push(new NativeEventEmitter(NativeModules.SkipcashReactnative).addListener(
89
+ 'responseScPaymentData',
90
+ (paymentResponse: any) => {
91
+ console.log(paymentResponse); // json
92
+ }
93
+ ));
94
+
95
+ // For In-App Apple Pay
96
+ subscriptions.push(new NativeEventEmitter(NativeModules.SkipcashReactnative).addListener(
97
+ 'applepay_response',
98
+ (paymentResponse: any) => {
99
+ console.log(paymentResponse); // json
100
+
101
+ let response: PaymentResponse = PaymentResponse.fromJson(paymentResponse);
102
+
103
+
104
+ Alert.alert(`isSuccess: ${response.isSuccess} | transactionId: ${response.transactionId} | PaymentID: ${response.paymentId}
105
+ | returnCode: ${response.returnCode} | errorMessage: ${response.errorMessage}`);
106
+
107
+ /*
108
+ Handle payment response here...
109
+ you can get the payment details using the payment id after successful payment request.
110
+ send a GET request to SkipCash server `/api/v1/payments/${response.paymentId}`
111
+ and include your merchant - client id in the authorization header request to get
112
+ the payment details.
113
+ for more details please refer to https://dev.skipcash.app/doc/api-integration/
114
+ */
115
+ }
116
+ ));
117
+ }
118
+
119
+ return () => {
120
+ // cleaning up after leaving the current app view
121
+ new NativeEventEmitter().removeAllListeners("responseScPaymentData");
122
+ if(Platform.OS === 'ios'){
123
+ new NativeEventEmitter().removeAllListeners("applepay_response");
124
+ }
125
+ subscriptions.forEach((subscription: any) => subscription.remove());
126
+ };
127
+
128
+ }, []);
129
+
130
+ const initiateApplePayPayment = () => {
131
+ paymentData.setSummaryItem('Tax', '0.0'); // set summary item
132
+ paymentData.setSummaryItem('Total', amount); // set summary item
133
+
134
+ paymentData.setFirstName(firstName); // required
135
+ paymentData.setLastName(lastName); // required
136
+ paymentData.setPhone(phone); // required
137
+ paymentData.setEmail(email); // required
138
+ paymentData.setAmount(amount); // required
139
+ paymentData.setTransactionId(""); // your internal order id, (Optional) - but very much recommended
140
+ paymentData.setWebhookUrl(""); // very much recommended
141
+ paymentData.setMerchantName(""); /*
142
+ Required - (if using in-app apple-pay set your official merchant/business name for apple payment sheet)
143
+ this is required by apple, it must match your official name in appstore
144
+ */
145
+
146
+ /*
147
+ For more information about webhooks & transactionId (your internal order id) please
148
+ refer to https://dev.skipcash.app/doc/api-integration/
149
+ */
150
+
151
+ const paymentDataJson = JSON.stringify(paymentData); // convert paymentData to json string
152
+
153
+ if(firstName && lastName && phone && email) {
154
+ initiateApplePay(paymentDataJson);
155
+ }else{
156
+ Alert.alert("please fill firstname, lastname, phone, email & amount");
157
+ }
158
+ }
159
+
160
+ const startPaymentModel = () => {
161
+ paymentData.setFirstName(firstName); // required
162
+ paymentData.setLastName(lastName); // required
163
+ paymentData.setPhone(phone); // required
164
+ paymentData.setEmail(email); // required
165
+ paymentData.setAmount(amount); // required
166
+ paymentData.setTransactionId(""); /* Optional - but very much recommended
167
+ (it should be uniquely generated each time the function called).
168
+ */
169
+ paymentData.setPaymentModalTitle("Checkout") // WEB VIEW SCREEN TITLE
170
+ paymentData.setWebhookUrl("https://paymentsimulation-4f296ff7747c.herokuapp.com/api/webhookPost/"); // very much recommended
171
+ paymentData.setReturnUrl("https://paymentsimulation-4f296ff7747c.herokuapp.com/api/returnURLGoogle/") // required
172
+
173
+ // below are some options used to adjust the WEBVIEW SCREEN header
174
+ /*
175
+ For the colours please use the full hexadecimal representation
176
+ not the shorthand representation; cause it can make some issues.
177
+
178
+ example:
179
+ (full hex) #FFFFFF - white (CORRECT ✅)
180
+ (short hex) #FFF - white (INCORRECT ❌)
181
+
182
+ */
183
+ paymentData.setCancelBtnColour("#FFFFFF");
184
+ paymentData.setHeaderBackgroundColour("#017DFB");
185
+ paymentData.setPaymentModalTitle("TEST PAYMENT");
186
+ paymentData.setHeaderTitleColour("#FFFFFF");
187
+
188
+ if(firstName && lastName && phone && email && paymentData.getReturnUrl()) {
189
+ initiatePaymentModel(paymentData); // pass paymentData as object
190
+ }else{
191
+ Alert.alert("fill first&last name, phone, email, amount & return url ");
192
+ }
193
+ }
194
+
195
+ return (
196
+ <View style={styles.container}>
197
+ <Title style={styles.title}>Payment Details</Title>
198
+
199
+ <TextInput
200
+ mode="outlined"
201
+ label="First Name"
202
+ outlineColor='#017DFB'
203
+ selectionColor='#017DFB'
204
+ cursorColor='#017DFB'
205
+ placeholderTextColor={'#017DFB'}
206
+ activeOutlineColor='#017DFB'
207
+ underlineColor='#017DFB'
208
+ underlineColorAndroid={"#017DFB"}
209
+ value={firstName}
210
+ onChangeText={text => setFirstName(text)}
211
+ style={styles.input}
212
+ />
213
+ <TextInput
214
+ mode="outlined"
215
+ label="Last Name"
216
+ outlineColor='#017DFB'
217
+ selectionColor='#017DFB'
218
+ cursorColor='#017DFB'
219
+ placeholderTextColor={'#017DFB'}
220
+ activeOutlineColor='#017DFB'
221
+ underlineColor='#017DFB'
222
+ underlineColorAndroid={"#017DFB"}
223
+ value={lastName}
224
+ onChangeText={text => setLastName(text)}
225
+ style={styles.input}
226
+ />
227
+ <TextInput
228
+ mode="outlined"
229
+ label="Phone"
230
+ outlineColor='#017DFB'
231
+ selectionColor='#017DFB'
232
+ cursorColor='#017DFB'
233
+ placeholderTextColor={'#017DFB'}
234
+ activeOutlineColor='#017DFB'
235
+ underlineColor='#017DFB'
236
+ underlineColorAndroid={"#017DFB"}
237
+ value={phone}
238
+ onChangeText={text => setPhone(text)}
239
+ style={styles.input}
240
+ keyboardType="phone-pad"
241
+ />
242
+ <TextInput
243
+ mode="outlined"
244
+ label="Email"
245
+ outlineColor='#017DFB'
246
+ selectionColor='#017DFB'
247
+ cursorColor='#017DFB'
248
+ placeholderTextColor={'#017DFB'}
249
+ activeOutlineColor='#017DFB'
250
+ underlineColor='#017DFB'
251
+ underlineColorAndroid={"#017DFB"}
252
+ value={email}
253
+ onChangeText={text => setEmail(text)}
254
+ style={styles.input}
255
+ keyboardType="email-address"
256
+ />
257
+ <TextInput
258
+ mode="outlined"
259
+ label="Amount"
260
+ outlineColor='#017DFB'
261
+ selectionColor='#017DFB'
262
+ cursorColor='#017DFB'
263
+ placeholderTextColor={'#017DFB'}
264
+ activeOutlineColor='#017DFB'
265
+ underlineColor='#017DFB'
266
+ underlineColorAndroid={"#017DFB"}
267
+ value={amount}
268
+ onChangeText={text => setAmount(text)}
269
+ style={styles.input}
270
+ keyboardType="numeric"
271
+ />
272
+
273
+ <Button
274
+ mode="contained"
275
+ buttonColor='#017DFB'
276
+ rippleColor={"#017DFB"}
277
+ onPress={() => startPaymentModel()}
278
+ style={styles.button}
279
+ >
280
+ Pay via WebView
281
+ </Button>
282
+
283
+ <Button
284
+ mode="contained"
285
+ buttonColor='#017DFB'
286
+ rippleColor={"#017DFB"}
287
+ onPress={async () => {
288
+ const response = await isWalletHasCards();
289
+ response ? initiateApplePayPayment() : setupNewCard();
290
+ }}
291
+ style={styles.button}
292
+ >
293
+ Pay with Apple Pay
294
+ </Button>
295
+
296
+ <Button
297
+ mode="outlined"
298
+ textColor='#017DFB'
299
+ onPress={() => setupNewCard()}
300
+ style={styles.button}
301
+ >
302
+ Setup A Card
303
+ </Button>
304
+ </View>
305
+ );
306
+ }
307
+
308
+ const styles = StyleSheet.create({
309
+ container: {
310
+ flex: 1,
311
+ padding: 20,
312
+ justifyContent: 'center',
313
+ backgroundColor: '#f5f5f5',
314
+ },
315
+ title: {
316
+ fontSize: 24,
317
+ marginBottom: 20,
318
+ textAlign: 'center',
319
+ },
320
+ input: {
321
+ marginBottom: 10,
322
+ },
323
+ button: {
324
+ marginVertical: 10,
325
+ },
326
+ });
327
+ ```
328
+
329
+
330
+ ## License
331
+
332
+ MIT
333
+
334
+ ---
@@ -0,0 +1,183 @@
1
+ // buildscript {
2
+ // repositories {
3
+ // google()
4
+ // mavenCentral()
5
+ // }
6
+
7
+ // dependencies {
8
+ // classpath "com.android.tools.build:gradle:7.2.1"
9
+ // // Remove the Kotlin Gradle plugin dependency
10
+ // }
11
+ // }
12
+
13
+ // def reactNativeArchitectures() {
14
+ // def value = rootProject.getProperties().get("reactNativeArchitectures")
15
+ // return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
16
+ // }
17
+
18
+ // def isNewArchitectureEnabled() {
19
+ // return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
20
+ // }
21
+
22
+ // apply plugin: "com.android.library"
23
+
24
+ // if (isNewArchitectureEnabled()) {
25
+ // apply plugin: "com.facebook.react"
26
+ // }
27
+
28
+ // def supportsNamespace() {
29
+ // def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
30
+ // def major = parsed[0].toInteger()
31
+ // def minor = parsed[1].toInteger()
32
+
33
+ // // Namespace support was added in 7.3.0
34
+ // return (major == 7 && minor >= 3) || major >= 8
35
+ // }
36
+
37
+ // android {
38
+ // if (supportsNamespace()) {
39
+ // namespace "com.skipcashreactnative"
40
+
41
+ // sourceSets {
42
+ // main {
43
+ // manifest.srcFile "src/main/AndroidManifestNew.xml"
44
+ // }
45
+ // }
46
+ // }
47
+
48
+ // compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
49
+
50
+ // defaultConfig {
51
+ // minSdkVersion getExtOrIntegerDefault("minSdkVersion")
52
+ // targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
53
+ // }
54
+
55
+ // buildTypes {
56
+ // release {
57
+ // minifyEnabled false
58
+ // }
59
+ // }
60
+
61
+ // lintOptions {
62
+ // disable "GradleCompatible"
63
+ // }
64
+
65
+ // compileOptions {
66
+ // sourceCompatibility JavaVersion.VERSION_1_8
67
+ // targetCompatibility JavaVersion.VERSION_1_8
68
+ // }
69
+ // }
70
+
71
+ // repositories {
72
+ // mavenCentral()
73
+ // google()
74
+ // }
75
+
76
+ // dependencies {
77
+ // // For < 0.71, this will be from the local maven repo
78
+ // // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
79
+ // api "com.squareup.okhttp3:okhttp:4.12.0"
80
+ // implementation "com.facebook.react:react-native:+"
81
+ // // Remove the Kotlin standard library dependency
82
+ // }
83
+
84
+
85
+ buildscript {
86
+ // Buildscript is evaluated before everything else so we can't use getExtOrDefault
87
+ def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["SkipcashReactnative_kotlinVersion"]
88
+
89
+ repositories {
90
+ google()
91
+ mavenCentral()
92
+ }
93
+
94
+ dependencies {
95
+ classpath "com.android.tools.build:gradle:8.3.1"
96
+ // noinspection DifferentKotlinGradleVersion
97
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
98
+ }
99
+ }
100
+
101
+ def reactNativeArchitectures() {
102
+ def value = rootProject.getProperties().get("reactNativeArchitectures")
103
+ return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
104
+ }
105
+
106
+ def isNewArchitectureEnabled() {
107
+ return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
108
+ }
109
+
110
+ apply plugin: "com.android.library"
111
+ apply plugin: "kotlin-android"
112
+
113
+ if (isNewArchitectureEnabled()) {
114
+ apply plugin: "com.facebook.react"
115
+ }
116
+
117
+ def getExtOrDefault(name) {
118
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["SkipcashReactnative_" + name]
119
+ }
120
+
121
+ def getExtOrIntegerDefault(name) {
122
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["SkipcashReactnative_" + name]).toInteger()
123
+ }
124
+
125
+ def supportsNamespace() {
126
+ def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
127
+ def major = parsed[0].toInteger()
128
+ def minor = parsed[1].toInteger()
129
+
130
+ // Namespace support was added in 7.3.0
131
+ return (major == 7 && minor >= 3) || major >= 8
132
+ }
133
+
134
+ android {
135
+ if (supportsNamespace()) {
136
+ namespace "com.skipcashreactnative"
137
+
138
+ sourceSets {
139
+ main {
140
+ manifest.srcFile "src/main/AndroidManifestNew.xml"
141
+ }
142
+ }
143
+ }
144
+
145
+ compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
146
+
147
+ defaultConfig {
148
+ minSdkVersion getExtOrIntegerDefault("minSdkVersion")
149
+ targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
150
+
151
+ }
152
+
153
+ buildTypes {
154
+ release {
155
+ minifyEnabled false
156
+ }
157
+ }
158
+
159
+ lintOptions {
160
+ disable "GradleCompatible"
161
+ }
162
+
163
+ compileOptions {
164
+ sourceCompatibility JavaVersion.VERSION_1_8
165
+ targetCompatibility JavaVersion.VERSION_1_8
166
+ }
167
+ }
168
+
169
+ repositories {
170
+ mavenCentral()
171
+ google()
172
+ }
173
+
174
+ def kotlin_version = getExtOrDefault("kotlinVersion")
175
+
176
+ dependencies {
177
+ // For < 0.71, this will be from the local maven repo
178
+ // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
179
+ //noinspection GradleDynamicVersion
180
+ api "com.squareup.okhttp3:okhttp:4.12.0"
181
+ implementation "com.facebook.react:react-native:+"
182
+ implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
183
+ }
@@ -0,0 +1,5 @@
1
+ SkipcashReactnative_kotlinVersion=1.7.0
2
+ SkipcashReactnative_minSdkVersion=21
3
+ SkipcashReactnative_targetSdkVersion=31
4
+ SkipcashReactnative_compileSdkVersion=31
5
+ SkipcashReactnative_ndkversion=21.4.7075529
@@ -0,0 +1,3 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
+ package="com.skipcashreactnative">
3
+ </manifest>
@@ -0,0 +1,2 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+ </manifest>
@@ -0,0 +1,128 @@
1
+ package com.skipcashreactnative;
2
+
3
+ import android.content.Intent;
4
+ import android.os.Bundle;
5
+ import android.app.Activity;
6
+ import android.webkit.WebSettings;
7
+ import android.webkit.WebView;
8
+ import android.webkit.WebViewClient;
9
+ import android.view.View;
10
+ import android.graphics.Color;
11
+ import android.webkit.WebResourceRequest;
12
+
13
+ import android.net.Uri;
14
+ import android.util.Log;
15
+
16
+ import android.view.View;
17
+ import android.webkit.WebView;
18
+
19
+ import android.widget.ProgressBar;
20
+ import android.graphics.Bitmap;
21
+ import android.widget.RelativeLayout;
22
+ import android.widget.TextView;
23
+
24
+
25
+ public class ModalActivity extends Activity {
26
+
27
+ @Override
28
+ public void onBackPressed() {
29
+ //used to fire an event the response listener on framework side that payment was canceled.
30
+ String transactionId = getIntent().getStringExtra("transactionId");
31
+ SkipcashReactnativeModule.handleOnWebViewClose(transactionId);
32
+
33
+ super.onBackPressed();
34
+ overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
35
+ }
36
+
37
+ @Override
38
+ protected void onCreate(Bundle savedInstanceState) {
39
+ super.onCreate(savedInstanceState);
40
+ setContentView(R.layout.activity_modal);
41
+
42
+ RelativeLayout header = findViewById(R.id.header); // color
43
+ TextView header_title = findViewById(R.id.header_title); //color and text
44
+ TextView cancel_payment_btn = findViewById(R.id.cancel_payment_btn); // color
45
+ WebView webView = findViewById(R.id.webView);
46
+ ProgressBar loadingWebview = findViewById(R.id.loadingWebview);
47
+
48
+ String headerBackgroundColour = getIntent().getStringExtra("headerBackgroundColour");
49
+ String headerTitle = getIntent().getStringExtra("headerTitle");
50
+ String headerTitleColour = getIntent().getStringExtra("headerTitleColour");
51
+ String cancelColour = getIntent().getStringExtra("cancelColour");
52
+
53
+ header.setBackgroundColor(Color.parseColor(headerBackgroundColour));
54
+ header_title.setTextColor(Color.parseColor(headerTitleColour));
55
+ header_title.setText(headerTitle);
56
+ cancel_payment_btn.setTextColor(Color.parseColor(cancelColour));
57
+
58
+
59
+
60
+ cancel_payment_btn.setOnClickListener(new View.OnClickListener() {
61
+ @Override
62
+ public void onClick(View v) {
63
+ onBackPressed();
64
+ }
65
+ });
66
+
67
+ // Configure the WebView
68
+ WebSettings webSettings = webView.getSettings();
69
+ webSettings.setJavaScriptEnabled(true);
70
+ webSettings.setLoadWithOverviewMode(true);
71
+ webSettings.setUseWideViewPort(true);
72
+
73
+ webSettings.setJavaScriptEnabled(true);
74
+ webSettings.setLoadWithOverviewMode(true);
75
+ webSettings.setUseWideViewPort(false);
76
+ webSettings.setSupportZoom(true);
77
+ webSettings.setBuiltInZoomControls(false);
78
+ webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
79
+ webSettings.setCacheMode(WebSettings.LOAD_DEFAULT);
80
+ webSettings.setDomStorageEnabled(true);
81
+ webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
82
+
83
+ webView.setFocusable(true);
84
+ webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
85
+
86
+ String url = getIntent().getStringExtra("url");
87
+ String returnURL = getIntent().getStringExtra("returnURL");
88
+
89
+ webView.setWebViewClient(new WebViewClient() {
90
+ @Override
91
+ public void onPageStarted(WebView view, String url, Bitmap favicon) {
92
+ super.onPageStarted(view, url, favicon);
93
+ loadingWebview.setVisibility(View.VISIBLE); // Show progress bar
94
+ }
95
+
96
+ @Override
97
+ public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
98
+ String url = request.getUrl().toString();
99
+ if (url.contains(returnURL)) {
100
+ Uri uri = Uri.parse(url);
101
+ String id = uri.getQueryParameter("id");
102
+ String statusId = uri.getQueryParameter("statusId");
103
+ String status = uri.getQueryParameter("status");
104
+ String transId = uri.getQueryParameter("transId");
105
+ String custom1 = uri.getQueryParameter("custom1");
106
+
107
+ SkipcashReactnativeModule.handleNativeWebViewData(id, statusId, status, transId, custom1);
108
+
109
+ finish();
110
+ }
111
+
112
+ return true;
113
+ }
114
+
115
+ @Override
116
+ public void onPageFinished(WebView view, String url) {
117
+ super.onPageFinished(view, url);
118
+ loadingWebview.setVisibility(View.GONE);
119
+ webView.scrollTo(0, webView.getContentHeight());
120
+ }
121
+ });
122
+
123
+
124
+ if (url != null) {
125
+ webView.loadUrl(url);
126
+ }
127
+ }
128
+ }