Skip to content

Commit

Permalink
sync with React Native 0.38.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbark committed Jul 23, 2024
1 parent c6f4100 commit c5be976
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/stripe_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version '1.0-SNAPSHOT'

buildscript {
ext.kotlin_version = '1.8.0'
ext.stripe_version = '20.44.+'
ext.stripe_version = '20.48.+'

repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PaymentSheetFragment(
private var confirmPromise: Promise? = null
private var presentPromise: Promise? = null
private var paymentSheetTimedOut = false
internal val paymentSheetIntentCreationCallback = CompletableDeferred<ReadableMap>()
internal var paymentSheetIntentCreationCallback = CompletableDeferred<ReadableMap>()

override fun onCreateView(
inflater: LayoutInflater,
Expand Down Expand Up @@ -148,6 +148,8 @@ class PaymentSheetFragment(
stripeSdkModule.sendEvent(context, "onConfirmHandlerCallback", params)

val resultFromJavascript = paymentSheetIntentCreationCallback.await()
// reset the completable
paymentSheetIntentCreationCallback = CompletableDeferred<ReadableMap>()

return@CreateIntentCallback resultFromJavascript.getString("clientSecret")?.let {
CreateIntentResult.Success(clientSecret = it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object PushProvisioningProxy {
)
}
} catch (e: Exception) {
Log.e(TAG, "PushProvisioning dependency not found")
Log.e(TAG, "There was a problem using Stripe Android PushProvisioning: " + e.message)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object TapAndPayProxy {

listTokensMethod.invoke(client) as Task<List<Any>>
} catch (e: Exception) {
Log.e(TAG, "Google TapAndPay dependency not found")
Log.e(TAG, "There was a problem listing tokens with Google TapAndPay: " + e.message)
null
}
}
Expand All @@ -39,7 +39,7 @@ object TapAndPayProxy {
val existingFpanLastFour = getFpanLastFourMethod.invoke(token) as String
existingFpanLastFour == newLastFour
} catch (e: Exception) {
Log.e(TAG, "There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.")
Log.e(TAG, "There was a problem getting the FPAN with Google TapAndPay: " + e.message)
false
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ object TapAndPayProxy {
token.getInt("network"),
REQUEST_CODE_TOKENIZE)
} catch (e: Exception) {
Log.e(TAG, "Google TapAndPay dependency not found.")
Log.e(TAG, "There was a problem tokenizing with Google TapAndPay: " + e.message)
}
}

Expand Down Expand Up @@ -114,8 +114,7 @@ object TapAndPayProxy {
"serviceProvider",
tokenInfoClass.getMethod("getTokenServiceProvider").invoke(it) as Int)
} catch (e: Exception) {
Log.e(TAG,
"There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.")
Log.e(TAG, "There was a problem mapping the token information with Google TapAndPay: " + e.message)
}
}
return result
Expand All @@ -134,8 +133,7 @@ object TapAndPayProxy {
else -> "UNKNOWN"
}
} catch (e: Exception) {
Log.e(TAG,
"There was a problem finding Google's TapAndPay dependency.")
Log.e(TAG, "There was a problem mapping the token state with Google TapAndPay: " + e.message)
return "UNKNOWN"
}
}
Expand Down
11 changes: 8 additions & 3 deletions packages/stripe_ios/ios/Classes/Stripe Sdk/CardFormView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ class CardFormView: UIView, STPCardFormViewDelegate {
@objc var disabled: Bool = false
@objc var preferredNetworks: Array<Int>? {
didSet {
if let preferredNetworks = preferredNetworks {
cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
}
setPreferredNetworks()
}
}

Expand All @@ -36,6 +34,7 @@ class CardFormView: UIView, STPCardFormViewDelegate {
self.cardForm = _cardForm
self.addSubview(_cardForm)
setStyles()
setPreferredNetworks()
}

@objc var cardStyle: NSDictionary = NSDictionary() {
Expand Down Expand Up @@ -107,6 +106,12 @@ class CardFormView: UIView, STPCardFormViewDelegate {
// }
}

func setPreferredNetworks() {
if let preferredNetworks = preferredNetworks {
cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
}
}

override init(frame: CGRect) {
super.init(frame: frame)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/stripe_ios/ios/stripe_ios.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
# Run `pod lib lint stripe_ios.podspec' to validate before publishing.
#
stripe_version = '~> 23.27.0'
stripe_version = '~> 23.28.0'
Pod::Spec.new do |s|
s.name = 'stripe_ios'
s.version = '0.0.1'
Expand Down

0 comments on commit c5be976

Please sign in to comment.