Skip to content

Commit

Permalink
Merge branch 'main' into feat/7.0.0
Browse files Browse the repository at this point in the history
# Conflicts:
#	demo/angular/ios/App/Podfile.lock
#	package.json
#	packages/identity/Package.swift
#	packages/identity/package-lock.json
#	packages/identity/package.json
#	packages/payment/Package.swift
#	packages/payment/package-lock.json
#	packages/payment/package.json
#	packages/terminal/package-lock.json
#	packages/terminal/package.json
  • Loading branch information
rdlabo committed Feb 1, 2025
2 parents 5d54c37 + 76b3d65 commit 307a5be
Show file tree
Hide file tree
Showing 12 changed files with 56 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/identity/CapacitorCommunityStripeIdentity.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ Pod::Spec.new do |s|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '14.0'
s.dependency 'Capacitor'
s.dependency 'StripeIdentity', '~> 24.1.0'
s.dependency 'StripeIdentity', '~> 24.4.1'
s.swift_version = '5.1'
end
2 changes: 1 addition & 1 deletion packages/identity/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ext {
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'

playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+'
identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '21.2.+'
identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '21.4.+'
}

buildscript {
Expand Down
2 changes: 1 addition & 1 deletion packages/identity/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/payment/CapacitorCommunityStripe.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pod::Spec.new do |s|
s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}'
s.ios.deployment_target = '14.0'
s.dependency 'Capacitor'
s.dependency 'StripePaymentSheet', '~> 24.1.0'
s.dependency 'StripeApplePay', '~> 24.1.0'
s.dependency 'StripePaymentSheet', '~> 24.4.1'
s.dependency 'StripeApplePay', '~> 24.4.1'
s.swift_version = '5.1'
end
2 changes: 1 addition & 1 deletion packages/payment/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ext {
androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1'

playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+'
stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '21.2.+'
stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '21.4.+'
gsonVersion = project.hasProperty('gsonVersion') ? rootProject.ext.gsonVersion : '2.10.+'
}

Expand Down
2 changes: 1 addition & 1 deletion packages/payment/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions packages/terminal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ And update minSdkVersion to 26 And compileSdkVersion to 34 in your `android/app/
+ minSdkVersion = 30
```

If you are developing apps for Stripe Android devices (e.g. Stripe Reader S700), follow the Stripe's documentation for the client-side setup.
- [Stripe - Android configure your app](https://docs.stripe.com/terminal/features/apps-on-devices/build?terminal-sdk-platform=android&lang-android=java#setup-app)


## Usage

### Simple collect payment
Expand Down Expand Up @@ -1030,6 +1034,7 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: (
| **`Bluetooth`** | <code>'bluetooth'</code> |
| **`Usb`** | <code>'usb'</code> |
| **`TapToPay`** | <code>'tap-to-pay'</code> |
| **`HandOff`** | <code>'hand-off'</code> |
#### SimulateReaderUpdate
Expand Down
2 changes: 2 additions & 0 deletions packages/terminal/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ext {
volleyVersion = project.hasProperty('volleyVersion') ? rootProject.ext.volleyVersion : '1.2.1'
stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '4.1.0'
stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '4.1.0'
stripeterminalHandoffClientVersion = project.hasProperty('stripeterminalHandoffClientVersion') ? rootProject.ext.stripeterminalHandoffClientVersion : '4.1.0'
}

buildscript {
Expand Down Expand Up @@ -71,6 +72,7 @@ dependencies {

implementation "com.stripe:stripeterminal-core:$stripeterminalCoreVersion"
implementation "com.stripe:stripeterminal-taptopay:$stripeterminalTapToPayVersion"
implementation "com.stripe:stripeterminal-handoffclient:$stripeterminalHandoffClientVersion"
implementation "com.android.volley:volley:$volleyVersion"
implementation "com.google.android.gms:play-services-wallet:$playServicesWalletVersion"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import com.stripe.stripeterminal.external.callable.PaymentIntentCallback
import com.stripe.stripeterminal.external.callable.ReaderCallback
import com.stripe.stripeterminal.external.callable.TapToPayReaderListener
import com.stripe.stripeterminal.external.callable.TerminalListener
import com.stripe.stripeterminal.external.callable.HandoffReaderListener
import com.stripe.stripeterminal.external.models.BatteryStatus
import com.stripe.stripeterminal.external.models.CardPresentDetails
import com.stripe.stripeterminal.external.models.Cart
Expand Down Expand Up @@ -194,6 +195,9 @@ class StripeTerminal(
) {
config = DiscoveryConfiguration.BluetoothDiscoveryConfiguration(0, this.isTest!!)
this.terminalConnectType = TerminalConnectTypes.Bluetooth
} else if (call.getString("type") == TerminalConnectTypes.HandOff.webEventName) {
config = DiscoveryConfiguration.HandoffDiscoveryConfiguration()
this.terminalConnectType = TerminalConnectTypes.HandOff
} else {
call.unimplemented(call.getString("type") + " is not support now")
return
Expand Down Expand Up @@ -240,6 +244,8 @@ class StripeTerminal(
this.connectUsbReader(call)
} else if (this.terminalConnectType == TerminalConnectTypes.Bluetooth) {
this.connectBluetoothReader(call)
} else if (this.terminalConnectType == TerminalConnectTypes.HandOff) {
this.connectHandOffReader(call)
} else {
call.reject("type is not defined.")
}
Expand Down Expand Up @@ -440,6 +446,39 @@ class StripeTerminal(
Terminal.getInstance().connectReader(foundReader, config, this.readerCallback(call))
}

private fun connectHandOffReader(call: PluginCall) {
val reader = call.getObject("reader")
val serialNumber = reader.getString("serialNumber")
val foundReader = this.discoveredReadersList.firstOrNull()

if (serialNumber == null || foundReader == null) {
call.reject("The reader value is not set correctly.")
return
}

val config: ConnectionConfiguration.HandoffConnectionConfiguration = ConnectionConfiguration.HandoffConnectionConfiguration(
this.handoffReaderListener
)

Terminal.getInstance().connectReader(foundReader, config, this.readerCallback(call))
}

var handoffReaderListener: HandoffReaderListener = object : HandoffReaderListener {
override fun onDisconnect(reason: DisconnectReason) {
notifyListeners(
TerminalEnumEvent.DisconnectedReader.webEventName,
JSObject().put("reason", reason.toString())
)
}

override fun onReportReaderEvent(event: ReaderEvent) {
notifyListeners(
TerminalEnumEvent.ReaderEvent.webEventName,
JSObject().put("event", event.toString())
)
}
}

fun cancelDiscoverReaders(call: PluginCall) {
if (discoveryCancelable == null || discoveryCancelable!!.isCompleted) {
call.resolve()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ enum class TerminalConnectTypes(val webEventName: String) {
Bluetooth("bluetooth"),
Usb("usb"),
TapToPay("tap-to-pay"),
HandOff("hand-off"),
}
2 changes: 1 addition & 1 deletion packages/terminal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/terminal/src/stripe.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export enum TerminalConnectTypes {
Bluetooth = 'bluetooth',
Usb = 'usb',
TapToPay = 'tap-to-pay',
HandOff = 'hand-off',
}

/**
Expand Down

0 comments on commit 307a5be

Please sign in to comment.