-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(payment-stripe): add disputes (chargebacks) and evidences (#123)
* feat(payment-stripe): dispute entity and parser helper class * feat(payment-stripe): clean up * feat(payment-stripe): add evidence details * feat(payment-stripe): update parser * feat(payment-stripe): add dispute creation webhook handler * docs(payment-stripe): update stripe testing docs * feat(payment-stripe): clean up * feat(payment-stripe): update jsdocs * feat(payment-stripe): clean up * feat(payment-stripe): clean up * feat(payment-stripe): update disputes entity composition * feat(payment-stripe): add dispute internal events * feat(payment-stripe): clean up * feat(payment-stripe): clean up * feat(payment-stripe): clean up * feat(payment-stripe): add dispute events and update configs (#124) * feat(payment-stripe): add dispute fee in configs * feat(payment-stripe): update dispute calculations * feat(payment-stripe): clean up * feat(payment-stripe): clean up * feat(payment-stripe): clean up * feat(payment-stripe): clean up * docs(payment-stripe): update envs * feat(payment-stripe): add webhook handlers service (#125) * feat(payment-stripe): add webhook handlers service * feat(payment-stripe): update webhook handlers infra * feat(payment-stripe): update jsdocs * feat(payment-stripe): add charge webhook handlers * feat(payment-stripe): clean up * feat(payment-stripe): update migration namings * feat(payment-stripe): dispute transaction (#126) * feat(payment-stripe): update method permissions * feat(payment-stripe): update models permissions * feat(payment-stripe): clean up * feat(payment-stripe): clean up
- Loading branch information
Showing
44 changed files
with
2,376 additions
and
932 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
microservices/payment-stripe/migrations/1701685975841-dispute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { MigrationInterface, QueryRunner } from 'typeorm'; | ||
|
||
export default class dispute1701685975841 implements MigrationInterface { | ||
name = 'dispute1701685975841'; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await 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"))`, | ||
); | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."dispute_reason_enum" AS ENUM('bankCannotProcess', 'checkReturned', 'creditNotProcessed', 'customerInitiated', 'debitNotAuthorized', 'duplicate', 'fraudulent', 'general', 'incorrectAccountDetails', 'insufficientFunds', 'productNotReceived', 'productUnacceptable', 'subscriptionCanceled', 'unrecognized')`, | ||
); | ||
await queryRunner.query( | ||
`CREATE TYPE "public"."dispute_status_enum" AS ENUM('warningNeedsResponse', 'warningUnderReview', 'warningClosed', 'needsResponse', 'underReview', 'won', 'lost')`, | ||
); | ||
await 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"))`, | ||
); | ||
await 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`, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`ALTER TABLE "evidence_details" DROP CONSTRAINT "evidence_details(fk):disputeId"`, | ||
); | ||
await queryRunner.query(`DROP TABLE "dispute"`); | ||
await queryRunner.query(`DROP TYPE "public"."dispute_status_enum"`); | ||
await queryRunner.query(`DROP TYPE "public"."dispute_reason_enum"`); | ||
await queryRunner.query(`DROP TABLE "evidence_details"`); | ||
} | ||
} |
Oops, something went wrong.