Heres my code:
var delete_card = function(){
stripe.customers.deleteCard(
this.service_id.stripe,
this.credit_card[0].stripe_id
)
.then(function(obj){
this.recipients.splice(0, 1);
return this.save()
})
}
Both the stripe call and the save call return promises.
How would I RETURN a promise from the delete_card method?
Would I wrap them all in like new Promise and return a promise from there?
How would I structure that so I bubble up both errors and results?
I want to be able to do something from the caller like this:
delete_card
.then(...)
.catch(...)
And just keep composing chained promises?