Ensured that destroying member removes stripe customer

no-issue

This also mean sthe subscription will be cancelled
This commit is contained in:
Fabien O'Carroll 2019-09-06 13:22:53 +08:00
parent ec3948287f
commit 4ead495b45

View File

@ -31,10 +31,21 @@ module.exports = function ({
} }
} }
async function destroy(data, options) {
const member = await getMember(data, options);
if (!member) {
return;
}
if (stripe) {
await stripe.removeCustomer(member);
}
return deleteMember(data, options);
}
return { return {
create: createMember, create: createMember,
list: listMembers, list: listMembers,
get, get,
destroy: deleteMember destroy
}; };
}; };