from ..base import AdyenServiceBase


class ModificationsApi(AdyenServiceBase):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, client=None):
        super(ModificationsApi, self).__init__(client=client)
        self.service = "payments"
        self.baseUrl = "https://pal-test.adyen.com/pal/servlet/Payment/v68"

    def adjust_authorisation(self, request, idempotency_key=None, **kwargs):
        """
        Change the authorised amount
        """
        endpoint = self.baseUrl + f"/adjustAuthorisation"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def cancel(self, request, idempotency_key=None, **kwargs):
        """
        Cancel an authorisation
        """
        endpoint = self.baseUrl + f"/cancel"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def cancel_or_refund(self, request, idempotency_key=None, **kwargs):
        """
        Cancel or refund a payment
        """
        endpoint = self.baseUrl + f"/cancelOrRefund"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def capture(self, request, idempotency_key=None, **kwargs):
        """
        Capture an authorisation
        """
        endpoint = self.baseUrl + f"/capture"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def donate(self, request, idempotency_key=None, **kwargs):
        """
        Create a donation

        Deprecated 
        """
        endpoint = self.baseUrl + f"/donate"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def refund(self, request, idempotency_key=None, **kwargs):
        """
        Refund a captured payment
        """
        endpoint = self.baseUrl + f"/refund"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def technical_cancel(self, request, idempotency_key=None, **kwargs):
        """
        Cancel an authorisation using your reference
        """
        endpoint = self.baseUrl + f"/technicalCancel"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

    def void_pending_refund(self, request, idempotency_key=None, **kwargs):
        """
        Cancel an in-person refund
        """
        endpoint = self.baseUrl + f"/voidPendingRefund"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

