#Félix-terminal-cancel

1 messages · Page 1 of 1 (latest)

elfin mango
#

Hey! When you say 'my users the possibility to cancel the operation before their customers present their payment method', you men from the POS you're building or the Terminal device?

#

Is cancelCollectPaymentMethod only usable after the payment method has actually been collected ?
That shouldn't be the case

analog gazelle
#

Yes from the POS, from what I've seen there's no option to cancel the operation directly from the device

elfin mango
#

Can you share your code where you're calling cancelCollectPaymentMethod? I'd expect that to work if there's an a collectPaymentMethod instance active

analog gazelle
#

This is a react app, I'm passing this function as a prop to another component. However, at the time when this function is defined, the collectPaymentMethod hasn't been called yet on my terminal instance.

ionic lily
#

Hi! I'm taking over this thread.

#

If I understand correctly you are calling cancelCollectPaymentMethod() but it doesn't work as expected? Do you get an error message?

analog gazelle
#

I get the following error:

#

Unhandled Rejection (Error): Invalid state: cancelCollectPaymentMethod() cancels an active attempt to get a payment method from a customer. However, there was no active attempt.

#

The error's description states "cancelCollectPaymentMethod can only be called when collectPaymentMethod is in progress.", but collectPaymentMethod returns a Promise that resolves when the customer presents his card on the reader. In my use case, I would like to cancel when this Promise is still pending (the card hasn't been collected yet)

ionic lily
#

Sorry for the delay, asking a colleague about this.

analog gazelle
#

Nevermind, I found the solution to my problem. I was stuck because I was using async / await to define my cancel handler. Switching to .then() promise chaining solved it for me, thx