@lomray/microservice-payment-stripe
Version:
Stripe payment microservice based on NodeJS & inverted json.
30 lines (26 loc) • 2.64 kB
JavaScript
'use strict';
var tslib = require('tslib');
class dispute1701685975841 {
constructor() {
this.name = 'dispute1701685975841';
}
up(queryRunner) {
return tslib.__awaiter(this, void 0, void 0, function* () {
yield queryRunner.query(`CREATE TABLE "evidence_details" ("disputeId" uuid NOT NULL, "hasEvidence" boolean NOT NULL DEFAULT false, "submissionCount" integer NOT NULL DEFAULT '0', "dueBy" TIMESTAMP, "isPastBy" boolean NOT NULL, CONSTRAINT "evidence_details(uq):disputeId" UNIQUE ("disputeId"), CONSTRAINT "evidence_details(pk):disputeId" PRIMARY KEY ("disputeId"))`);
yield queryRunner.query(`CREATE TYPE "public"."dispute_reason_enum" AS ENUM('bankCannotProcess', 'checkReturned', 'creditNotProcessed', 'customerInitiated', 'debitNotAuthorized', 'duplicate', 'fraudulent', 'general', 'incorrectAccountDetails', 'insufficientFunds', 'productNotReceived', 'productUnacceptable', 'subscriptionCanceled', 'unrecognized')`);
yield queryRunner.query(`CREATE TYPE "public"."dispute_status_enum" AS ENUM('warningNeedsResponse', 'warningUnderReview', 'warningClosed', 'needsResponse', 'underReview', 'won', 'lost')`);
yield queryRunner.query(`CREATE TABLE "dispute" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "transactionId" character varying(66), "disputeId" character varying(66) NOT NULL, "amount" integer NOT NULL, "chargedAmount" integer NOT NULL DEFAULT '0', "chargedFees" integer NOT NULL DEFAULT '0', "netWorth" integer NOT NULL DEFAULT '0', "reason" "public"."dispute_reason_enum" NOT NULL, "status" "public"."dispute_status_enum" NOT NULL, "params" json NOT NULL DEFAULT '{}', "metadata" json NOT NULL DEFAULT '{}', "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "dispute(pk):id" PRIMARY KEY ("id"))`);
yield queryRunner.query(`ALTER TABLE "evidence_details" ADD CONSTRAINT "evidence_details(fk):disputeId" FOREIGN KEY ("disputeId") REFERENCES "dispute"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
});
}
down(queryRunner) {
return tslib.__awaiter(this, void 0, void 0, function* () {
yield queryRunner.query(`ALTER TABLE "evidence_details" DROP CONSTRAINT "evidence_details(fk):disputeId"`);
yield queryRunner.query(`DROP TABLE "dispute"`);
yield queryRunner.query(`DROP TYPE "public"."dispute_status_enum"`);
yield queryRunner.query(`DROP TYPE "public"."dispute_reason_enum"`);
yield queryRunner.query(`DROP TABLE "evidence_details"`);
});
}
}
module.exports = dispute1701685975841;