Fixed customer not fetched for billing update

no issue

The logic to fetch member for a checkout session was incorrectly creating a new customer instead of finding an existing one, so the member's billing details was not getting updated.
This commit is contained in:
Rish 2021-01-26 17:25:31 +05:30
parent a8782054ba
commit 0d7c06b5a8

View File

@ -182,10 +182,9 @@ module.exports = class StripeAPIService {
async getCustomerForMemberCheckoutSession(member) {
await member.related('stripeCustomers').fetch();
const customers = member.related('stripeCustomers');
for (const data of customers) {
for (const data of customers.models) {
try {
const customer = await this.getCustomer(data.customer_id);
const customer = await this.getCustomer(data.get('customer_id'));
if (!customer.deleted) {
return customer;
}