Skip to content

Commit f8cf8fd

Browse files
committed
8289 Show processing when collect completes on old flow
This commit updates the legacy payment and (interac) refund flows to show processing at the right time. There was a slight change to the `waitForCardToBeRemoved` function to enable this, otherwise the `remove card` message did not show when a card was left in (as it had been replaced by processing.)
1 parent 4c46331 commit f8cf8fd

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

Hardware/Hardware/CardReader/StripeCardReader/StripeCardReaderService.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,11 @@ extension StripeCardReaderService: CardReaderService {
228228
return promise(.success(()))
229229
}
230230

231+
// When this is used for a new payment, there is a new subscription to readerEvents, which won't rely the
232+
// old `.removeCard` message. If there is a card inserted, we manually send a display message prompting to
233+
// remove the card, and wait for that before continuing.
234+
self.sendReaderEvent(CardReaderEvent.make(displayMessage: .removeCard))
235+
231236
self.timerCancellable = Timer.publish(every: 1, tolerance: 0.1, on: .main, in: .default)
232237
.autoconnect()
233238
.receive(on: DispatchQueue.main)
@@ -260,12 +265,6 @@ extension StripeCardReaderService: CardReaderService {
260265
// steps produce a Future.
261266

262267
// If a card was left from a previous payment attempt, we want that removed before we initiate a new payment.
263-
// However, a new payment probably means a new subscription to readerEvents, which won't rely the old `.removeCard`
264-
// message. If there is a card inserted, we manually send a display message prompting to remove the card,
265-
// and wait for that before continuing.
266-
if isChipCardInserted {
267-
sendReaderEvent(CardReaderEvent.make(displayMessage: .removeCard))
268-
}
269268
return waitForInsertedCardToBeRemoved()
270269
.flatMap {
271270
self.createPaymentIntent(parameters)

WooCommerce/Classes/ViewModels/CardPresentPayments/CardPresentRefundOrchestrator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ final class CardPresentRefundOrchestrator {
4444
onWaitingForInput(inputMethods)
4545
case .displayMessage(let message):
4646
onDisplayMessage(message)
47+
case .cardDetailsCollected:
48+
onProcessingMessage()
4749
default:
4850
break
4951
}

WooCommerce/Classes/ViewModels/CardPresentPayments/LegacyPaymentCaptureOrchestrator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ final class LegacyPaymentCaptureOrchestrator {
6363
onWaitingForInput(inputMethods)
6464
case .displayMessage(let message):
6565
onDisplayMessage(message)
66-
case .cardRemovedAfterClientSidePaymentCapture:
66+
case .cardDetailsCollected, .cardRemovedAfterClientSidePaymentCapture:
6767
onProcessingMessage()
6868
default:
6969
break

0 commit comments

Comments
 (0)