handling stripe disputes/chargeback where renter disputes the charge through their credit card company or bank
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
// Add 'on_hold' to the existing payoutStatus enum
|
||||
await queryInterface.sequelize.query(`
|
||||
ALTER TYPE "enum_Rentals_payoutStatus" ADD VALUE IF NOT EXISTS 'on_hold';
|
||||
`);
|
||||
},
|
||||
|
||||
down: async (queryInterface, Sequelize) => {
|
||||
// Note: PostgreSQL doesn't support removing enum values directly
|
||||
// This would require recreating the enum type
|
||||
console.log(
|
||||
"Cannot remove enum value - manual intervention required if rollback needed"
|
||||
);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
up: async (queryInterface, Sequelize) => {
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeStatus", {
|
||||
type: Sequelize.ENUM("open", "won", "lost", "warning_closed"),
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeId", {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeReason", {
|
||||
type: Sequelize.STRING,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeAmount", {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeCreatedAt", {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeEvidenceDueBy", {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeClosedAt", {
|
||||
type: Sequelize.DATE,
|
||||
allowNull: true,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeLost", {
|
||||
type: Sequelize.BOOLEAN,
|
||||
defaultValue: false,
|
||||
});
|
||||
await queryInterface.addColumn("Rentals", "stripeDisputeLostAmount", {
|
||||
type: Sequelize.INTEGER,
|
||||
allowNull: true,
|
||||
});
|
||||
},
|
||||
|
||||
down: async (queryInterface) => {
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeStatus");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeId");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeReason");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeAmount");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeCreatedAt");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeEvidenceDueBy");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeClosedAt");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeLost");
|
||||
await queryInterface.removeColumn("Rentals", "stripeDisputeLostAmount");
|
||||
await queryInterface.sequelize.query(
|
||||
'DROP TYPE IF EXISTS "enum_Rentals_stripeDisputeStatus";'
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user