showing more info for stripe members, showing data in proper table
This commit is contained in:
@@ -79,7 +79,6 @@ export default class Database {
|
||||
}
|
||||
|
||||
updateNode(prefix, id, toEdit) {
|
||||
console.log("update node, ", toEdit)
|
||||
try {
|
||||
let model = nodeModels[prefix]
|
||||
if(model) {
|
||||
@@ -130,9 +129,7 @@ export default class Database {
|
||||
try {
|
||||
let model = edgeModels[prefix]
|
||||
if(model) {
|
||||
console.log(model.indices[0] + (id - 1))
|
||||
this.edges[model.indices[0] + (id - 1)] = 0
|
||||
console.log(this.edges[model.indices[0] + (id - 1)])
|
||||
} else {
|
||||
throw new Error("Type does not exist for edge: " + prefix)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class Server {
|
||||
const contact = contactRaw.trim() ? JSON.parse(contactRaw) : [];
|
||||
const members = db.members.getByNetwork(networkId)
|
||||
let stripeMembers = await payments.getCustomers(networkId)
|
||||
stripeMembers = stripeMembers.data
|
||||
console.log("stripemenbers: ", stripeMembers)
|
||||
|
||||
res.json({
|
||||
join,
|
||||
|
||||
@@ -8,7 +8,6 @@ export default class PaymentsHandler {
|
||||
|
||||
static async finishConnectSetup(req, res) {
|
||||
const { code, networkId } = req.body;
|
||||
console.log("onboarded", networkId)
|
||||
|
||||
const response = await stripe.oauth.token({
|
||||
grant_type: "authorization_code",
|
||||
@@ -54,10 +53,26 @@ export default class PaymentsHandler {
|
||||
throw new Error("Can't get customers for account that doesn't exist!")
|
||||
}
|
||||
const customers = await stripe.customers.list(
|
||||
{ limit: 100 },
|
||||
{ limit: 100, expand: ['data.subscriptions'] },
|
||||
{ stripeAccount: network.stripeAccountId }
|
||||
);
|
||||
return customers
|
||||
console.log(customers)
|
||||
|
||||
return customers.data.map(customer => ({
|
||||
id: customer.id,
|
||||
email: customer.email,
|
||||
created: customer.created,
|
||||
name: customer.name,
|
||||
phone: customer.phone,
|
||||
city: customer.address?.city,
|
||||
subscriptions: customer.subscriptions?.data.map(sub => ({
|
||||
id: sub.id,
|
||||
status: sub.status,
|
||||
amount: sub.items.data[0]?.price.unit_amount / 100, // converts cents to dollars
|
||||
currency: sub.items.data[0]?.price.currency,
|
||||
interval: sub.items.data[0]?.price.recurring?.interval
|
||||
}))
|
||||
}))
|
||||
}
|
||||
|
||||
static async newSubscription(req, res) {
|
||||
|
||||
Reference in New Issue
Block a user