cocoastorm / vue-paypal-checkout

A simple Vue.js wrapper component for paypal-checkout
MIT License
153 stars 67 forks source link

Emit payment-error event #90

Open nicholi opened 5 years ago

nicholi commented 5 years ago

This simply ties into the onError event from paypal-checkout. Same general flow as payment-cancelled event implementation. I also reverted the zoid/xcomponent unit test (so all tests pass again) and left the rebuild out of this branch. I assume you will want to do that in your normal pre-release setup.

At minimum allows to catch if there were any errors in request. I have been able to catch a DUPLICATE_TRANSACTION error with it. Unfortunately the error object returned is very bare, but at least allows you to inform customers there was a problem with payment. Very surprised this wasn't already implemented.

Anyone needing to tie into this event right now, can install from secondary branch where I performed the full build as 3.2.1-rc1: https://github.com/Nicholi/vue-paypal-checkout/tree/beta_3.2.1 npm install --save 'Nicholi/vue-paypal-checkout#beta_3.2.1'