sj_sdk_testing

A SDK to access XXX services such as login, sign-up, point exchange, ext..

This package is a Flutter implementation of

Setup

Android

Go to android/build.gradle and add this line inside repositories block:

repositories {
    ...
    maven {
        url = uri("https://jitpack.io")
    }
}

and set kotlin version to 1.9.24 inside buildScript block:

ext.kotlin_version = '1.9.24'

Go to android/app/build.gradle and set minSdkVersion to 26

minSdkVersion 26

IOS

This package set ios deployment target to 11.0. If your ios project is targeting below said version, you can adjust the Podfile file in ios module.

target.build_configurations.each do |config|
  config.build_settings['IOS_DEPLOYMENT_TARGET'] = '11.0'
end

Config

Create SjConfig object and provide required parameters

SjConfig(
  clientId: <provide-your-clientid>,
  language: <language> (default: Language.en),
  environment: <environment> (default: Environment.uat),
);

All available languages:

Language.vn
Language.en

All supported environments:

Environment.dev
Environment.stg
Environment.uat /// (default)
Environment.prod

Initialize package by providing your created config object

await SjSdkTesting.init(config);

Usage

SignIn / SignUp

Call available signIn and signUp methods accordingly

await SjSdkTesting.instance.signIn();
await SjSdkTesting.instance.signUp();

Both methods return a map:

{
  "accessToken": "",
  "refreshToken": "",
  "expiresIn": "",
}

User Profile

Call userProfile method and provide member token from signIn or signUp method

await SjSdkTesting.instance.userProfile(token);

Method return a map that contains user profile:

{
  "fullName": "",
  "userName": "",
  "phoneNumber": "",
  ...
}

Point Exchange

Call pointExchange method and provide your phoneNumber and memberCode

await SjSdkTesting.instance.pointExchange(phoneNumber, memberCode);

Flight Redemption

Call flightRedemption method and provide your token

await SjSdkTesting.instance.pointExchange(token);

Author

Khang Huynh - @gj-khanghv on Github

License

MIT. See the LICENSE file for details.