๐Ÿ“ฆ manideepk90 / react-native-hyperswitch-sdk

๐Ÿ“„ DefaultPaymentSheetLauncher.kt ยท 40 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40package io.hyperswitch.paymentsheet

import android.app.Activity
import android.app.Application
import android.app.Fragment

/**
 * This is used internally for integrations that don't use Jetpack Compose and are
 * able to pass in an activity.
 */
internal class DefaultPaymentSheetLauncher(
    // private val activityResultLauncher: ActivityResultLauncher<PaymentSheetContract.Args>,
    application: Application
) : PaymentSheetLauncher {

    constructor(
        activity: Activity, callback: PaymentSheetResultCallback
    ) : this(
        activity.application
    )

    constructor(
        fragment: Fragment, callback: PaymentSheetResultCallback
    ) : this(
        fragment.activity.application
    )

    override fun presentWithPaymentIntent(
        paymentIntentClientSecret: String, configuration: PaymentSheet.Configuration?
    ) = present()

    override fun presentWithSetupIntent(
        setupIntentClientSecret: String, configuration: PaymentSheet.Configuration?
    ) = present()

    private fun present() {
        // activityResultLauncher.launch(args)
    }

}