# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

from api.v1 import payment_pb2 as api_dot_v1_dot_payment__pb2


class PaymentServiceStub(object):
    """# Payment Service

    This service provides functionality for managing contracts and charges.
    It allows for creating contracts both with and without initial charges,
    as well as adding charges to existing contracts.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.CreateContractWithoutCharge = channel.unary_unary(
            "/api.v1.PaymentService/CreateContractWithoutCharge",
            request_serializer=api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeResponse.FromString,
            _registered_method=True,
        )
        self.CreateContractWithCharge = channel.unary_unary(
            "/api.v1.PaymentService/CreateContractWithCharge",
            request_serializer=api_dot_v1_dot_payment__pb2.CreateContractWithChargeRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.CreateContractWithChargeResponse.FromString,
            _registered_method=True,
        )
        self.AddCharge = channel.unary_unary(
            "/api.v1.PaymentService/AddCharge",
            request_serializer=api_dot_v1_dot_payment__pb2.AddChargeRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.AddChargeResponse.FromString,
            _registered_method=True,
        )
        self.GetCharge = channel.unary_unary(
            "/api.v1.PaymentService/GetCharge",
            request_serializer=api_dot_v1_dot_payment__pb2.GetChargeRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.GetChargeResponse.FromString,
            _registered_method=True,
        )
        self.GetCharges = channel.unary_unary(
            "/api.v1.PaymentService/GetCharges",
            request_serializer=api_dot_v1_dot_payment__pb2.GetChargesRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.GetChargesResponse.FromString,
            _registered_method=True,
        )
        self.Withdraw = channel.unary_unary(
            "/api.v1.PaymentService/Withdraw",
            request_serializer=api_dot_v1_dot_payment__pb2.WithdrawRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.WithdrawResponse.FromString,
            _registered_method=True,
        )
        self.OffSessionPayment = channel.unary_unary(
            "/api.v1.PaymentService/OffSessionPayment",
            request_serializer=api_dot_v1_dot_payment__pb2.OffSessionPaymentRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.OffSessionPaymentResponse.FromString,
            _registered_method=True,
        )
        self.OnSessionPayment = channel.unary_unary(
            "/api.v1.PaymentService/OnSessionPayment",
            request_serializer=api_dot_v1_dot_payment__pb2.OnSessionPaymentRequest.SerializeToString,
            response_deserializer=api_dot_v1_dot_payment__pb2.OnSessionPaymentResponse.FromString,
            _registered_method=True,
        )


class PaymentServiceServicer(object):
    """# Payment Service

    This service provides functionality for managing contracts and charges.
    It allows for creating contracts both with and without initial charges,
    as well as adding charges to existing contracts.
    """

    def CreateContractWithoutCharge(self, request, context):
        """## CreateContractWithoutCharge

        Creates a new contract without an initial charge. This is useful when you want to
        establish a billing relationship with a customer but don't need to charge them immediately.

        The contract can later be used with AddCharge to apply charges as needed.

        **Parameters:**
        - CreateContractWithoutChargeRequest: Contains buyer information and redirect details

        **Returns:**
        - CreateContractWithoutChargeResponse: Contains the created payment link with contract ID, merchant customer ID

        **Service function reference:**
        ```go
        func (s *paymentService) CreateContractWithoutCharge(ctx context.Context, req *CreateContractWithoutChargeRequest) (*CreateContractWithoutChargeResponse, error) {
        // Validates buyer information
        // Creates contract ID in payment info database
        // Create merchant customer if not exists
        // Creates payment link
        // Returns payment link with contract ID and merchant customer ID
        }
        ```
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def CreateContractWithCharge(self, request, context):
        """## CreateContractWithCharge

        Creates a new contract with an immediate initial charge. This combines
        contract creation and charging in a single operation for convenience.

        This is typically used for initial sign-ups that require immediate payment.

        **Parameters:**
        - CreateContractWithChargeRequest: Contains buyer information, redirect details, and charge information

        **Returns:**
        - CreateContractWithChargeResponse: Contains the created payment link with contract ID, charge ID, merchant customer ID

        **Service function reference:**
        ```go
        func (s *paymentService) CreateContractWithCharge(ctx context.Context, req *CreateContractWithChargeRequest) (*CreateContractWithChargeResponse, error) {
        // Validates buyer and payment information
        // Creates contract ID and charge ID in payment info database
        // Create merchant customer if not exists
        // Creates payment link
        // Returns payment link with contract and charge IDs along with merchant customer ID
        }
        ```
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def AddCharge(self, request, context):
        """## AddCharge

        Adds a new charge to an existing contract. This allows for charging
        a jamm user after a contract has been established.

        Common uses include recurring billing, add-on purchases, or usage-based charges.

        **Parameters:**
        - AddChargeRequest: Contains merchant customer ID and charge details

        **Returns:**
        - AddChargeResponse: Contains the created payment link with charge ID

        **Service function reference:**
        ```go
        func (s *paymentService) AddCharge(ctx context.Context, req *AddChargeRequest) (*AddChargeResponse, error) {
        // Validates contract links to the merchant customer and payment information
        // Creates charge ID in payment info database
        // Creates payment link
        // Returns payment link with contract and charge IDs
        }
        ```
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetCharge(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def GetCharges(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def Withdraw(self, request, context):
        """Withdraw

        Withdraws money from a customer immediately. This call is synchronous.

        @param WithdrawRequest Contains merchant customer ID and charge details
        @return WithdrawResponse Contains the created payment link with charge ID

        Service function reference:
        func (s *paymentService) Withdraw(ctx context.Context, req *WithdrawRequest) (*WithdrawResponse, error) {
        // Validates contract links to the merchant customer and payment information
        // Creates charge ID in payment info database
        // Creates payment link
        // Returns payment link with contract and charge IDs
        }
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def OffSessionPayment(self, request, context):
        """## OffSessionPayment

        Processes a payment directly within your application without requiring redirects.
        This is an off-session payment that executes immediately and synchronously.

        This API is used for existing customers - Executes a charge to an existing customer when a customer ID is provided

        @param OffSessionPaymentRequest: Contains optional customer ID and charge details
        @return OffSessionPaymentResponse: Contains the charge result and customer information

        **Service function reference:**
        ```go
        func (s *paymentService) Withdraw(ctx context.Context, req *WithdrawRequest) (*WithdrawResponse, error) {
        // Validates payment information
        // Processes the payment immediately without redirects
        // Returns charge result and customer information
        }
        ```
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")

    def OnSessionPayment(self, request, context):
        """## OnSessionPayment

        Provides a unified interface for creating payment sessions. This API intelligently routes
        requests to the appropriate method based on the provided parameters:

        - When a customer ID is provided: Uses AddCharge for existing customers
        - When buyer + charge are provided: Uses CreateContractWithCharge for new customers with charges
        - When only buyer is provided: Uses CreateContractWithoutCharge for new customers without charges

        **Parameters:**
        - OnSessionPaymentRequest: Contains optional customer/buyer info, optional charge details, and redirect URLs

        **Returns:**
        - OnSessionPaymentResponse: Contains unified payment information including payment link

        **Service function reference:**
        ```go
        func (s *paymentService) OnSessionPayment(ctx context.Context, req *OnSessionPaymentRequest) (*OnSessionPaymentResponse, error) {
        // Determines appropriate payment strategy based on request parameters
        // Routes to AddCharge, CreateContractWithCharge, or CreateContractWithoutCharge
        // Returns standardized response with payment link and relevant details
        }
        ```
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_PaymentServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "CreateContractWithoutCharge": grpc.unary_unary_rpc_method_handler(
            servicer.CreateContractWithoutCharge,
            request_deserializer=api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeResponse.SerializeToString,
        ),
        "CreateContractWithCharge": grpc.unary_unary_rpc_method_handler(
            servicer.CreateContractWithCharge,
            request_deserializer=api_dot_v1_dot_payment__pb2.CreateContractWithChargeRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.CreateContractWithChargeResponse.SerializeToString,
        ),
        "AddCharge": grpc.unary_unary_rpc_method_handler(
            servicer.AddCharge,
            request_deserializer=api_dot_v1_dot_payment__pb2.AddChargeRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.AddChargeResponse.SerializeToString,
        ),
        "GetCharge": grpc.unary_unary_rpc_method_handler(
            servicer.GetCharge,
            request_deserializer=api_dot_v1_dot_payment__pb2.GetChargeRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.GetChargeResponse.SerializeToString,
        ),
        "GetCharges": grpc.unary_unary_rpc_method_handler(
            servicer.GetCharges,
            request_deserializer=api_dot_v1_dot_payment__pb2.GetChargesRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.GetChargesResponse.SerializeToString,
        ),
        "Withdraw": grpc.unary_unary_rpc_method_handler(
            servicer.Withdraw,
            request_deserializer=api_dot_v1_dot_payment__pb2.WithdrawRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.WithdrawResponse.SerializeToString,
        ),
        "OffSessionPayment": grpc.unary_unary_rpc_method_handler(
            servicer.OffSessionPayment,
            request_deserializer=api_dot_v1_dot_payment__pb2.OffSessionPaymentRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.OffSessionPaymentResponse.SerializeToString,
        ),
        "OnSessionPayment": grpc.unary_unary_rpc_method_handler(
            servicer.OnSessionPayment,
            request_deserializer=api_dot_v1_dot_payment__pb2.OnSessionPaymentRequest.FromString,
            response_serializer=api_dot_v1_dot_payment__pb2.OnSessionPaymentResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "api.v1.PaymentService", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers("api.v1.PaymentService", rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
class PaymentService(object):
    """# Payment Service

    This service provides functionality for managing contracts and charges.
    It allows for creating contracts both with and without initial charges,
    as well as adding charges to existing contracts.
    """

    @staticmethod
    def CreateContractWithoutCharge(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/CreateContractWithoutCharge",
            api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.CreateContractWithoutChargeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def CreateContractWithCharge(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/CreateContractWithCharge",
            api_dot_v1_dot_payment__pb2.CreateContractWithChargeRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.CreateContractWithChargeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def AddCharge(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/AddCharge",
            api_dot_v1_dot_payment__pb2.AddChargeRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.AddChargeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetCharge(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/GetCharge",
            api_dot_v1_dot_payment__pb2.GetChargeRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.GetChargeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def GetCharges(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/GetCharges",
            api_dot_v1_dot_payment__pb2.GetChargesRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.GetChargesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def Withdraw(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/Withdraw",
            api_dot_v1_dot_payment__pb2.WithdrawRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.WithdrawResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def OffSessionPayment(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/OffSessionPayment",
            api_dot_v1_dot_payment__pb2.OffSessionPaymentRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.OffSessionPaymentResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )

    @staticmethod
    def OnSessionPayment(
        request,
        target,
        options=(),
        channel_credentials=None,
        call_credentials=None,
        insecure=False,
        compression=None,
        wait_for_ready=None,
        timeout=None,
        metadata=None,
    ):
        return grpc.experimental.unary_unary(
            request,
            target,
            "/api.v1.PaymentService/OnSessionPayment",
            api_dot_v1_dot_payment__pb2.OnSessionPaymentRequest.SerializeToString,
            api_dot_v1_dot_payment__pb2.OnSessionPaymentResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True,
        )
