working with db, docker working, small error with personal data
This commit is contained in:
@@ -19,8 +19,8 @@ export default class PaymentsHandler {
|
||||
await db.networks.update(
|
||||
networkId,
|
||||
{
|
||||
stripeAccountId: stripe_user_id,
|
||||
stripeAccessToken: access_token, // rarely used, long-term access token for the platform
|
||||
stripe_account_id: stripe_user_id,
|
||||
stripe_access_token: access_token, // rarely used, long-term access token for the platform
|
||||
}
|
||||
);
|
||||
|
||||
@@ -28,10 +28,10 @@ export default class PaymentsHandler {
|
||||
}
|
||||
|
||||
static async getProfile(networkId) {
|
||||
let network = global.db.networks.get(networkId)
|
||||
let network = await global.db.networks.get(networkId)
|
||||
if (network) {
|
||||
if (network.stripeAccountId) {
|
||||
const account = await stripe.accounts.retrieve(network.stripeAccountId);
|
||||
if (network.stripe_account_id) {
|
||||
const account = await stripe.accounts.retrieve(network.stripe_account_id);
|
||||
return {
|
||||
chargesEnabled: account.charges_enabled,
|
||||
payoutsEnabled: account.payouts_enabled,
|
||||
@@ -48,13 +48,13 @@ export default class PaymentsHandler {
|
||||
}
|
||||
|
||||
static async getCustomers(networkId) {
|
||||
let network = global.db.networks.get(networkId)
|
||||
if(!network.stripeAccountId) {
|
||||
let network = await global.db.networks.get(networkId)
|
||||
if(!network.stripe_account_id) {
|
||||
throw new Error("Can't get customers for account that doesn't exist!")
|
||||
}
|
||||
const customers = await stripe.customers.list(
|
||||
{ limit: 100, expand: ['data.subscriptions'] },
|
||||
{ stripeAccount: network.stripeAccountId }
|
||||
{ stripeAccount: network.stripe_account_id }
|
||||
);
|
||||
|
||||
return customers.data.map(customer => ({
|
||||
|
||||
Reference in New Issue
Block a user