add ability to cancel a payment intent#116
Conversation
|
Thanks for the PR! This looks good and I will try to get this deployed later today. |
|
Sorry @OMFG5716 , on second look You need to define the const { capture, cancel, ...rest } = data;on line Also, please remove the returns between the if blocks for consistency. It should look like _patch (id, data, params) {
const { stripe } = this.filterParams(params);
const { capture, cancel, ...rest } = data;
if (capture) {
return this.stripe.paymentIntents.capture(id, stripe);
}
if (cancel) {
return this.stripe.paymentIntents.cancel(id, stripe);
}
return this._update(id, rest, params);
} |
|
Ok Gotcha, I think apart from canceling I've missed one more status update for a PaymentIntent. I'll try and add that too and make sure that's destructured like above. I'll push shortly. |
|
Above fixes pushed! I meant, just like canceling, adding the ability to confirm a PaymentIntent, but I'll open a different PR for that I guess. |
|
Thanks! Yea, another PR would be best because this repo automatically generates a CHANGELOG from PR's so that way it will be reflected there. Thanks again! |
Added additional condition in the patch method of the PaymentIntent service. It checks for a key "cancel" that is passed to the data arg.
Now, one can cancel a payment intent by doing so:
feathers.service('stripe/payment-intent').patch(id, { cancel: true });