Skip to content

Commit

Permalink
move around cancelables
Browse files Browse the repository at this point in the history
  • Loading branch information
nazli-stripe committed May 22, 2024
1 parent b49645c commit 4c7f3b7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ios/StripeTerminalReactNative.swift
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
}
cancelable.cancel() { error in
if let error = error as NSError? {
resolve(Errors.createError(nsError: error))
self.discoverCancelable = nil
resolve(Errors.createError(nsError: error))
} else {
resolve([:])
self.discoverCancelable = nil
resolve([:])
}
}
}
Expand Down Expand Up @@ -555,7 +555,6 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
let paymentIntent = Mappers.mapFromPaymentIntent(paymentIntent, uuid: uuid)
resolve(["paymentIntent": paymentIntent])
}
self.collectPaymentMethodCancelable = nil
}
}

Expand Down Expand Up @@ -635,6 +634,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
resolve(["paymentIntent": paymentIntent])
}
}
self.collectPaymentMethodCancelable = nil
}

func terminal(_ terminal: Terminal, didChangePaymentStatus status: PaymentStatus) {
Expand Down Expand Up @@ -836,7 +836,6 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
let setupIntent = Mappers.mapFromSetupIntent(setupIntent, uuid: uuid)
resolve(["setupIntent": setupIntent])
}
self.collectSetupIntentCancelable = nil
}
}

Expand All @@ -861,6 +860,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
resolve(["setupIntent": setupIntent])
}
}
self.collectRefundPaymentMethodCancelable = nil
}

@objc(collectRefundPaymentMethod:resolver:rejecter:)
Expand Down Expand Up @@ -917,7 +917,6 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
} else {
resolve([:])
}
self.collectRefundPaymentMethodCancelable = nil
}
}

Expand All @@ -931,6 +930,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe
resolve(["refund": refund])
}
}
self.collectRefundPaymentMethodCancelable = nil
}

@objc(clearCachedCredentials:rejecter:)
Expand Down

0 comments on commit 4c7f3b7

Please sign in to comment.