Steph payment isssues fix

This commit is contained in:
Muluhabt
2026-07-17 19:24:27 +03:00
parent 49a51c4bcc
commit daeabe1d79
3 changed files with 31 additions and 2 deletions

View File

@@ -0,0 +1,29 @@
import { MigrationInterface, QueryRunner } from "typeorm";
/**
* `reference_type` was varchar(16) but `SUPPLEMENTARY_CHARGE` is 20 characters, causing
* a value-too-long error whenever the passenger API initiates a supplementary-charge payment.
* Widen to varchar(32) to accommodate all current and near-future PaymentReferenceType values.
* Same fix applied to notification_outbox.reference_type for consistency.
*/
export class WideReferenceType1782100000000 implements MigrationInterface {
name = "WideReferenceType1782100000000";
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "edr_payment"."payment_intent" ALTER COLUMN "reference_type" TYPE varchar(32)`,
);
await queryRunner.query(
`ALTER TABLE "edr_payment"."notification_outbox" ALTER COLUMN "reference_type" TYPE varchar(32)`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "edr_payment"."notification_outbox" ALTER COLUMN "reference_type" TYPE varchar(16)`,
);
await queryRunner.query(
`ALTER TABLE "edr_payment"."payment_intent" ALTER COLUMN "reference_type" TYPE varchar(16)`,
);
}
}

View File

@@ -33,7 +33,7 @@ export class PaymentIntent extends BaseEntity {
@Column({ name: "service", type: "varchar", length: 16 })
service!: PaymentService;
@Column({ name: "reference_type", type: "varchar", length: 16 })
@Column({ name: "reference_type", type: "varchar", length: 32 })
referenceType!: PaymentReferenceType;
/** Domain order id (booking/shipment). Soft reference — no cross-schema FK. */

View File

@@ -28,7 +28,7 @@ export class NotificationOutbox extends BaseEntity {
@Column({ name: "intent_id", type: "uuid" })
intentId!: string;
@Column({ name: "reference_type", type: "varchar", length: 16 })
@Column({ name: "reference_type", type: "varchar", length: 32 })
referenceType!: PaymentReferenceType;
@Column({ name: "reference_id", type: "varchar", length: 64 })