stripe / stripe-terminal-ios

Stripe Terminal iOS SDK
https://stripe.com/docs/terminal/sdk/ios
Other
104 stars 65 forks source link

BluetoothConnectionConfiguration - Argument passed to call that takes no arguments #290

Closed BradDoddsProjects closed 8 months ago

BradDoddsProjects commented 9 months ago

Summary

Code to reproduce

let connectionConfig = BluetoothConnectionConfiguration(locationId: "{{LOCATION_ID}}")
Terminal.shared.connectBluetoothReader(selectedReader, delegate: readerDelegate, connectionConfig: connectionConfig) { reader, error in
    if let reader = reader {
        print("Successfully connected to reader: \(reader)")
    } else if let error = error {
        print("connectBluetoothReader failed: \(error)")
    }
}

iOS version

iOS 17+ Minimum deployment target 13.0+ Stripe terminal SDK Version 3.3.1

Installation method

pod 'StripeTerminal', '~> 3.0'

SDK version

Stripe terminal SDK Version 3.3.1

Other information

I am receiving an error from xcode compiler when implementing BluetoothConnectionConfiguration that takes the location parameter locationId.

let connectionConfig = BluetoothConnectionConfiguration(locationId: "{{LOCATION_ID}}")

Is there new syntax when assigning connectionConfig? What is the new process?

Error:

Argument passed to call that takes no arguments

Is the website documentation outdated here with the new SDK update? Stripe documentation

I also have a detailed post on stack overflow here if you would like to dive deeper into the issue StackOverflow post

bric-stripe commented 9 months ago

sorry, yes those docs are outdated and we'll get those fixed up.

the input models now have builders that are required to generate the input. So for this case it should be:

let connectionConfig
do {
    connectionConfig = try BluetoothConnectionConfigurationBuilder(locationId: "...").build()
} catch {
    // handle error
    return
}
// valid connection config to use
...

for connection configuration the error raised is only for misconfiguration:

bric-stripe commented 9 months ago

the migration guide has some other changes worth noting when moving from 2.x to 3.x: https://docs.stripe.com/terminal/references/sdk-migration-guide

bric-stripe commented 8 months ago

The docs have been updated to the new syntax needed for 3.x. Thanks for reporting this.