Skip to content

Commit

Permalink
Add compiled submitted evidence endpoint to disputes (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
armando-rodriguez-cko committed Mar 22, 2024
1 parent 79a0909 commit 0bfa752
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Checkout/Disputes/DisputesClient.php
Expand Up @@ -10,6 +10,7 @@ class DisputesClient extends FilesClient
const DISPUTES_PATH = "disputes";
const ACCEPT_PATH = "accept";
const EVIDENCE_PATH = "evidence";
const SUBMITTED_PATH = "submitted";
const SCHEME_FILES_PATH = "schemefiles";

/**
Expand Down Expand Up @@ -95,6 +96,19 @@ public function submitEvidence($disputeId)
);
}

/**
* @param string $disputeId
* @return array
* @throws CheckoutApiException
*/
public function getCompiledSubmittedEvidence($disputeId)
{
return $this->apiClient->get(
$this->buildPath(self::DISPUTES_PATH, $disputeId, self::EVIDENCE_PATH, self::SUBMITTED_PATH),
$this->sdkAuthorization()
);
}

/**
* @param string $disputeId
* @return array
Expand Down
14 changes: 14 additions & 0 deletions test/Checkout/Tests/Disputes/DisputesClientTest.php
Expand Up @@ -120,6 +120,20 @@ public function shouldSubmitEvidence()
$this->assertNotNull($response);
}

/**
* @test
* @throws CheckoutApiException
*/
public function shouldGetCompiledSubmittedEvidence()
{
$this->apiClient
->method("get")
->willReturn("foo");

$response = $this->client->getCompiledSubmittedEvidence("dispute_id");
$this->assertNotNull($response);
}

/**
* @test
* @throws CheckoutApiException
Expand Down
11 changes: 11 additions & 0 deletions test/Checkout/Tests/Disputes/DisputesIntegrationTest.php
Expand Up @@ -142,6 +142,17 @@ function () use (&$filter) {
self::assertArrayHasKey("http_metadata", $updateResponse);
self::assertEquals(204, $updateResponse["http_metadata"]->getStatusCode());

//Get compiled submitted evidence
$compiledSubmittedEvidenceResponse
= $this->checkoutApi->getDisputesClient()->getCompiledSubmittedEvidence($disputeId);
$this->assertResponse(
$compiledSubmittedEvidenceResponse,
"file_id",
"_links",
"_links.self"
);


$evidence = $this->checkoutApi->getDisputesClient()->getEvidence($disputeId);
$this->assertResponse(
$evidence,
Expand Down

0 comments on commit 0bfa752

Please sign in to comment.