You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: service_test.go
    path of file: ./repos/storj/satellite/payments/storjscan
    
    the code of the file until where you have to start completion: // Copyright (C) 2022 Storj Labs, Inc.
// See LICENSE for copying information.

package storjscan_test

import (
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"go.uber.org/zap/zaptest"

	"storj.io/common/currency"
	"storj.io/common/testcontext"
	"storj.io/common/testrand"
	"storj.io/storj/private/blockchain"
	"storj.io/storj/satellite"
	"storj.io/storj/satellite/payments"
	"storj.io/storj/satellite/payments/billing"
	"storj.io/storj/satellite/payments/storjscan"
	"storj.io/storj/satellite/payments/storjscan/blockchaintest"
	"storj.io/storj/satellite/satellitedb/satellitedbtest"
)

func TestServicePayments(t *testing.T) {
	satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
		paymentsDB := db.StorjscanPayments()
		now := time.Now().Truncate(time.Second).UTC()

		wallet1 := blockchaintest.NewAddress()
		wallet2 := blockchaintest.NewAddress()

		walletPayments := []payments.WalletPayment{
    
func TestListPayments(t *testing.T) {
	satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
		paymentsDB := db.StorjscanPayments()
		now := time.Now().Truncate(time.Second).UTC()

		wallet1 := blockchaintest.NewAddress()
		walletPaymentsBatch1 := []payments.WalletPayment{
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(100, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 0,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    1,
				Timestamp:   now,
			},
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(100, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 0,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    2,
				Timestamp:   now,
			},
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(100, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 0,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    3,
				Timestamp:   now,
			},
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(200, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 1,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    0,
				Timestamp:   now.Add(15 * time.Second),
			},
		}

		var cachedPayments1 []storjscan.CachedPayment
		for _, pmnt := range walletPaymentsBatch1 {
			cachedPayments1 = append(cachedPayments1, storjscan.CachedPayment{
				From:        pmnt.From,
				To:          pmnt.To,
				TokenValue:  pmnt.TokenValue,
				USDValue:    pmnt.USDValue,
				Status:      pmnt.Status,
				ChainID:     pmnt.ChainID,
				BlockHash:   pmnt.BlockHash,
				BlockNumber: pmnt.BlockNumber,
				Transaction: pmnt.Transaction,
				LogIndex:    pmnt.LogIndex,
				Timestamp:   pmnt.Timestamp,
			})
		}

		err := paymentsDB.InsertBatch(ctx, cachedPayments1)
		require.NoError(t, err)

		confirmedPayments, err := paymentsDB.ListConfirmed(ctx, billing.StorjScanEthereumSource, 1, 0, 0)
		require.NoError(t, err)
		require.Equal(t, len(cachedPayments1), len(confirmedPayments))
		for _, act := range confirmedPayments {
			for _, exp := range cachedPayments1 {
				if act.BlockHash == exp.BlockHash && act.LogIndex == exp.LogIndex {
					compareTransactions(t, exp, act)
					break
				}
			}
		}

		// these payments should be picked since it's same block number, but has a higher Log index.
		walletPaymentsBatch2 := []payments.WalletPayment{
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(100, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 1,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    2,
				Timestamp:   now,
			},
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(200, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 1,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    3,
				Timestamp:   now.Add(15 * time.Second),
			},
			{
				From:        blockchaintest.NewAddress(),
				To:          wallet1,
				TokenValue:  currency.AmountFromBaseUnits(200, currency.StorjToken),
				USDValue:    currency.AmountFromBaseUnits(100, currency.USDollarsMicro),
				Status:      payments.PaymentStatusConfirmed,
				ChainID:     1,
				BlockHash:   blockchaintest.NewHash(),
				BlockNumber: 2,
				Transaction: blockchaintest.NewHash(),
				LogIndex:    0,
				Timestamp:   now.Add(15 * time.Second),
			},
		}

		var cachedPayments2 []storjscan.CachedPayment
		for _, pmnt := range walletPaymentsBatch2 {
			cachedPayments2 = append(cachedPayments2, storjscan.CachedPayment{
				From:        pmnt.From,
				To:          pmnt.To,
				TokenValue:  pmnt.TokenValue,
				USDValue:    pmnt.USDValue,
				ChainID:     pmnt.ChainID,
				Status:      pmnt.Status,
				BlockHash:   pmnt.BlockHash,
				BlockNumber: pmnt.BlockNumber,
				Transaction: pmnt.Transaction,
				LogIndex:    pmnt.LogIndex,
				Timestamp:   pmnt.Timestamp,
			})
		}

		err = paymentsDB.InsertBatch(ctx, cachedPayments2)
		require.NoError(t, err)

		confirmedPayments, err = paymentsDB.ListConfirmed(ctx, billing.StorjScanEthereumSource, 1, 1, 1)
		require.NoError(t, err)
		require.Equal(t, len(cachedPayments2), len(confirmedPayments))
		for _, act := range confirmedPayments {
			for _, exp := range cachedPayments2 {
				if act.BlockHash == exp.BlockHash && act.LogIndex == exp.LogIndex {
					compareTransactions(t, exp, act)
					break
				}
			}
		}
	})
}