adding integration with payment sources table and within stripe controller

This commit is contained in:
Arjun Patel
2019-05-11 03:27:30 -07:00
parent f865781c07
commit 3c55717dda
6 changed files with 187 additions and 7 deletions
+10 -1
View File
@@ -35,9 +35,18 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.UUID,
allowNull: false,
references: {
model: Donor(sequelize, DataTypes),
model: 'donors',
key: 'id'
}
},
payment_source_id: {
type: DataTypes.UUID,
references: {
//Required field
model: 'payment_sources',
field: 'id'
}
}
},
{
+39
View File
@@ -0,0 +1,39 @@
'use strict';
module.exports = (sequelize, DataTypes) => {
const PaymentSource = sequelize.define(
'PaymentSource',
{
id: {
allowNull: false,
primaryKey: true,
type: DataTypes.UUID
},
token: {
allowNull: false,
type: DataTypes.STRING
},
provider: {
allowNull: false,
type: DataTypes.STRING
},
donor_id: {
type: DataTypes.UUID,
allowNull: false,
references: {
model: 'donors',
key: 'id'
}
}
},
{
freezeTableName: true,
// define the table's name
tableName: 'payment_sources'
}
);
PaymentSource.associate = function(models) {
// associations can be defined here
};
return PaymentSource;
};