(t *testing.T)
| 4484 | } |
| 4485 | |
| 4486 | func TestRefundAlreadyRefundedTransaction(t *testing.T) { |
| 4487 | // Skip in short mode |
| 4488 | if testing.Short() { |
| 4489 | t.Skip("Skipping queue flow test in short mode") |
| 4490 | } |
| 4491 | |
| 4492 | ctx := context.Background() |
| 4493 | cnf := &config.Configuration{ |
| 4494 | Redis: config.RedisConfig{ |
| 4495 | Dns: "localhost:6379", |
| 4496 | }, |
| 4497 | DataSource: config.DataSourceConfig{ |
| 4498 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 4499 | }, |
| 4500 | Queue: config.QueueConfig{ |
| 4501 | WebhookQueue: "webhook_queue_test", |
| 4502 | IndexQueue: "index_queue_test", |
| 4503 | TransactionQueue: "transaction_queue_test", |
| 4504 | NumberOfQueues: 1, |
| 4505 | }, |
| 4506 | Server: config.ServerConfig{ |
| 4507 | SecretKey: "test-secret", |
| 4508 | }, |
| 4509 | Transaction: config.TransactionConfig{ |
| 4510 | BatchSize: 100, |
| 4511 | MaxQueueSize: 1000, |
| 4512 | LockDuration: time.Second * 30, |
| 4513 | IndexQueuePrefix: "test_index", |
| 4514 | }, |
| 4515 | } |
| 4516 | config.ConfigStore.Store(cnf) |
| 4517 | |
| 4518 | ds, err := database.NewDataSource(cnf) |
| 4519 | require.NoError(t, err, "Failed to create datasource") |
| 4520 | |
| 4521 | ledgerforge, err := NewLedgerForge(ds) |
| 4522 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 4523 | |
| 4524 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("test_already_refunded") |
| 4525 | |
| 4526 | // Create test balances |
| 4527 | sourceBalance := &model.Balance{ |
| 4528 | Currency: "USD", |
| 4529 | LedgerID: "general_ledger_id", |
| 4530 | } |
| 4531 | destBalance := &model.Balance{ |
| 4532 | Currency: "USD", |
| 4533 | LedgerID: "general_ledger_id", |
| 4534 | } |
| 4535 | |
| 4536 | source, err := ds.CreateBalance(*sourceBalance) |
| 4537 | require.NoError(t, err, "Failed to create source balance") |
| 4538 | |
| 4539 | dest, err := ds.CreateBalance(*destBalance) |
| 4540 | require.NoError(t, err, "Failed to create destination balance") |
| 4541 | |
| 4542 | // Create a standard transaction |
| 4543 | originalAmount := 500.0 |
nothing calls this directly
no test coverage detected