Store PayU payment metadata and attempts
All checks were successful
build-and-deploy / build-deploy (push) Successful in 37s

This commit is contained in:
androidlover5842
2026-01-30 09:34:50 +05:30
parent 52bcdd3648
commit e324eee065
7 changed files with 256 additions and 15 deletions

View File

@@ -0,0 +1,49 @@
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()
)
}
}
}