adding integration with payment sources table and within stripe controller
This commit is contained in:
+10
-1
@@ -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'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user