from ..base import AdyenServiceBase


class OrdersApi(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(OrdersApi, self).__init__(client=client)
        self.service = "checkout"
        self.baseUrl = "https://checkout-test.adyen.com/v71"

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

    def get_balance_of_gift_card(self, request, idempotency_key=None, **kwargs):
        """
        Get the balance of a gift card
        """
        endpoint = self.baseUrl + f"/paymentMethods/balance"
        method = "POST"
        return self.client.call_adyen_api(request, self.service, method, endpoint, idempotency_key, **kwargs)

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

