package cz.moneta.test.system.openapi;

import cz.moneta.test.dsl.Harness;
import cz.moneta.test.harness.annotations.TestCase;
import cz.moneta.test.harness.annotations.TestScenario;

@TestScenario(name = "Test OpenApi")
public class OpenApiTest {

    @TestCase(name = "Check OpenApi connection")
    public void callOpenApi(Harness harness) {
        harness.withOpenApi()
                .prepareRequest()
                .withPath("/hello")
                .get()
                .andAssertFieldValue("status", "OK");
    }

    @TestCase(name = "Rest download base64 file preview")
    public void callOpenApiAndDownloadReceipt(Harness harness) {
        harness.withOpenApi()
                .prepareUnsecuredRequest()
                .withPath("/account/transaction/receipt")
                .withHeader("dispo-context-id", "10062336")
                .withPayload("{\"transactionId\":\"0206971718:20250917:00013:250917C01846101\"}")
                .post()
                .andAssertFieldValue("status", "OK")
                .saveBase64FieldAsFile("responseObject.base64PdfReceipt");
    }
}