@stripe/stripe-react-native 0.55.1 → 0.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +4 -3
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +7 -6
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +11 -11
- package/android/src/main/java/com/reactnativestripesdk/{CollectBankAccountLauncherFragment.kt → CollectBankAccountLauncherManager.kt} +21 -44
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +17 -24
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/{FinancialConnectionsSheetFragment.kt → FinancialConnectionsSheetManager.kt} +30 -77
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +107 -0
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherManager.kt +37 -0
- package/android/src/main/java/com/reactnativestripesdk/{PaymentLauncherFragment.kt → PaymentLauncherManager.kt} +39 -77
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +8 -20
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +366 -483
- package/android/src/main/java/com/reactnativestripesdk/{PaymentSheetFragment.kt → PaymentSheetManager.kt} +79 -88
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +3 -2
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +213 -210
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherManager.kt +78 -0
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +48 -35
- package/android/src/main/java/com/reactnativestripesdk/customersheet/{CustomerSheetFragment.kt → CustomerSheetManager.kt} +127 -104
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +35 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +47 -12
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +87 -142
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeUIManager.kt +62 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +12 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +4 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +8 -64
- package/ios/AddressSheet/AddressSheetView.swift +1 -1
- package/ios/ApplePayButtonManager.m +1 -1
- package/ios/ApplePayButtonView.swift +2 -2
- package/ios/FinancialConnections.swift +2 -2
- package/ios/Mappers.swift +2 -4
- package/ios/NewArch/ApplePayButtonComponentView.mm +1 -1
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +2 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +12 -0
- package/ios/PaymentMethodFactory.swift +0 -17
- package/ios/PushProvisioning/AddToWalletButtonView.swift +1 -1
- package/ios/StripeSdk.mm +14 -0
- package/ios/StripeSdkEmitter.swift +2 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +71 -20
- package/ios/StripeSdkImpl+PaymentSheet.swift +29 -13
- package/ios/StripeSdkImpl.swift +9 -7
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/PaymentIntent.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/PaymentIntent.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +2 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +1 -1
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/ConfirmationToken.d.ts +0 -3
- package/lib/typescript/src/types/ConfirmationToken.d.ts.map +1 -1
- package/lib/typescript/src/types/CustomerSheet.d.ts +70 -12
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +2 -4
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentIntent.d.ts +1 -9
- package/lib/typescript/src/types/PaymentIntent.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentMethod.d.ts +2 -8
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +1 -6
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/CustomerSheet.tsx +65 -9
- package/src/components/PlatformPayButton.tsx +1 -1
- package/src/events.ts +2 -0
- package/src/specs/NativeApplePayButton.ts +1 -1
- package/src/specs/NativeStripeSdkModule.ts +7 -0
- package/src/types/ConfirmationToken.ts +0 -3
- package/src/types/CustomerSheet.ts +80 -12
- package/src/types/EmbeddedPaymentElement.tsx +2 -4
- package/src/types/PaymentIntent.ts +0 -10
- package/src/types/PaymentMethod.ts +0 -9
- package/src/types/PaymentSheet.ts +1 -6
- package/stripe-react-native.podspec +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +0 -146
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +0 -68
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +0 -102
- package/android/src/main/java/com/reactnativestripesdk/utils/StripeFragment.kt +0 -52
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
package com.reactnativestripesdk.utils
|
|
2
2
|
|
|
3
3
|
import android.annotation.SuppressLint
|
|
4
|
-
import android.os.Bundle
|
|
5
|
-
import android.util.Log
|
|
6
4
|
import com.facebook.react.bridge.Arguments
|
|
7
5
|
import com.facebook.react.bridge.ReadableArray
|
|
8
6
|
import com.facebook.react.bridge.ReadableMap
|
|
9
|
-
import com.facebook.react.bridge.ReadableType
|
|
10
7
|
import com.facebook.react.bridge.WritableArray
|
|
11
8
|
import com.facebook.react.bridge.WritableMap
|
|
12
9
|
import com.facebook.react.bridge.WritableNativeMap
|
|
@@ -30,6 +27,7 @@ import com.stripe.android.model.StripeIntent.NextActionType
|
|
|
30
27
|
import com.stripe.android.model.Token
|
|
31
28
|
import com.stripe.android.paymentelement.ExperimentalCustomPaymentMethodsApi
|
|
32
29
|
import com.stripe.android.paymentsheet.PaymentSheet
|
|
30
|
+
import java.lang.IllegalArgumentException
|
|
33
31
|
|
|
34
32
|
internal fun createResult(
|
|
35
33
|
key: String,
|
|
@@ -138,7 +136,6 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String =
|
|
|
138
136
|
PaymentMethod.Type.CardPresent -> "CardPresent"
|
|
139
137
|
PaymentMethod.Type.Eps -> "Eps"
|
|
140
138
|
PaymentMethod.Type.Fpx -> "Fpx"
|
|
141
|
-
PaymentMethod.Type.Giropay -> "Giropay"
|
|
142
139
|
PaymentMethod.Type.GrabPay -> "GrabPay"
|
|
143
140
|
PaymentMethod.Type.Ideal -> "Ideal"
|
|
144
141
|
PaymentMethod.Type.Netbanking -> "Netbanking"
|
|
@@ -171,7 +168,6 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? =
|
|
|
171
168
|
"CardPresent" -> PaymentMethod.Type.CardPresent
|
|
172
169
|
"Eps" -> PaymentMethod.Type.Eps
|
|
173
170
|
"Fpx" -> PaymentMethod.Type.Fpx
|
|
174
|
-
"Giropay" -> PaymentMethod.Type.Giropay
|
|
175
171
|
"GrabPay" -> PaymentMethod.Type.GrabPay
|
|
176
172
|
"Netbanking" -> PaymentMethod.Type.Netbanking
|
|
177
173
|
"Oxxo" -> PaymentMethod.Type.Oxxo
|
|
@@ -665,7 +661,7 @@ internal fun mapToBillingDetails(
|
|
|
665
661
|
if (billingDetails == null && cardAddress == null) {
|
|
666
662
|
return null
|
|
667
663
|
}
|
|
668
|
-
val address = mapToAddress(
|
|
664
|
+
val address = mapToAddress(billingDetails?.getMap("address"), cardAddress)
|
|
669
665
|
val paymentMethodBillingDetailsBuilder = PaymentMethod.BillingDetails.Builder()
|
|
670
666
|
|
|
671
667
|
if (billingDetails != null) {
|
|
@@ -686,7 +682,7 @@ internal fun mapToShippingDetails(shippingDetails: ReadableMap?): ConfirmPayment
|
|
|
686
682
|
return null
|
|
687
683
|
}
|
|
688
684
|
|
|
689
|
-
val address = mapToAddress(
|
|
685
|
+
val address = mapToAddress(shippingDetails?.getMap("address"), null)
|
|
690
686
|
|
|
691
687
|
return ConfirmPaymentIntentParams.Shipping(
|
|
692
688
|
name = getValOr(shippingDetails, "name") ?: "",
|
|
@@ -694,37 +690,17 @@ internal fun mapToShippingDetails(shippingDetails: ReadableMap?): ConfirmPayment
|
|
|
694
690
|
)
|
|
695
691
|
}
|
|
696
692
|
|
|
697
|
-
private fun getStringOrNull(
|
|
698
|
-
map: ReadableMap?,
|
|
699
|
-
key: String,
|
|
700
|
-
): String? = if (map?.hasKey(key) == true) map.getString(key) else null
|
|
701
|
-
|
|
702
|
-
fun getIntOrNull(
|
|
703
|
-
map: ReadableMap?,
|
|
704
|
-
key: String,
|
|
705
|
-
): Int? = if (map?.hasKey(key) == true) map.getInt(key) else null
|
|
706
|
-
|
|
707
|
-
fun getMapOrNull(
|
|
708
|
-
map: ReadableMap?,
|
|
709
|
-
key: String,
|
|
710
|
-
): ReadableMap? = if (map?.hasKey(key) == true) map.getMap(key) else null
|
|
711
|
-
|
|
712
|
-
fun getBooleanOrFalse(
|
|
713
|
-
map: ReadableMap?,
|
|
714
|
-
key: String,
|
|
715
|
-
): Boolean = if (map?.hasKey(key) == true) map.getBoolean(key) else false
|
|
716
|
-
|
|
717
693
|
private fun convertToUnixTimestamp(timestamp: Long): String = (timestamp * 1000).toString()
|
|
718
694
|
|
|
719
695
|
fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCustomization {
|
|
720
|
-
val labelCustomization =
|
|
696
|
+
val labelCustomization = params.getMap("label")
|
|
721
697
|
val navigationBarCustomization = params.getMap("navigationBar")
|
|
722
|
-
val textBoxCustomization =
|
|
723
|
-
val submitButtonCustomization =
|
|
724
|
-
val cancelButtonCustomization =
|
|
725
|
-
val nextButtonCustomization =
|
|
726
|
-
val continueButtonCustomization =
|
|
727
|
-
val resendButtonCustomization =
|
|
698
|
+
val textBoxCustomization = params.getMap("textField")
|
|
699
|
+
val submitButtonCustomization = params.getMap("submitButton")
|
|
700
|
+
val cancelButtonCustomization = params.getMap("cancelButton")
|
|
701
|
+
val nextButtonCustomization = params.getMap("nextButton")
|
|
702
|
+
val continueButtonCustomization = params.getMap("continueButton")
|
|
703
|
+
val resendButtonCustomization = params.getMap("resendButton")
|
|
728
704
|
|
|
729
705
|
val labelCustomizationBuilder = PaymentAuthConfig.Stripe3ds2LabelCustomization.Builder()
|
|
730
706
|
val toolbarCustomizationBuilder = PaymentAuthConfig.Stripe3ds2ToolbarCustomization.Builder()
|
|
@@ -736,121 +712,121 @@ fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCus
|
|
|
736
712
|
val continueButtonCustomizationBuilder = PaymentAuthConfig.Stripe3ds2ButtonCustomization.Builder()
|
|
737
713
|
val resendButtonCustomizationBuilder = PaymentAuthConfig.Stripe3ds2ButtonCustomization.Builder()
|
|
738
714
|
|
|
739
|
-
|
|
715
|
+
labelCustomization?.getString("headingTextColor")?.let {
|
|
740
716
|
labelCustomizationBuilder.setHeadingTextColor(it)
|
|
741
717
|
}
|
|
742
|
-
|
|
718
|
+
labelCustomization?.getString("textColor")?.let {
|
|
743
719
|
labelCustomizationBuilder.setTextColor(it)
|
|
744
720
|
}
|
|
745
|
-
getIntOrNull(
|
|
721
|
+
labelCustomization.getIntOrNull("headingFontSize")?.let {
|
|
746
722
|
labelCustomizationBuilder.setHeadingTextFontSize(it)
|
|
747
723
|
}
|
|
748
|
-
getIntOrNull(
|
|
724
|
+
labelCustomization.getIntOrNull("textFontSize")?.let {
|
|
749
725
|
labelCustomizationBuilder.setTextFontSize(it)
|
|
750
726
|
}
|
|
751
727
|
|
|
752
|
-
|
|
728
|
+
navigationBarCustomization?.getString("headerText")?.let {
|
|
753
729
|
toolbarCustomizationBuilder.setHeaderText(it)
|
|
754
730
|
}
|
|
755
|
-
|
|
731
|
+
navigationBarCustomization?.getString("buttonText")?.let {
|
|
756
732
|
toolbarCustomizationBuilder.setButtonText(it)
|
|
757
733
|
}
|
|
758
|
-
|
|
734
|
+
navigationBarCustomization?.getString("textColor")?.let {
|
|
759
735
|
toolbarCustomizationBuilder.setTextColor(it)
|
|
760
736
|
}
|
|
761
|
-
|
|
737
|
+
navigationBarCustomization?.getString("statusBarColor")?.let {
|
|
762
738
|
toolbarCustomizationBuilder.setStatusBarColor(it)
|
|
763
739
|
}
|
|
764
|
-
|
|
740
|
+
navigationBarCustomization?.getString("backgroundColor")?.let {
|
|
765
741
|
toolbarCustomizationBuilder.setBackgroundColor(it)
|
|
766
742
|
}
|
|
767
|
-
getIntOrNull(
|
|
743
|
+
navigationBarCustomization.getIntOrNull("textFontSize")?.let {
|
|
768
744
|
toolbarCustomizationBuilder.setTextFontSize(it)
|
|
769
745
|
}
|
|
770
746
|
|
|
771
|
-
|
|
747
|
+
textBoxCustomization?.getString("borderColor")?.let {
|
|
772
748
|
textBoxCustomizationBuilder.setBorderColor(it)
|
|
773
749
|
}
|
|
774
|
-
|
|
750
|
+
textBoxCustomization?.getString("textColor")?.let {
|
|
775
751
|
textBoxCustomizationBuilder.setTextColor(it)
|
|
776
752
|
}
|
|
777
|
-
getIntOrNull(
|
|
753
|
+
textBoxCustomization.getIntOrNull("borderWidth")?.let {
|
|
778
754
|
textBoxCustomizationBuilder.setBorderWidth(it)
|
|
779
755
|
}
|
|
780
|
-
getIntOrNull(
|
|
756
|
+
textBoxCustomization.getIntOrNull("borderRadius")?.let {
|
|
781
757
|
textBoxCustomizationBuilder.setCornerRadius(it)
|
|
782
758
|
}
|
|
783
|
-
getIntOrNull(
|
|
759
|
+
textBoxCustomization.getIntOrNull("textFontSize")?.let {
|
|
784
760
|
textBoxCustomizationBuilder.setTextFontSize(it)
|
|
785
761
|
}
|
|
786
762
|
|
|
787
763
|
// Submit button
|
|
788
|
-
|
|
764
|
+
submitButtonCustomization?.getString("backgroundColor")?.let {
|
|
789
765
|
submitButtonCustomizationBuilder.setBackgroundColor(it)
|
|
790
766
|
}
|
|
791
|
-
getIntOrNull(
|
|
767
|
+
submitButtonCustomization.getIntOrNull("borderRadius")?.let {
|
|
792
768
|
submitButtonCustomizationBuilder.setCornerRadius(it)
|
|
793
769
|
}
|
|
794
|
-
|
|
770
|
+
submitButtonCustomization?.getString("textColor")?.let {
|
|
795
771
|
submitButtonCustomizationBuilder.setTextColor(it)
|
|
796
772
|
}
|
|
797
|
-
getIntOrNull(
|
|
773
|
+
submitButtonCustomization.getIntOrNull("textFontSize")?.let {
|
|
798
774
|
submitButtonCustomizationBuilder.setTextFontSize(it)
|
|
799
775
|
}
|
|
800
776
|
|
|
801
777
|
// Cancel button
|
|
802
|
-
|
|
778
|
+
cancelButtonCustomization?.getString("backgroundColor")?.let {
|
|
803
779
|
cancelButtonCustomizationBuilder.setBackgroundColor(it)
|
|
804
780
|
}
|
|
805
|
-
getIntOrNull(
|
|
781
|
+
cancelButtonCustomization.getIntOrNull("borderRadius")?.let {
|
|
806
782
|
cancelButtonCustomizationBuilder.setCornerRadius(it)
|
|
807
783
|
}
|
|
808
|
-
|
|
784
|
+
cancelButtonCustomization?.getString("textColor")?.let {
|
|
809
785
|
cancelButtonCustomizationBuilder.setTextColor(it)
|
|
810
786
|
}
|
|
811
|
-
getIntOrNull(
|
|
787
|
+
cancelButtonCustomization.getIntOrNull("textFontSize")?.let {
|
|
812
788
|
cancelButtonCustomizationBuilder.setTextFontSize(it)
|
|
813
789
|
}
|
|
814
790
|
|
|
815
791
|
// Continue button
|
|
816
|
-
|
|
792
|
+
continueButtonCustomization?.getString("backgroundColor")?.let {
|
|
817
793
|
continueButtonCustomizationBuilder.setBackgroundColor(it)
|
|
818
794
|
}
|
|
819
|
-
getIntOrNull(
|
|
795
|
+
continueButtonCustomization.getIntOrNull("borderRadius")?.let {
|
|
820
796
|
continueButtonCustomizationBuilder.setCornerRadius(it)
|
|
821
797
|
}
|
|
822
|
-
|
|
798
|
+
continueButtonCustomization?.getString("textColor")?.let {
|
|
823
799
|
continueButtonCustomizationBuilder.setTextColor(it)
|
|
824
800
|
}
|
|
825
|
-
getIntOrNull(
|
|
801
|
+
continueButtonCustomization.getIntOrNull("textFontSize")?.let {
|
|
826
802
|
continueButtonCustomizationBuilder.setTextFontSize(it)
|
|
827
803
|
}
|
|
828
804
|
|
|
829
805
|
// Next button
|
|
830
|
-
|
|
806
|
+
nextButtonCustomization?.getString("backgroundColor")?.let {
|
|
831
807
|
nextButtonCustomizationBuilder.setBackgroundColor(it)
|
|
832
808
|
}
|
|
833
|
-
getIntOrNull(
|
|
809
|
+
nextButtonCustomization.getIntOrNull("borderRadius")?.let {
|
|
834
810
|
nextButtonCustomizationBuilder.setCornerRadius(it)
|
|
835
811
|
}
|
|
836
|
-
|
|
812
|
+
nextButtonCustomization?.getString("textColor")?.let {
|
|
837
813
|
nextButtonCustomizationBuilder.setTextColor(it)
|
|
838
814
|
}
|
|
839
|
-
getIntOrNull(
|
|
815
|
+
nextButtonCustomization.getIntOrNull("textFontSize")?.let {
|
|
840
816
|
nextButtonCustomizationBuilder.setTextFontSize(it)
|
|
841
817
|
}
|
|
842
818
|
|
|
843
819
|
// Resend button
|
|
844
|
-
|
|
820
|
+
resendButtonCustomization?.getString("backgroundColor")?.let {
|
|
845
821
|
resendButtonCustomizationBuilder.setBackgroundColor(it)
|
|
846
822
|
}
|
|
847
|
-
getIntOrNull(
|
|
823
|
+
resendButtonCustomization.getIntOrNull("borderRadius")?.let {
|
|
848
824
|
resendButtonCustomizationBuilder.setCornerRadius(it)
|
|
849
825
|
}
|
|
850
|
-
|
|
826
|
+
resendButtonCustomization?.getString("textColor")?.let {
|
|
851
827
|
resendButtonCustomizationBuilder.setTextColor(it)
|
|
852
828
|
}
|
|
853
|
-
getIntOrNull(
|
|
829
|
+
resendButtonCustomization.getIntOrNull("textFontSize")?.let {
|
|
854
830
|
resendButtonCustomizationBuilder.setTextFontSize(it)
|
|
855
831
|
}
|
|
856
832
|
|
|
@@ -876,7 +852,7 @@ fun mapToUICustomization(params: ReadableMap): PaymentAuthConfig.Stripe3ds2UiCus
|
|
|
876
852
|
PaymentAuthConfig.Stripe3ds2UiCustomization.ButtonType.RESEND,
|
|
877
853
|
)
|
|
878
854
|
|
|
879
|
-
|
|
855
|
+
params.getString("accentColor")?.let { uiCustomization.setAccentColor(it) }
|
|
880
856
|
|
|
881
857
|
return uiCustomization.build()
|
|
882
858
|
}
|
|
@@ -936,55 +912,6 @@ fun mapToPaymentIntentFutureUsage(type: String?): ConfirmPaymentIntentParams.Set
|
|
|
936
912
|
else -> null
|
|
937
913
|
}
|
|
938
914
|
|
|
939
|
-
fun toBundleObject(readableMap: ReadableMap?): Bundle {
|
|
940
|
-
val result = Bundle()
|
|
941
|
-
if (readableMap == null) {
|
|
942
|
-
return result
|
|
943
|
-
}
|
|
944
|
-
val iterator = readableMap.keySetIterator()
|
|
945
|
-
while (iterator.hasNextKey()) {
|
|
946
|
-
val key = iterator.nextKey()
|
|
947
|
-
when (readableMap.getType(key)) {
|
|
948
|
-
ReadableType.Null -> result.putString(key, null)
|
|
949
|
-
ReadableType.Boolean -> result.putBoolean(key, readableMap.getBoolean(key))
|
|
950
|
-
ReadableType.Number ->
|
|
951
|
-
try {
|
|
952
|
-
val numAsInt = readableMap.getInt(key)
|
|
953
|
-
val numAsDouble = readableMap.getDouble(key)
|
|
954
|
-
if (numAsDouble - numAsInt != 0.0) {
|
|
955
|
-
result.putDouble(key, numAsDouble)
|
|
956
|
-
} else {
|
|
957
|
-
result.putInt(key, numAsInt)
|
|
958
|
-
}
|
|
959
|
-
} catch (e: Exception) {
|
|
960
|
-
Log.e("toBundleException", "Failed to add number to bundle. Failed on: $key.")
|
|
961
|
-
}
|
|
962
|
-
ReadableType.String -> result.putString(key, readableMap.getString(key))
|
|
963
|
-
ReadableType.Map -> result.putBundle(key, toBundleObject(readableMap.getMap(key)))
|
|
964
|
-
ReadableType.Array -> {
|
|
965
|
-
val list = readableMap.getArray(key)?.toArrayList()
|
|
966
|
-
if (list == null) {
|
|
967
|
-
result.putString(key, null)
|
|
968
|
-
} else if (list.isEmpty()) {
|
|
969
|
-
result.putStringArrayList(key, ArrayList())
|
|
970
|
-
} else {
|
|
971
|
-
when (list.first()) {
|
|
972
|
-
is String -> result.putStringArrayList(key, list as java.util.ArrayList<String>)
|
|
973
|
-
is Int -> result.putIntegerArrayList(key, list as java.util.ArrayList<Int>)
|
|
974
|
-
else ->
|
|
975
|
-
Log.e(
|
|
976
|
-
"toBundleException",
|
|
977
|
-
"Cannot put arrays of objects into bundles. Failed on: $key.",
|
|
978
|
-
)
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
else -> Log.e("toBundleException", "Could not convert object with key: $key.")
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
return result
|
|
986
|
-
}
|
|
987
|
-
|
|
988
915
|
internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableMap {
|
|
989
916
|
val map = WritableNativeMap()
|
|
990
917
|
map.putString("emailAddress", googlePayResult.email)
|
|
@@ -1008,7 +935,7 @@ internal fun mapFromShippingContact(googlePayResult: GooglePayResult): WritableM
|
|
|
1008
935
|
return map
|
|
1009
936
|
}
|
|
1010
937
|
|
|
1011
|
-
internal fun mapToPreferredNetworks(networksAsInts:
|
|
938
|
+
internal fun mapToPreferredNetworks(networksAsInts: List<Int>?): List<CardBrand> {
|
|
1012
939
|
if (networksAsInts == null) {
|
|
1013
940
|
return emptyList()
|
|
1014
941
|
}
|
|
@@ -1084,34 +1011,31 @@ private fun Map<String, Any?>.toReadableMap(): ReadableMap {
|
|
|
1084
1011
|
|
|
1085
1012
|
@OptIn(ExperimentalCustomPaymentMethodsApi::class)
|
|
1086
1013
|
@SuppressLint("RestrictedApi")
|
|
1087
|
-
internal fun parseCustomPaymentMethods(customPaymentMethodConfig:
|
|
1014
|
+
internal fun parseCustomPaymentMethods(customPaymentMethodConfig: ReadableMap?): List<PaymentSheet.CustomPaymentMethod> {
|
|
1088
1015
|
if (customPaymentMethodConfig == null) {
|
|
1089
1016
|
return emptyList()
|
|
1090
1017
|
}
|
|
1091
1018
|
|
|
1092
|
-
val
|
|
1093
|
-
if (
|
|
1094
|
-
val
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
val
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
),
|
|
1109
|
-
)
|
|
1110
|
-
}
|
|
1019
|
+
val customPaymentMethods = customPaymentMethodConfig.getArray("customPaymentMethods")
|
|
1020
|
+
if (customPaymentMethods != null) {
|
|
1021
|
+
val result = mutableListOf<PaymentSheet.CustomPaymentMethod>()
|
|
1022
|
+
|
|
1023
|
+
customPaymentMethods.forEachMap { customPaymentMethodMap ->
|
|
1024
|
+
val id = customPaymentMethodMap.getString("id")
|
|
1025
|
+
if (id != null) {
|
|
1026
|
+
val subtitle = customPaymentMethodMap.getString("subtitle")
|
|
1027
|
+
val disableBillingDetailCollection = customPaymentMethodMap.getBooleanOr("disableBillingDetailCollection", false)
|
|
1028
|
+
result.add(
|
|
1029
|
+
PaymentSheet.CustomPaymentMethod(
|
|
1030
|
+
id = id,
|
|
1031
|
+
subtitle = subtitle,
|
|
1032
|
+
disableBillingDetailCollection = disableBillingDetailCollection,
|
|
1033
|
+
),
|
|
1034
|
+
)
|
|
1111
1035
|
}
|
|
1112
|
-
|
|
1113
|
-
return result
|
|
1114
1036
|
}
|
|
1037
|
+
|
|
1038
|
+
return result
|
|
1115
1039
|
}
|
|
1116
1040
|
|
|
1117
1041
|
return emptyList()
|
|
@@ -1201,3 +1125,24 @@ private fun mapFromAllowRedisplay(allowRedisplay: PaymentMethod.AllowRedisplay?)
|
|
|
1201
1125
|
PaymentMethod.AllowRedisplay.UNSPECIFIED -> "unspecified"
|
|
1202
1126
|
null -> null
|
|
1203
1127
|
}
|
|
1128
|
+
|
|
1129
|
+
fun readableMapOf(vararg pairs: Pair<String, Any?>): ReadableMap =
|
|
1130
|
+
Arguments.createMap().apply {
|
|
1131
|
+
for ((key, value) in pairs) {
|
|
1132
|
+
when (value) {
|
|
1133
|
+
null -> putNull(key)
|
|
1134
|
+
is String -> putString(key, value)
|
|
1135
|
+
is Boolean -> putBoolean(key, value)
|
|
1136
|
+
is Double -> putDouble(key, value)
|
|
1137
|
+
is Float -> putDouble(key, value.toDouble())
|
|
1138
|
+
is Int -> putInt(key, value)
|
|
1139
|
+
is Long -> putLong(key, value)
|
|
1140
|
+
is ReadableMap -> putMap(key, value)
|
|
1141
|
+
is ReadableArray -> putArray(key, value)
|
|
1142
|
+
else -> {
|
|
1143
|
+
val valueType = value.javaClass.canonicalName
|
|
1144
|
+
throw IllegalArgumentException("Illegal value type $valueType for key \"$key\"")
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
package com.reactnativestripesdk.utils
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import androidx.fragment.app.FragmentActivity
|
|
5
|
+
import com.facebook.react.bridge.Promise
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
7
|
+
import com.facebook.react.bridge.UiThreadUtil
|
|
8
|
+
import com.stripe.android.core.reactnative.ReactNativeSdkInternal
|
|
9
|
+
import com.stripe.android.core.reactnative.UnregisterSignal
|
|
10
|
+
|
|
11
|
+
@ReactNativeSdkInternal
|
|
12
|
+
@SuppressLint("RestrictedApi")
|
|
13
|
+
abstract class StripeUIManager(
|
|
14
|
+
protected val context: ReactApplicationContext,
|
|
15
|
+
) {
|
|
16
|
+
protected val signal = UnregisterSignal()
|
|
17
|
+
protected var promise: Promise? = null
|
|
18
|
+
protected var timeout: Long? = null
|
|
19
|
+
|
|
20
|
+
protected open fun onCreate() {}
|
|
21
|
+
|
|
22
|
+
protected abstract fun onPresent()
|
|
23
|
+
|
|
24
|
+
protected open fun onDestroy() {
|
|
25
|
+
signal.unregister()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fun create() {
|
|
29
|
+
UiThreadUtil.runOnUiThread {
|
|
30
|
+
onCreate()
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
fun present(
|
|
35
|
+
promise: Promise? = null,
|
|
36
|
+
timeout: Long? = null,
|
|
37
|
+
) {
|
|
38
|
+
UiThreadUtil.runOnUiThread {
|
|
39
|
+
this.promise = promise
|
|
40
|
+
this.timeout = timeout
|
|
41
|
+
onPresent()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fun destroy() {
|
|
46
|
+
UiThreadUtil.runOnUiThread {
|
|
47
|
+
onDestroy()
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Safely get and cast the current activity as an AppCompatActivity. If that fails, the promise
|
|
53
|
+
* provided will be resolved with an error message instructing the user to retry the method.
|
|
54
|
+
*/
|
|
55
|
+
protected fun getCurrentActivityOrResolveWithError(promise: Promise?): FragmentActivity? {
|
|
56
|
+
(context.currentActivity as? FragmentActivity)?.let {
|
|
57
|
+
return it
|
|
58
|
+
}
|
|
59
|
+
promise?.resolve(createMissingActivityError())
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
}
|
package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java
CHANGED
|
@@ -34,6 +34,18 @@ public class ApplePayButtonManagerDelegate<T extends View, U extends BaseViewMan
|
|
|
34
34
|
case "borderRadius":
|
|
35
35
|
mViewManager.setBorderRadius(view, value == null ? 4 : ((Double) value).intValue());
|
|
36
36
|
break;
|
|
37
|
+
case "hasShippingMethodCallback":
|
|
38
|
+
mViewManager.setHasShippingMethodCallback(view, value == null ? false : (boolean) value);
|
|
39
|
+
break;
|
|
40
|
+
case "hasShippingContactCallback":
|
|
41
|
+
mViewManager.setHasShippingContactCallback(view, value == null ? false : (boolean) value);
|
|
42
|
+
break;
|
|
43
|
+
case "hasCouponCodeCallback":
|
|
44
|
+
mViewManager.setHasCouponCodeCallback(view, value == null ? false : (boolean) value);
|
|
45
|
+
break;
|
|
46
|
+
case "hasOrderTrackingCallback":
|
|
47
|
+
mViewManager.setHasOrderTrackingCallback(view, value == null ? false : (boolean) value);
|
|
48
|
+
break;
|
|
37
49
|
default:
|
|
38
50
|
super.setProperty(view, propName, value);
|
|
39
51
|
}
|
package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java
CHANGED
|
@@ -16,4 +16,8 @@ public interface ApplePayButtonManagerInterface<T extends View> {
|
|
|
16
16
|
void setType(T view, int value);
|
|
17
17
|
void setButtonStyle(T view, int value);
|
|
18
18
|
void setBorderRadius(T view, int value);
|
|
19
|
+
void setHasShippingMethodCallback(T view, boolean value);
|
|
20
|
+
void setHasShippingContactCallback(T view, boolean value);
|
|
21
|
+
void setHasCouponCodeCallback(T view, boolean value);
|
|
22
|
+
void setHasOrderTrackingCallback(T view, boolean value);
|
|
19
23
|
}
|
|
@@ -54,70 +54,6 @@ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModu
|
|
|
54
54
|
invoke(eventName, null);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
protected final void emitOnConfirmHandlerCallback(ReadableMap value) {
|
|
58
|
-
invoke("onConfirmHandlerCallback", value);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
protected final void emitOnFinancialConnectionsEvent(ReadableMap value) {
|
|
62
|
-
invoke("onFinancialConnectionsEvent", value);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
protected final void emitOnOrderTrackingCallback() {
|
|
66
|
-
invoke("onOrderTrackingCallback");
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
protected final void emitOnCustomerAdapterFetchPaymentMethodsCallback() {
|
|
70
|
-
invoke("onCustomerAdapterFetchPaymentMethodsCallback");
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
protected final void emitOnCustomerAdapterAttachPaymentMethodCallback(ReadableMap value) {
|
|
74
|
-
invoke("onCustomerAdapterAttachPaymentMethodCallback", value);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
protected final void emitOnCustomerAdapterDetachPaymentMethodCallback(ReadableMap value) {
|
|
78
|
-
invoke("onCustomerAdapterDetachPaymentMethodCallback", value);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected final void emitOnCustomerAdapterSetSelectedPaymentOptionCallback(ReadableMap value) {
|
|
82
|
-
invoke("onCustomerAdapterSetSelectedPaymentOptionCallback", value);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
protected final void emitOnCustomerAdapterFetchSelectedPaymentOptionCallback() {
|
|
86
|
-
invoke("onCustomerAdapterFetchSelectedPaymentOptionCallback");
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected final void emitOnCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback() {
|
|
90
|
-
invoke("onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback");
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
protected final void emitEmbeddedPaymentElementDidUpdateHeight(ReadableMap value) {
|
|
94
|
-
invoke("embeddedPaymentElementDidUpdateHeight", value);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
protected final void emitEmbeddedPaymentElementWillPresent() {
|
|
98
|
-
invoke("embeddedPaymentElementWillPresent");
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
protected final void emitEmbeddedPaymentElementDidUpdatePaymentOption(ReadableMap value) {
|
|
102
|
-
invoke("embeddedPaymentElementDidUpdatePaymentOption", value);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
protected final void emitEmbeddedPaymentElementFormSheetConfirmComplete(ReadableMap value) {
|
|
106
|
-
invoke("embeddedPaymentElementFormSheetConfirmComplete", value);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
protected final void emitEmbeddedPaymentElementRowSelectionImmediateAction() {
|
|
110
|
-
invoke("embeddedPaymentElementRowSelectionImmediateAction");
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
protected final void emitEmbeddedPaymentElementLoadingFailed(ReadableMap value) {
|
|
114
|
-
invoke("embeddedPaymentElementLoadingFailed", value);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
protected final void emitOnCustomPaymentMethodConfirmHandlerCallback(ReadableMap value) {
|
|
118
|
-
invoke("onCustomPaymentMethodConfirmHandlerCallback", value);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
57
|
@ReactMethod
|
|
122
58
|
@DoNotStrip
|
|
123
59
|
public abstract void initialise(ReadableMap params, Promise promise);
|
|
@@ -304,6 +240,14 @@ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModu
|
|
|
304
240
|
@DoNotStrip
|
|
305
241
|
public abstract void customerAdapterSetupIntentClientSecretForCustomerAttachCallback(String clientSecret, Promise promise);
|
|
306
242
|
|
|
243
|
+
@ReactMethod
|
|
244
|
+
@DoNotStrip
|
|
245
|
+
public abstract void clientSecretProviderSetupIntentClientSecretCallback(String setupIntentClientSecret, Promise promise);
|
|
246
|
+
|
|
247
|
+
@ReactMethod
|
|
248
|
+
@DoNotStrip
|
|
249
|
+
public abstract void clientSecretProviderCustomerSessionClientSecretCallback(ReadableMap customerSessionClientSecret, Promise promise);
|
|
250
|
+
|
|
307
251
|
@ReactMethod
|
|
308
252
|
@DoNotStrip
|
|
309
253
|
public abstract void createEmbeddedPaymentElement(ReadableMap intentConfig, ReadableMap configuration, Promise promise);
|
|
@@ -76,7 +76,7 @@ public class AddressSheetView: UIView {
|
|
|
76
76
|
let navigationController = UINavigationController(rootViewController: addressViewController!)
|
|
77
77
|
navigationController.modalPresentationStyle = getModalPresentationStyle()
|
|
78
78
|
navigationController.modalTransitionStyle = getModalTransitionStyle()
|
|
79
|
-
let vc = findViewControllerPresenter(from:
|
|
79
|
+
let vc = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
|
|
80
80
|
vc.present(navigationController, animated: true)
|
|
81
81
|
}
|
|
82
82
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
@interface RCT_EXTERN_MODULE(ApplePayButtonManager, RCTViewManager)
|
|
6
6
|
RCT_EXPORT_VIEW_PROPERTY(type, NSNumber)
|
|
7
7
|
RCT_EXPORT_VIEW_PROPERTY(buttonStyle, NSNumber)
|
|
8
|
-
RCT_EXPORT_VIEW_PROPERTY(
|
|
8
|
+
RCT_EXPORT_VIEW_PROPERTY(buttonBorderRadius, NSNumber)
|
|
9
9
|
RCT_EXPORT_VIEW_PROPERTY(disabled, BOOL)
|
|
10
10
|
RCT_EXPORT_VIEW_PROPERTY(onShippingMethodSelectedAction, RCTDirectEventBlock)
|
|
11
11
|
RCT_EXPORT_VIEW_PROPERTY(onShippingContactSelectedAction, RCTDirectEventBlock)
|
|
@@ -18,7 +18,7 @@ public class ApplePayButtonView: UIView {
|
|
|
18
18
|
|
|
19
19
|
@objc public var type: NSNumber?
|
|
20
20
|
@objc public var buttonStyle: NSNumber?
|
|
21
|
-
@objc public var
|
|
21
|
+
@objc public var buttonBorderRadius: NSNumber?
|
|
22
22
|
@objc public var disabled = false
|
|
23
23
|
|
|
24
24
|
@objc func handleApplePayButtonTapped() {
|
|
@@ -37,7 +37,7 @@ public class ApplePayButtonView: UIView {
|
|
|
37
37
|
let paymentButtonStyle = PKPaymentButtonStyle(rawValue: self.buttonStyle as? Int ?? 2) ?? .black
|
|
38
38
|
self.applePayButton = PKPaymentButton(paymentButtonType: paymentButtonType, paymentButtonStyle: paymentButtonStyle)
|
|
39
39
|
if #available(iOS 12.0, *) {
|
|
40
|
-
self.applePayButton?.cornerRadius = self.
|
|
40
|
+
self.applePayButton?.cornerRadius = self.buttonBorderRadius as? CGFloat ?? 4.0
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
if let applePayButton = self.applePayButton {
|
|
@@ -26,7 +26,7 @@ class FinancialConnections {
|
|
|
26
26
|
)
|
|
27
27
|
financialConnectionsSheet.onEvent = onEvent
|
|
28
28
|
financialConnectionsSheet.present(
|
|
29
|
-
from: findViewControllerPresenter(from:
|
|
29
|
+
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
|
|
30
30
|
completion: { result in
|
|
31
31
|
switch result {
|
|
32
32
|
case .completed(session: let session):
|
|
@@ -55,7 +55,7 @@ class FinancialConnections {
|
|
|
55
55
|
)
|
|
56
56
|
financialConnectionsSheet.onEvent = onEvent
|
|
57
57
|
financialConnectionsSheet.presentForToken(
|
|
58
|
-
from: findViewControllerPresenter(from:
|
|
58
|
+
from: findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController()),
|
|
59
59
|
completion: { result in
|
|
60
60
|
switch result {
|
|
61
61
|
case .completed(result: let result):
|