Woodshop
Search…
Link users and Dwolla customers
The implementation of this smart relationship (belongsTo) relies on a Dwolla service that will retrieve the Dwolla customer based on the user's email. The Dwolla service is described in another section.
1
// forest/users.js
2
const { collection } = require('forest-express-sequelize');
3
4
const DwollaService = require('../services/dwolla-service');
5
let dwollaService = new DwollaService(process.env.DWOLLA_APP_KEY, process.env.DWOLLA_APP_SECRET, process.env.DWOLLA_ENVIRONMENT);
6
7
collection('users', {
8
actions: [],
9
fields: [
10
{
11
field: 'dwollaCustomer',
12
type: 'String',
13
reference: 'dwollaCustomers.id',
14
get: function (user) {
15
return dwollaService.getCustomerSmartRelationship(user);
16
}
17
},
18
],
19
segments: [],
20
});
Copied!
Last modified 9mo ago
Copy link