Commit 314f7d10 authored by Ankit Deshmukh's avatar Ankit Deshmukh
Browse files

feat: added archiveSmallcase functionality and utm params in triggerLeadGen

parent cba7afc3
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -82,7 +82,7 @@ repositories {
dependencies {
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+'  // From node_modules
    implementation 'com.smallcase.gateway:sdk:2.2.0'
    implementation 'com.smallcase.gateway:sdk:2.9.2'
    implementation "androidx.core:core-ktx:1.3.1"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
+27 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ import com.smallcase.gateway.data.listeners.DataListener
import com.smallcase.gateway.data.listeners.TransactionResponseListener
import com.smallcase.gateway.data.models.Environment
import com.smallcase.gateway.data.models.InitialisationResponse
import com.smallcase.gateway.data.models.SmallcaseGatewayDataResponse
import com.smallcase.gateway.data.models.TransactionResult
import com.smallcase.gateway.data.requests.InitRequest
import com.smallcase.gateway.portal.SmallcaseGatewaySdk
@@ -131,6 +132,23 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
        }
    }

    @ReactMethod
    fun archiveSmallcase(iscid: String, promise: Promise) {
        Log.d(TAG, "markSmallcaseArchive: start")

        SmallcaseGatewaySdk.markSmallcaseArchived(iscid, object : DataListener<SmallcaseGatewayDataResponse> {

            override fun onSuccess(response: SmallcaseGatewayDataResponse) {
                promise.resolve(response)
            }

            override fun onFailure(errorCode: Int, errorMessage: String) {
                val err = createErrorJSON(errorCode, errorMessage)
                promise.reject("error", err)
            }
        })
    }

    @ReactMethod
    fun logoutUser(promise: Promise) {
        val activity = currentActivity;
@@ -159,6 +177,15 @@ class SmallcaseGatewayModule(reactContext: ReactApplicationContext?) : ReactCont
        }
    }

    @ReactMethod
    fun triggerLeadGenUtm(userParams: ReadableMap, utmParams: ReadableMap) {
        val activity = currentActivity;
        if (activity != null) {
            val userData = readableMapToStrHashMap(userParams)
            val utmData = readableMapToStrHashMap(utmParams)
            SmallcaseGatewaySdk.triggerLeadGen(activity, userData, utmData)
        }
    }
    private fun getProtocol(envName: String): Environment.PROTOCOL {
        return when (envName) {
            "production" -> Environment.PROTOCOL.PRODUCTION
+25 −1
Original line number Diff line number Diff line
@@ -18,6 +18,9 @@ const App = () => {
  const [sdkToken, setSdkToken] = useState(
    'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJndWVzdCI6dHJ1ZSwiaWF0IjoxNTk5Njc0MzYyLCJleHAiOjE1OTk2Nzc5NjJ9.CqqzVqX7E_od-TFzaPKET51XUhSr0hdL-P3pwNQ6ZMM',
  );

  const [iscid, setIscid] = useState('60ae3f69e3f4b0e0c5f98d12');

  const [transactionId, setTransactionId] = useState('');

  const updateEnv = useCallback(async () => {
@@ -26,7 +29,7 @@ const App = () => {
    try {
      await SmallcaseGateway.setConfigEnvironment({
        environmentName: env,
        gatewayName: 'smallcase-website',
        gatewayName: 'gatewaydemo',
        isLeprechaun: true,
        brokerList: ['kite', 'aliceblue', 'trustline'],
      });
@@ -62,6 +65,19 @@ const App = () => {
    }
  }, [transactionId]);

  const markSmallcaseArchive = useCallback(async () => {
    setLog((p) => p + '\n marking smallcase archive');
    try {
      const res = await SmallcaseGateway.archiveSmallcase(iscid);
      setLog((p) => p + '\n archive success');
      setLog((p) => p + '\n' + JSON.stringify(res, null, 2));
    } catch (err) {
      setLog(
        (p) => p + '\n error during archive' + JSON.stringify(err),
      );
    }
  }, [iscid]);

  return (
    <ScrollView style={styles.container}>
      <Text>Smallcase SDK Tester</Text>
@@ -107,6 +123,14 @@ const App = () => {
        />
      </View>

      <TextInput
        value={iscid}
        onChangeText={setIscid}
        style={styles.inp}
        placeholder="iscid"
      />
      <Button title="archive smallcase" onPress={markSmallcaseArchive} />

      <View style={styles.logBox}>
        <Button title="clear logs" onPress={() => setLog('')} />
        <Text>{log}</Text>
+2 −2
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@ require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

source 'https://gitlab.com/scGatewayOS/cocoapodspecs.git'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://cdn.cocoapods.org'


platform :ios, '11.0'
platform :ios, '14.3'

target 'example' do
  config = use_native_modules!
+9 −9
Original line number Diff line number Diff line
@@ -185,9 +185,9 @@ PODS:
    - React-cxxreact (= 0.63.2)
    - React-jsi (= 0.63.2)
  - React-jsinspector (0.63.2)
  - react-native-smallcase-gateway (0.3.0-alpha.1):
  - react-native-smallcase-gateway (0.3.0):
    - React-Core
    - SCGateway (= 2.7.0)
    - SCGateway (= 2.9.2)
  - React-RCTActionSheet (0.63.2):
    - React-Core/RCTActionSheetHeaders (= 0.63.2)
  - React-RCTAnimation (0.63.2):
@@ -248,7 +248,7 @@ PODS:
    - React-Core (= 0.63.2)
    - React-cxxreact (= 0.63.2)
    - React-jsi (= 0.63.2)
  - SCGateway (2.7.0)
  - SCGateway (2.9.2)
  - Yoga (1.14.0)

DEPENDENCIES:
@@ -283,10 +283,10 @@ DEPENDENCIES:
  - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

SPEC REPOS:
  https://github.com/CocoaPods/Specs.git:
    - boost-for-react-native
  https://gitlab.com/scGatewayOS/cocoapodspecs.git:
    - SCGateway
  trunk:
    - boost-for-react-native

EXTERNAL SOURCES:
  DoubleConversion:
@@ -361,7 +361,7 @@ SPEC CHECKSUMS:
  React-jsi: 54245e1d5f4b690dec614a73a3795964eeef13a8
  React-jsiexecutor: 8ca588cc921e70590820ce72b8789b02c67cce38
  React-jsinspector: b14e62ebe7a66e9231e9581279909f2fc3db6606
  react-native-smallcase-gateway: 1a2e5bb212d81e13425a38aa730bc8af58ccb558
  react-native-smallcase-gateway: 141355cefdd7d14d898b1466c4f668bec12e2004
  React-RCTActionSheet: 910163b6b09685a35c4ebbc52b66d1bfbbe39fc5
  React-RCTAnimation: 9a883bbe1e9d2e158d4fb53765ed64c8dc2200c6
  React-RCTBlob: 39cf0ece1927996c4466510e25d2105f67010e13
@@ -372,9 +372,9 @@ SPEC CHECKSUMS:
  React-RCTText: 1b6773e776e4b33f90468c20fe3b16ca3e224bb8
  React-RCTVibration: 4d2e726957f4087449739b595f107c0d4b6c2d2d
  ReactCommon: a0a1edbebcac5e91338371b72ffc66aa822792ce
  SCGateway: e1119e82a56d65e4ab14f66194f0e412b7c9b061
  SCGateway: c8d9b20ed22577d3ccf37bc9d9ffca7d9cfae942
  Yoga: 7740b94929bbacbddda59bf115b5317e9a161598

PODFILE CHECKSUM: 376c82394d8d0ec89b69f586fe5dd243fecb9bd2
PODFILE CHECKSUM: d625030c7c21105972f58bc991a06b529a65d8d6

COCOAPODS: 1.10.1
COCOAPODS: 1.9.3
Loading