# blusalt_checkout

Checkout SDK for Blusalt Payment

Get your checkout credentials from [Blusalt](https://blusalt.net/)

## Features

1. Received Money Via Card
2. Received Money Via Bank Transfer

## Usage

```yaml
dependencies:
  blusalt_checkout: ^lastVersion 
```

```dart
startSdk() async {
  BlusaltCheckoutResultResponse? response =
  await _checkoutPlugin.startSDK(
      apiKey: apiKey,
      isDev: isDev,
      amount: amount,
      currency: currency,
      walletId: walletId,
      reference: null,
      iosConfig: IosConfig(
        iosPresentationStyle: IosPresentationStyle.fancyBottomModal,
      ),
  );
}

```

## Installation

### Android

#### Step 1

Create a [github.properties] file in root of android folder and put below into content.
Replace values with your github credentials from github and make sure to grant necessary permissions
especially for github packages

```
USERNAME_GITHUB=SampleUsername
TOKEN_GITHUB=SampleClassicToken
```

#### Step 2

Add below to project level gradle file `/android/build.gradle`

```gradle
buildscript {
    ext.kotlin_version = '1.9.+'
    ...

    dependencies {
        classpath 'com.android.tools.build:gradle:7.3.+'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    def githubPropertiesFile = rootProject.file("github.properties")
    def githubProperties = new Properties()
    githubProperties.load(new FileInputStream(githubPropertiesFile))


    repositories {

        maven {
            name "GitHubPackages"
            url 'https://maven.pkg.github.com/Blusalt-FS/Checkout-Android-Package'

            credentials {
                username githubProperties['USERNAME_GITHUB']
                password githubProperties['TOKEN_GITHUB']
            }
        }
    }
}
```

#### Step 3

Change the minimum Android sdk version to 24 (or higher) in your `/android/app/build.gradle` file.

```

android {
    ...
    defaultConfig {
      ...
      minSdkVersion 24
    }
    ...
}
```

#### Step 4

If you're experiencing crashes or timeouts.
Add below to your progaurd.pro file if using progaurd or minify is enabled
`/android/app/proguard-rules.pro`

```proguard
-keep class net.blusalt.checkout.** { *; }
```

Enable proguard in `/android/app/build.gradle` file like below.

```

android {
    
    ...
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    ...
}
```

## Note on Android:

If you are getting an error on android which says "Unauthorized" when gradle is downloading or
building, generate a new
github token that have access to clone, read and write to repo, access github packages. If you don't
know which to tick, tick all boxes. Cheers

### iOS

```
Minimum iOS Deployment = 14
```

## 📱 Note on iOS

1. **Ensure `BlusaltCheckout.xcframework` is Linked**  
   In your Xcode workspace:
    - Navigate to `Pods` > `BlusaltCheckout.xcframework`
    - Confirm that it is properly linked and included in your app’s build target.

2**Add Required Frameworks to Xcode**  
If you encounter errors related to `WebKit`, follow these steps:

- Open your project in Xcode.
- Under the `TARGETS` section, click on **Runner**.
- Go to the **General** tab and scroll to **Frameworks, Libraries, and Embedded Content**.
- Click the **`+`** button and add the following frameworks:
    - `WebKit.framework`


