package gateway

import (
	"testing"

	"github.com/tech/sendico/gateway/mntx/storage/model"
	"github.com/tech/sendico/pkg/payments/rail"
)

func TestIsFinalPayoutStatus_NeedsAttentionIsFinal(t *testing.T) {
	if !isFinalPayoutStatus(model.PayoutStatusNeedsAttention) {
		t.Fatal("expected needs_attention to be final")
	}
}

func TestToOpStatus_NeedsAttentionMapsToFailed(t *testing.T) {
	status, err := toOpStatus(&model.CardPayout{Status: model.PayoutStatusNeedsAttention})
	if err != nil {
		t.Fatalf("toOpStatus returned error: %v", err)
	}
	if status != rail.OperationResultFailed {
		t.Fatalf("unexpected operation result: got=%q want=%q", status, rail.OperationResultFailed)
	}
}
