From 2e37bd7b4e2190a5dd28c30b3cbbaea3b77d4229 Mon Sep 17 00:00:00 2001 From: Stephanos A Date: Fri, 17 Jul 2026 18:41:59 +0300 Subject: [PATCH 1/2] Supplementary payments issue resolution --- .../1782100000000-WideReferenceType.ts | 29 +++++++++++++++++++ .../intents/entities/payment-intent.entity.ts | 2 +- .../entities/notification-outbox.entity.ts | 2 +- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 apps/edr-payment-api/src/migrations/1782100000000-WideReferenceType.ts diff --git a/apps/edr-payment-api/src/migrations/1782100000000-WideReferenceType.ts b/apps/edr-payment-api/src/migrations/1782100000000-WideReferenceType.ts new file mode 100644 index 000000000..7e2f63cb8 --- /dev/null +++ b/apps/edr-payment-api/src/migrations/1782100000000-WideReferenceType.ts @@ -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 { + 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 { + 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)`, + ); + } +} diff --git a/apps/edr-payment-api/src/modules/intents/entities/payment-intent.entity.ts b/apps/edr-payment-api/src/modules/intents/entities/payment-intent.entity.ts index 84e69a57a..be32804ec 100644 --- a/apps/edr-payment-api/src/modules/intents/entities/payment-intent.entity.ts +++ b/apps/edr-payment-api/src/modules/intents/entities/payment-intent.entity.ts @@ -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. */ diff --git a/apps/edr-payment-api/src/modules/outbox/entities/notification-outbox.entity.ts b/apps/edr-payment-api/src/modules/outbox/entities/notification-outbox.entity.ts index 55b34e968..61919f6c2 100644 --- a/apps/edr-payment-api/src/modules/outbox/entities/notification-outbox.entity.ts +++ b/apps/edr-payment-api/src/modules/outbox/entities/notification-outbox.entity.ts @@ -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 }) From 2567e251735b61bfc9e5ff2eb9f249a23de5f5fa Mon Sep 17 00:00:00 2001 From: Stephanos A Date: Fri, 17 Jul 2026 19:47:11 +0300 Subject: [PATCH 2/2] Supplementary amount issue resolution --- .../src/modules/payments/supplementary-charges.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/edr-passenger-api/src/modules/payments/supplementary-charges.service.ts b/apps/edr-passenger-api/src/modules/payments/supplementary-charges.service.ts index 8b604d905..9b62d433c 100644 --- a/apps/edr-passenger-api/src/modules/payments/supplementary-charges.service.ts +++ b/apps/edr-passenger-api/src/modules/payments/supplementary-charges.service.ts @@ -129,7 +129,7 @@ export class SupplementaryChargesService { referenceType: PaymentReferenceType.SUPPLEMENTARY_CHARGE, referenceId: charge.id, orderRef: `SC-${charge.id.substring(0, 8)}`, - amountMinor: charge.amountMinor, + amountMinor: charge.amountMinor / 100, currency: charge.currency, provider: paymentMethod, platform,