Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
rdlabo committed Dec 5, 2024
1 parent f1ddf70 commit 06ad330
Show file tree
Hide file tree
Showing 9 changed files with 93 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.google.android.gms.common.util.BiConsumer
import com.stripe.android.identity.IdentityVerificationSheet

class StripeIdentity(
contextSupplier: Supplier<Context?>,
contextSupplier: Supplier<Context>,
activitySupplier: Supplier<Activity>,
notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.getcapacitor.JSObject
import com.google.android.gms.common.util.BiConsumer

abstract class Executor(
protected var contextSupplier: Supplier<Context?>,
protected var contextSupplier: Supplier<Context>,
protected val activitySupplier: Supplier<Activity>,
protected var notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.google.android.gms.common.util.BiConsumer
import com.stripe.android.googlepaylauncher.GooglePayLauncher

class GooglePayExecutor(
contextSupplier: Supplier<Context?>,
contextSupplier: Supplier<Context>,
activitySupplier: Supplier<Activity>,
notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.getcapacitor.JSObject
import com.google.android.gms.common.util.BiConsumer

abstract class Executor(
protected var contextSupplier: Supplier<Context?>,
protected var contextSupplier: Supplier<Context>,
protected val activitySupplier: Supplier<Activity>,
protected var notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ import com.getcapacitor.PluginCall
import com.getcapacitor.community.stripe.models.Executor
import com.google.android.gms.common.util.BiConsumer
import com.stripe.android.paymentsheet.PaymentSheet
import com.stripe.android.paymentsheet.PaymentSheet.FlowController.ConfigCallback
import com.stripe.android.paymentsheet.PaymentSheetResult
import com.stripe.android.paymentsheet.model.PaymentOption

class PaymentFlowExecutor(
contextSupplier: Supplier<Context?>,
contextSupplier: Supplier<Context>,
activitySupplier: Supplier<Activity>,
notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String
Expand Down Expand Up @@ -98,41 +97,41 @@ class PaymentFlowExecutor(
if (setupIntentClientSecret != null) {
flowController!!.configureWithSetupIntent(
setupIntentClientSecret,
paymentConfiguration,
ConfigCallback { success: Boolean, error: Throwable? ->
if (success) {
notifyListenersFunction.accept(
PaymentFlowEvents.Loaded.webEventName,
emptyObject
)
call.resolve()
} else {
notifyListenersFunction.accept(
PaymentFlowEvents.FailedToLoad.webEventName,
JSObject().put("error", error!!.localizedMessage)
)
call.reject(error.localizedMessage)
}
})
paymentConfiguration
) { success: Boolean, error: Throwable? ->
if (success) {
notifyListenersFunction.accept(
PaymentFlowEvents.Loaded.webEventName,
emptyObject
)
call.resolve()
} else {
notifyListenersFunction.accept(
PaymentFlowEvents.FailedToLoad.webEventName,
JSObject().put("error", error!!.localizedMessage)
)
call.reject(error.localizedMessage)
}
}
} else if (paymentIntentClientSecret != null) {
flowController!!.configureWithPaymentIntent(
paymentIntentClientSecret,
paymentConfiguration,
ConfigCallback { success: Boolean, error: Throwable? ->
if (success) {
notifyListenersFunction.accept(
PaymentFlowEvents.Loaded.webEventName,
emptyObject
)
call.resolve()
} else {
notifyListenersFunction.accept(
PaymentFlowEvents.FailedToLoad.webEventName,
JSObject().put("error", error!!.localizedMessage)
)
call.reject(error.localizedMessage)
}
})
paymentConfiguration
) { success: Boolean, error: Throwable? ->
if (success) {
notifyListenersFunction.accept(
PaymentFlowEvents.Loaded.webEventName,
emptyObject
)
call.resolve()
} else {
notifyListenersFunction.accept(
PaymentFlowEvents.FailedToLoad.webEventName,
JSObject().put("error", error!!.localizedMessage)
)
call.reject(error.localizedMessage)
}
}
}
}

Expand Down Expand Up @@ -180,7 +179,7 @@ class PaymentFlowExecutor(
} else if (paymentSheetResult is PaymentSheetResult.Failed) {
notifyListenersFunction.accept(
PaymentFlowEvents.Failed.webEventName,
JSObject().put("error", (paymentSheetResult as PaymentSheetResult.Failed).error.getLocalizedMessage())
JSObject().put("error", (paymentSheetResult).error.localizedMessage)
)
call.resolve(JSObject().put("paymentResult", PaymentFlowEvents.Failed.webEventName))
} else if (paymentSheetResult is PaymentSheetResult.Completed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConf
import com.stripe.android.paymentsheet.PaymentSheetResult

class PaymentSheetExecutor(
contextSupplier: Supplier<Context?>,
contextSupplier: Supplier<Context>,
activitySupplier: Supplier<Activity>,
notifyListenersFunction: BiConsumer<String, JSObject>,
pluginLogTag: String
Expand Down Expand Up @@ -113,12 +113,12 @@ class PaymentSheetExecutor(
)
}
} else {
val GooglePayEnvironment = call.getBoolean("GooglePayIsTesting", false)
val googlePayEnvironment = call.getBoolean("GooglePayIsTesting", false)

var environment: PaymentSheet.GooglePayConfiguration.Environment =
PaymentSheet.GooglePayConfiguration.Environment.Production

if (GooglePayEnvironment!!) {
if (googlePayEnvironment!!) {
environment = PaymentSheet.GooglePayConfiguration.Environment.Test
}

Expand Down Expand Up @@ -181,7 +181,7 @@ class PaymentSheetExecutor(
PaymentSheetEvents.Failed.webEventName,
JSObject().put(
"message",
(paymentSheetResult as PaymentSheetResult.Failed).error.getLocalizedMessage()
(paymentSheetResult).error.localizedMessage
)
)
notifyListenersFunction.accept(PaymentSheetEvents.Failed.webEventName, emptyObject)
Expand Down
Loading

0 comments on commit 06ad330

Please sign in to comment.