Skip to content

Commit

Permalink
sync iOS with 0.30.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbark committed Aug 21, 2023
1 parent 5462573 commit 40fa4ac
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/stripe_ios/ios/Classes/Stripe Sdk/Mappers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ class Mappers {
if let address = shipping.address {
addressDetails = [
"city": address.city ?? NSNull(),
"state": address.state ?? NSNull(),
"country": address.country ?? NSNull(),
"line1": address.line1 ?? NSNull(),
"line2":address.line2 ?? NSNull(),
Expand Down
32 changes: 32 additions & 0 deletions packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk.swift
Original file line number Diff line number Diff line change
Expand Up @@ -650,6 +650,38 @@ class StripeSdk: RCTEventEmitter, STPBankSelectionViewControllerDelegate, UIAdap
}
}

@objc(handleNextActionForSetup:returnURL:resolver:rejecter:)

Check warning on line 653 in packages/stripe_ios/ios/Classes/Stripe Sdk/StripeSdk.swift

View workflow job for this annotation

GitHub Actions / Typo CI

objc

"objc" is a typo. Did you mean "obj"?
func handleNextActionForSetup(
setupIntentClientSecret: String,
returnURL: String?,
resolver resolve: @escaping RCTPromiseResolveBlock,
rejecter reject: @escaping RCTPromiseRejectBlock
){
let paymentHandler = STPPaymentHandler.shared()
paymentHandler.handleNextAction(forSetupIntent: setupIntentClientSecret, with: self, returnURL: returnURL) { status, setupIntent, handleActionError in
switch (status) {
case .failed:
resolve(Errors.createError(ErrorType.Failed, handleActionError))
break
case .canceled:
if let lastError = setupIntent?.lastSetupError {
resolve(Errors.createError(ErrorType.Canceled, lastError))
} else {
resolve(Errors.createError(ErrorType.Canceled, "The setup intent has been canceled"))
}
break
case .succeeded:
if let setupIntent = setupIntent {
resolve(Mappers.createResult("setupIntent", Mappers.mapFromSetupIntent(setupIntent: setupIntent)))
}
break
@unknown default:
resolve(Errors.createError(ErrorType.Unknown, "Cannot complete setup"))
break
}
}
}

@objc(collectBankAccount:clientSecret:params:resolver:rejecter:)
func collectBankAccount(
isPaymentIntent: Bool,
Expand Down
16 changes: 16 additions & 0 deletions packages/stripe_ios/ios/Classes/StripePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,22 @@ extension StripePlugin {
)
}

func handleNextActionForSetup(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let arguments = call.arguments as? FlutterMap,
let setupIntentClientSecret = arguments["setupIntentClientSecret"] as? String,
let returnURL = arguments["returnURL"] as? String
else {
result(FlutterError.invalidParams)
return
}
handleNextActionForSetup(
setupIntentClientSecret: setupIntentClientSecret,
returnURL: returnURL,
resolver: resolver(for: result),
rejecter: rejecter(for: result)
)
}

func dangerouslyUpdateCardDetails(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
guard let arguments = call.arguments as? FlutterMap,
let params = arguments["params"] as? NSDictionary else {
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.10.0'
stripe_version = '~> 23.12.0'
Pod::Spec.new do |s|
s.name = 'stripe_ios'
s.version = '0.0.1'
Expand Down

0 comments on commit 40fa4ac

Please sign in to comment.