Skip to content

Commit

Permalink
Adds compiled submitted evidence endpoint. Update Hosted Payment Requ…
Browse files Browse the repository at this point in the history
…est (#156)

* Add disabled_payment_methods

* Add compiled submitted evidence endpoint to disputes
  • Loading branch information
armando-rodriguez-cko authored Mar 25, 2024
1 parent b22a913 commit 407d5d7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions checkout_sdk/disputes/disputes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,7 @@ class DisputeEvidenceRequest:
additional_evidence_text: str
proof_of_delivery_or_service_date_file: str
proof_of_delivery_or_service_date_text: str


class DisputeCompiledSubmittedEvidenceResponse:
file_id: str
8 changes: 8 additions & 0 deletions checkout_sdk/disputes/disputes_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class DisputesClient(FilesClient):
__DISPUTES_PATH = 'disputes'
__ACCEPT_PATH = 'accept'
__EVIDENCE_PATH = 'evidence'
__SUBMITTED_PATH = 'submitted'
__SCHEME_FILES_PATH = "schemefiles"

def __init__(self, api_client: ApiClient, configuration: CheckoutConfiguration):
Expand Down Expand Up @@ -41,6 +42,13 @@ def submit_evidence(self, dispute_id: str):
return self._api_client.post(self.build_path(self.__DISPUTES_PATH, dispute_id, self.__EVIDENCE_PATH),
self._sdk_authorization())

def get_compiled_submitted_evidence(self, dispute_id: str):
return self._api_client.get(self.build_path(
self.__DISPUTES_PATH, dispute_id,
self.__EVIDENCE_PATH,
self.__SUBMITTED_PATH),
self._sdk_authorization())

def get_dispute_scheme_files(self, dispute_id: str):
return self._api_client.get(self.build_path(self.__DISPUTES_PATH, dispute_id, self.__SCHEME_FILES_PATH),
self._sdk_authorization())
1 change: 1 addition & 0 deletions checkout_sdk/payments/hosted/hosted_payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class HostedPaymentsSessionRequest:
recipient: PaymentRecipient
processing: ProcessingSettings
allow_payment_methods: list # PaymentSourceType
disabled_payment_methods: list # PaymentSourceType
products: list # common.Product
risk: RiskRequest
success_url: str
Expand Down
4 changes: 4 additions & 0 deletions tests/disputes/disputes_client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def test_should_submit_evidence(self, mocker, client: DisputesClient):
mocker.patch('checkout_sdk.api_client.ApiClient.post', return_value='response')
assert client.submit_evidence('dispute_id') == 'response'

def test_should_get_compiled_submitted_evidence(self, mocker, client: DisputesClient):
mocker.patch('checkout_sdk.api_client.ApiClient.get', return_value='response')
assert client.get_compiled_submitted_evidence('dispute_id') == 'response'

def test_should_upload_file(self, mocker, client: DisputesClient):
mocker.patch('checkout_sdk.api_client.ApiClient.submit_file', return_value='response')
assert client.upload_file(FileRequest()) == 'response'
Expand Down
6 changes: 6 additions & 0 deletions tests/disputes/disputes_integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def test_should_test_full_disputes_workflow(default_api):

default_api.disputes.put_evidence(dispute_id, evidence_request)

submitted = default_api.disputes.get_compiled_submitted_evidence(dispute_id)
assert_response(submitted,
'file_id',
'_links',
'_links.self')

evidence = default_api.disputes.get_evidence(dispute_id)
assert_response(evidence,
'http_metadata',
Expand Down

0 comments on commit 407d5d7

Please sign in to comment.