# 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.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.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 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 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 = {
            '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,
            ),
            '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 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 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)
