Files
TrisolarisServer/src/main/kotlin/com/android/trisolarisserver/config/PayuPaymentAttemptSchemaFix.kt
androidlover5842 e324eee065
All checks were successful
build-and-deploy / build-deploy (push) Successful in 37s
Store PayU payment metadata and attempts
2026-01-30 09:34:50 +05:30

50 lines
1.7 KiB
Kotlin

package com.android.trisolarisserver.config
import org.springframework.jdbc.core.JdbcTemplate
import org.springframework.stereotype.Component
@Component
class PayuPaymentAttemptSchemaFix(
private val jdbcTemplate: JdbcTemplate
) : PostgresSchemaFix(jdbcTemplate) {
override fun runPostgres(jdbcTemplate: JdbcTemplate) {
val hasTable = jdbcTemplate.queryForObject(
"""
select count(*)
from information_schema.tables
where table_name = 'payu_payment_attempt'
""".trimIndent(),
Int::class.java
) ?: 0
if (hasTable == 0) {
logger.info("Creating payu_payment_attempt table")
jdbcTemplate.execute(
"""
create table payu_payment_attempt (
id uuid primary key,
property_id uuid not null references property(id) on delete cascade,
booking_id uuid references booking(id) on delete set null,
status varchar,
unmapped_status varchar,
amount bigint,
currency varchar,
gateway_payment_id varchar,
gateway_txn_id varchar,
bank_ref_num varchar,
mode varchar,
pg_type varchar,
payer_vpa varchar,
payer_name varchar,
payment_source varchar,
error_code varchar,
error_message varchar,
payload text,
received_at timestamptz not null
)
""".trimIndent()
)
}
}
}