(t *testing.T)
| 3596 | } |
| 3597 | |
| 3598 | func TestStandardTransactionRefund(t *testing.T) { |
| 3599 | // Skip in short mode |
| 3600 | if testing.Short() { |
| 3601 | t.Skip("Skipping queue flow test in short mode") |
| 3602 | } |
| 3603 | |
| 3604 | ctx := context.Background() |
| 3605 | cnf := &config.Configuration{ |
| 3606 | Redis: config.RedisConfig{ |
| 3607 | Dns: "localhost:6379", |
| 3608 | }, |
| 3609 | DataSource: config.DataSourceConfig{ |
| 3610 | Dns: "postgres://postgres:password@localhost:5432/ledgerforge?sslmode=disable", |
| 3611 | }, |
| 3612 | Queue: config.QueueConfig{ |
| 3613 | WebhookQueue: "webhook_queue_test", |
| 3614 | IndexQueue: "index_queue_test", |
| 3615 | TransactionQueue: "transaction_queue_test", |
| 3616 | NumberOfQueues: 1, |
| 3617 | }, |
| 3618 | Server: config.ServerConfig{ |
| 3619 | SecretKey: "test-secret", |
| 3620 | }, |
| 3621 | Transaction: config.TransactionConfig{ |
| 3622 | BatchSize: 100, |
| 3623 | MaxQueueSize: 1000, |
| 3624 | LockDuration: time.Second * 30, |
| 3625 | IndexQueuePrefix: "test_index", |
| 3626 | }, |
| 3627 | } |
| 3628 | config.ConfigStore.Store(cnf) |
| 3629 | |
| 3630 | ds, err := database.NewDataSource(cnf) |
| 3631 | require.NoError(t, err, "Failed to create datasource") |
| 3632 | |
| 3633 | ledgerforge, err := NewLedgerForge(ds) |
| 3634 | require.NoError(t, err, "Failed to create LedgerForge instance") |
| 3635 | |
| 3636 | txnRef := "txn_" + model.GenerateUUIDWithSuffix("test") |
| 3637 | |
| 3638 | // Create test balances with initial amounts |
| 3639 | sourceBalance := &model.Balance{ |
| 3640 | Currency: "USD", |
| 3641 | LedgerID: "general_ledger_id", |
| 3642 | } |
| 3643 | destBalance := &model.Balance{ |
| 3644 | Currency: "USD", |
| 3645 | LedgerID: "general_ledger_id", |
| 3646 | } |
| 3647 | |
| 3648 | source, err := ds.CreateBalance(*sourceBalance) |
| 3649 | require.NoError(t, err, "Failed to create source balance") |
| 3650 | |
| 3651 | dest, err := ds.CreateBalance(*destBalance) |
| 3652 | require.NoError(t, err, "Failed to create destination balance") |
| 3653 | |
| 3654 | // Create a standard transaction with skip_queue set to true |
| 3655 | originalAmount := 500.0 |
nothing calls this directly
no test coverage detected