1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-10 18:10:54 +09:00

Update protos: nameservice/paymentservice

This commit is contained in:
Anton Akentev 2024-01-23 10:45:25 +00:00
parent 7ce3fbbf87
commit 4659755553
7 changed files with 993 additions and 207 deletions

View file

@ -68,8 +68,9 @@ func (m *NameAvailableRequest) GetFullName() string {
}
type NameByAddressRequest struct {
// An Ethereum address that owns that name
OwnerEthAddress string `protobuf:"bytes,1,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"`
// EOA -> SCW -> name
// A SCW Ethereum address that owns that name
OwnerScwEthAddress string `protobuf:"bytes,1,opt,name=ownerScwEthAddress,proto3" json:"ownerScwEthAddress,omitempty"`
}
func (m *NameByAddressRequest) Reset() { *m = NameByAddressRequest{} }
@ -105,27 +106,30 @@ func (m *NameByAddressRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_NameByAddressRequest proto.InternalMessageInfo
func (m *NameByAddressRequest) GetOwnerEthAddress() string {
func (m *NameByAddressRequest) GetOwnerScwEthAddress() string {
if m != nil {
return m.OwnerEthAddress
return m.OwnerScwEthAddress
}
return ""
}
type NameAvailableResponse struct {
Available bool `protobuf:"varint,1,opt,name=available,proto3" json:"available,omitempty"`
// An Ethereum address that owns that name
// EOA -> SCW -> name
// This field is non-empty only if name is "already registered"
OwnerEthAddress string `protobuf:"bytes,2,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"`
OwnerScwEthAddress string `protobuf:"bytes,2,opt,name=ownerScwEthAddress,proto3" json:"ownerScwEthAddress,omitempty"`
// This field is non-empty only if name is "already registered"
// TODO:
OwnerEthAddress string `protobuf:"bytes,3,opt,name=ownerEthAddress,proto3" json:"ownerEthAddress,omitempty"`
// A content hash attached to this name
// This field is non-empty only if name is "already registered"
OwnerAnyAddress string `protobuf:"bytes,3,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"`
OwnerAnyAddress string `protobuf:"bytes,4,opt,name=ownerAnyAddress,proto3" json:"ownerAnyAddress,omitempty"`
// A SpaceID attached to this name
// This field is non-empty only if name is "already registered"
SpaceId string `protobuf:"bytes,4,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
// doestn't work with marashalling/unmarshalling
SpaceId string `protobuf:"bytes,5,opt,name=spaceId,proto3" json:"spaceId,omitempty"`
// doesn't work with marashalling/unmarshalling
// google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true];
NameExpires int64 `protobuf:"varint,5,opt,name=nameExpires,proto3" json:"nameExpires,omitempty"`
NameExpires int64 `protobuf:"varint,6,opt,name=nameExpires,proto3" json:"nameExpires,omitempty"`
}
func (m *NameAvailableResponse) Reset() { *m = NameAvailableResponse{} }
@ -168,6 +172,13 @@ func (m *NameAvailableResponse) GetAvailable() bool {
return false
}
func (m *NameAvailableResponse) GetOwnerScwEthAddress() string {
if m != nil {
return m.OwnerScwEthAddress
}
return ""
}
func (m *NameAvailableResponse) GetOwnerEthAddress() string {
if m != nil {
return m.OwnerEthAddress
@ -260,28 +271,29 @@ func init() {
}
var fileDescriptor_06bca2ea4304f305 = []byte{
// 330 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x31, 0x6f, 0xf2, 0x30,
0x10, 0x8d, 0x3f, 0xe0, 0x2b, 0x5c, 0x07, 0x2a, 0x0b, 0xaa, 0x08, 0x21, 0x0b, 0x79, 0x62, 0x02,
0x89, 0xaa, 0x9d, 0x1b, 0x2a, 0x54, 0xb1, 0x74, 0xc8, 0xd8, 0xcd, 0x90, 0x43, 0x45, 0x0a, 0x4e,
0x1a, 0x07, 0x5a, 0xfe, 0x05, 0x7f, 0xaa, 0x52, 0x47, 0xc6, 0x8e, 0x15, 0xfc, 0x91, 0x0a, 0xc7,
0x81, 0x90, 0x46, 0x5d, 0x12, 0xdf, 0xf3, 0xbd, 0xbb, 0x77, 0xef, 0x0c, 0xb7, 0x52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0xf7, 0x0a, 0xcd, 0xe3, 0x16, 0x7d, 0x80,
0xab, 0x47, 0x8c, 0xcf, 0x34, 0x99, 0x22, 0xf9, 0x6d, 0x99, 0x22, 0xbf, 0xa4, 0x73, 0x6b, 0x78,
0xf7, 0xb9, 0x63, 0x64, 0xbb, 0x63, 0xe4, 0x7b, 0xc7, 0xc8, 0x66, 0xcf, 0xac, 0xed, 0x9e, 0x59,
0x5f, 0x7b, 0x66, 0x3d, 0xb7, 0xff, 0x7a, 0x64, 0x93, 0xff, 0xfa, 0x77, 0xf3, 0x13, 0x00, 0x00,
0xff, 0xff, 0xe0, 0x5b, 0xc6, 0xb3, 0x8b, 0x02, 0x00, 0x00,
// 343 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x4d, 0x4f, 0xc2, 0x40,
0x10, 0xed, 0xca, 0x87, 0x30, 0x1e, 0x30, 0x1b, 0x30, 0x0d, 0x21, 0x0d, 0xe9, 0x89, 0x53, 0x49,
0x30, 0x7a, 0x2f, 0x06, 0x0d, 0x17, 0x0f, 0xf5, 0xe6, 0x6d, 0xa1, 0x43, 0x24, 0x29, 0xdb, 0xda,
0x2d, 0x20, 0xff, 0x82, 0x9f, 0xe5, 0x91, 0xa3, 0x47, 0x03, 0xbf, 0xc1, 0xbb, 0x61, 0xd9, 0xc2,
0x82, 0xc5, 0x4b, 0xbb, 0xf3, 0xe6, 0xcd, 0xcc, 0xbe, 0x37, 0x0b, 0x77, 0x9c, 0x4d, 0x50, 0x60,
0x3c, 0x1b, 0x0f, 0xb1, 0xad, 0x9d, 0xa3, 0x38, 0x4c, 0xc2, 0xb6, 0xfc, 0x0a, 0x1d, 0x77, 0x24,
0x64, 0x77, 0xa0, 0xfa, 0xcc, 0x26, 0xe8, 0xce, 0xd8, 0x38, 0x60, 0x83, 0x00, 0x3d, 0x7c, 0x9f,
0xa2, 0x48, 0x68, 0x1d, 0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 0xe7, 0xda, 0x22,
0xab, 0xb5, 0x45, 0xbe, 0xd7, 0x16, 0x59, 0x6e, 0x2c, 0x63, 0xb5, 0xb1, 0x8c, 0xaf, 0x8d, 0x65,
0xbc, 0x36, 0xfe, 0x7b, 0x9a, 0x83, 0xa2, 0xfc, 0xdd, 0xfe, 0x06, 0x00, 0x00, 0xff, 0xff, 0xed,
0x14, 0xb9, 0xb1, 0xc1, 0x02, 0x00, 0x00,
}
func (m *NameAvailableRequest) Marshal() (dAtA []byte, err error) {
@ -334,10 +346,10 @@ func (m *NameByAddressRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) {
_ = i
var l int
_ = l
if len(m.OwnerEthAddress) > 0 {
i -= len(m.OwnerEthAddress)
copy(dAtA[i:], m.OwnerEthAddress)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerEthAddress)))
if len(m.OwnerScwEthAddress) > 0 {
i -= len(m.OwnerScwEthAddress)
copy(dAtA[i:], m.OwnerScwEthAddress)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerScwEthAddress)))
i--
dAtA[i] = 0xa
}
@ -367,27 +379,34 @@ func (m *NameAvailableResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) {
if m.NameExpires != 0 {
i = encodeVarintNameservice(dAtA, i, uint64(m.NameExpires))
i--
dAtA[i] = 0x28
dAtA[i] = 0x30
}
if len(m.SpaceId) > 0 {
i -= len(m.SpaceId)
copy(dAtA[i:], m.SpaceId)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.SpaceId)))
i--
dAtA[i] = 0x22
dAtA[i] = 0x2a
}
if len(m.OwnerAnyAddress) > 0 {
i -= len(m.OwnerAnyAddress)
copy(dAtA[i:], m.OwnerAnyAddress)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerAnyAddress)))
i--
dAtA[i] = 0x1a
dAtA[i] = 0x22
}
if len(m.OwnerEthAddress) > 0 {
i -= len(m.OwnerEthAddress)
copy(dAtA[i:], m.OwnerEthAddress)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerEthAddress)))
i--
dAtA[i] = 0x1a
}
if len(m.OwnerScwEthAddress) > 0 {
i -= len(m.OwnerScwEthAddress)
copy(dAtA[i:], m.OwnerScwEthAddress)
i = encodeVarintNameservice(dAtA, i, uint64(len(m.OwnerScwEthAddress)))
i--
dAtA[i] = 0x12
}
if m.Available {
@ -473,7 +492,7 @@ func (m *NameByAddressRequest) Size() (n int) {
}
var l int
_ = l
l = len(m.OwnerEthAddress)
l = len(m.OwnerScwEthAddress)
if l > 0 {
n += 1 + l + sovNameservice(uint64(l))
}
@ -489,6 +508,10 @@ func (m *NameAvailableResponse) Size() (n int) {
if m.Available {
n += 2
}
l = len(m.OwnerScwEthAddress)
if l > 0 {
n += 1 + l + sovNameservice(uint64(l))
}
l = len(m.OwnerEthAddress)
if l > 0 {
n += 1 + l + sovNameservice(uint64(l))
@ -642,7 +665,7 @@ func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error {
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType)
return fmt.Errorf("proto: wrong wireType = %d for field OwnerScwEthAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
@ -670,7 +693,7 @@ func (m *NameByAddressRequest) Unmarshal(dAtA []byte) error {
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OwnerEthAddress = string(dAtA[iNdEx:postIndex])
m.OwnerScwEthAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
@ -743,6 +766,38 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error {
}
m.Available = bool(v != 0)
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerScwEthAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowNameservice
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthNameservice
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthNameservice
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.OwnerScwEthAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerEthAddress", wireType)
}
@ -774,7 +829,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error {
}
m.OwnerEthAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field OwnerAnyAddress", wireType)
}
@ -806,7 +861,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error {
}
m.OwnerAnyAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field SpaceId", wireType)
}
@ -838,7 +893,7 @@ func (m *NameAvailableResponse) Unmarshal(dAtA []byte) error {
}
m.SpaceId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
case 6:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field NameExpires", wireType)
}

View file

@ -9,28 +9,33 @@ message NameAvailableRequest {
}
message NameByAddressRequest {
// An Ethereum address that owns that name
string ownerEthAddress = 1;
// EOA -> SCW -> name
// A SCW Ethereum address that owns that name
string ownerScwEthAddress = 1;
}
message NameAvailableResponse {
bool available = 1;
// An Ethereum address that owns that name
// EOA -> SCW -> name
// This field is non-empty only if name is "already registered"
string ownerEthAddress = 2;
string ownerScwEthAddress = 2;
// This field is non-empty only if name is "already registered"
// TODO:
string ownerEthAddress = 3;
// A content hash attached to this name
// This field is non-empty only if name is "already registered"
string ownerAnyAddress = 3;
string ownerAnyAddress = 4;
// A SpaceID attached to this name
// This field is non-empty only if name is "already registered"
string spaceId = 4;
string spaceId = 5;
// doestn't work with marashalling/unmarshalling
// doesn't work with marashalling/unmarshalling
//google.protobuf.Timestamp nameExpires = 5 [(gogoproto.stdtime) = true];
int64 nameExpires = 5;
int64 nameExpires = 6;
}
message NameByAddressResponse {
@ -40,7 +45,9 @@ message NameByAddressResponse {
}
service Anyns {
// Check if name is free or get the attached information if not
// Lookup: name -> address
rpc IsNameAvailable(NameAvailableRequest) returns (NameAvailableResponse) {}
// Reverse lookup: address -> name
rpc GetNameByAddress(NameByAddressRequest) returns (NameByAddressResponse) {}
}

View file

@ -55,20 +55,6 @@ func (mr *MockAnyPpClientServiceMockRecorder) BuySubscription(ctx, in any) *gomo
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuySubscription", reflect.TypeOf((*MockAnyPpClientService)(nil).BuySubscription), ctx, in)
}
// Close mocks base method.
func (m *MockAnyPpClientService) Close(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Close", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// Close indicates an expected call of Close.
func (mr *MockAnyPpClientServiceMockRecorder) Close(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockAnyPpClientService)(nil).Close), ctx)
}
// GetSubscriptionStatus mocks base method.
func (m *MockAnyPpClientService) GetSubscriptionStatus(ctx context.Context, in *paymentserviceproto.GetSubscriptionRequestSigned) (*paymentserviceproto.GetSubscriptionResponse, error) {
m.ctrl.T.Helper()
@ -111,17 +97,3 @@ func (mr *MockAnyPpClientServiceMockRecorder) Name() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Name", reflect.TypeOf((*MockAnyPpClientService)(nil).Name))
}
// Run mocks base method.
func (m *MockAnyPpClientService) Run(ctx context.Context) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Run", ctx)
ret0, _ := ret[0].(error)
return ret0
}
// Run indicates an expected call of Run.
func (mr *MockAnyPpClientServiceMockRecorder) Run(ctx any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Run", reflect.TypeOf((*MockAnyPpClientService)(nil).Run), ctx)
}

File diff suppressed because it is too large Load diff

View file

@ -42,6 +42,7 @@ type DRPCAnyPaymentProcessingClient interface {
GetSubscriptionStatus(ctx context.Context, in *GetSubscriptionRequestSigned) (*GetSubscriptionResponse, error)
BuySubscription(ctx context.Context, in *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error)
GetSubscriptionPortalLink(ctx context.Context, in *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error)
}
type drpcAnyPaymentProcessingClient struct {
@ -72,9 +73,19 @@ func (c *drpcAnyPaymentProcessingClient) BuySubscription(ctx context.Context, in
return out, nil
}
func (c *drpcAnyPaymentProcessingClient) GetSubscriptionPortalLink(ctx context.Context, in *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) {
out := new(GetSubscriptionPortalLinkResponse)
err := c.cc.Invoke(ctx, "/AnyPaymentProcessing/GetSubscriptionPortalLink", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}, in, out)
if err != nil {
return nil, err
}
return out, nil
}
type DRPCAnyPaymentProcessingServer interface {
GetSubscriptionStatus(context.Context, *GetSubscriptionRequestSigned) (*GetSubscriptionResponse, error)
BuySubscription(context.Context, *BuySubscriptionRequestSigned) (*BuySubscriptionResponse, error)
GetSubscriptionPortalLink(context.Context, *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error)
}
type DRPCAnyPaymentProcessingUnimplementedServer struct{}
@ -87,9 +98,13 @@ func (s *DRPCAnyPaymentProcessingUnimplementedServer) BuySubscription(context.Co
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
func (s *DRPCAnyPaymentProcessingUnimplementedServer) GetSubscriptionPortalLink(context.Context, *GetSubscriptionPortalLinkRequestSigned) (*GetSubscriptionPortalLinkResponse, error) {
return nil, drpcerr.WithCode(errors.New("Unimplemented"), drpcerr.Unimplemented)
}
type DRPCAnyPaymentProcessingDescription struct{}
func (DRPCAnyPaymentProcessingDescription) NumMethods() int { return 2 }
func (DRPCAnyPaymentProcessingDescription) NumMethods() int { return 3 }
func (DRPCAnyPaymentProcessingDescription) Method(n int) (string, drpc.Encoding, drpc.Receiver, interface{}, bool) {
switch n {
@ -111,6 +126,15 @@ func (DRPCAnyPaymentProcessingDescription) Method(n int) (string, drpc.Encoding,
in1.(*BuySubscriptionRequestSigned),
)
}, DRPCAnyPaymentProcessingServer.BuySubscription, true
case 2:
return "/AnyPaymentProcessing/GetSubscriptionPortalLink", drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{},
func(srv interface{}, ctx context.Context, in1, in2 interface{}) (drpc.Message, error) {
return srv.(DRPCAnyPaymentProcessingServer).
GetSubscriptionPortalLink(
ctx,
in1.(*GetSubscriptionPortalLinkRequestSigned),
)
}, DRPCAnyPaymentProcessingServer.GetSubscriptionPortalLink, true
default:
return "", nil, nil, nil, false
}
@ -151,3 +175,19 @@ func (x *drpcAnyPaymentProcessing_BuySubscriptionStream) SendAndClose(m *BuySubs
}
return x.CloseSend()
}
type DRPCAnyPaymentProcessing_GetSubscriptionPortalLinkStream interface {
drpc.Stream
SendAndClose(*GetSubscriptionPortalLinkResponse) error
}
type drpcAnyPaymentProcessing_GetSubscriptionPortalLinkStream struct {
drpc.Stream
}
func (x *drpcAnyPaymentProcessing_GetSubscriptionPortalLinkStream) SendAndClose(m *GetSubscriptionPortalLinkResponse) error {
if err := x.MsgSend(m, drpcEncoding_File_paymentservice_paymentserviceproto_protos_paymentservice_proto{}); err != nil {
return err
}
return x.CloseSend()
}

View file

@ -5,26 +5,29 @@ option go_package = "paymentservice/paymentserviceproto";
//import "google/protobuf/timestamp.proto";
enum SubscriptionTier {
Tier_Unknown = 0;
TierUnknown = 0;
Tier_Friend = 1;
Tier_Supporter1Year = 2;
Tier_Patron1Year = 3;
TierFriend = 1;
TierSupporter1Year = 2;
TierPatron1Year = 3;
}
enum SubscriptionStatus {
Status_Unknown = 0;
Status_Pending = 1;
Status_Active = 2;
Status_Expired = 3;
Status_Canceled = 4;
StatusUnknown = 0;
// payment is still pending
// this will be the status until the payment is confirmed or N is elapsed and no payment is received
// in the last case the subscription will switch to Status_Unknown or Status_Active
StatusPending = 1;
StatusActive = 2;
}
enum PaymentMethod {
Method_Card = 0;
Method_Crypto = 1;
Method_ApplePay = 2;
Method_GooglePay = 3;
MethodCard = 0;
MethodCrypto = 1;
MethodApplePay = 2;
MethodGooglePay = 3;
}
// 1
@ -58,23 +61,31 @@ message GetSubscriptionResponse {
uint64 nextTierEnds = 7;
PaymentMethod paymentMethod = 8;
// if name was requested - it will be here
// seeBuySubscriptionRequest.requestedAnyName field
string requestedAnyName = 9;
}
// 2
message BuySubscriptionRequest {
// in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS"
string ownerAnyID = 1;
string ownerAnyId = 1;
// this is the owner's ETH main EOA (External Owned Account) address
// this is the owner's ETH main EOA (Externally Owned Account) address
// not AccountAbstraction's SCW (Smart Contract Wallet) address!
//
// this is required to reserve a name for the owner (later that is done by user)
// in the following format: "0x7a250d5630b4cf539739df2c5dacb4c659f2488d"
// this is required to reserve a name for the owner
string ownerEthAddress = 2;
SubscriptionTier requestedTier = 3;
PaymentMethod paymentMethod = 4;
// this is just to store the requested name in the DB
// and then you will be able to retrieve it via GetSubscriptionRequest
// PP won't register the name in NS!
string requestedAnyName = 5;
}
message BuySubscriptionRequestSigned {
@ -91,6 +102,26 @@ message BuySubscriptionResponse {
string paymentUrl = 1;
}
message GetSubscriptionPortalLinkRequest {
// in the following format: "12D3KooWA8EXV3KjBxEU5EnsPfneLx84vMWAtTBQBeyooN82KSuS"
string ownerAnyId = 1;
}
message GetSubscriptionPortalLinkRequestSigned {
// GetSubscriptionPortalLinkRequest
bytes payload = 1;
// this is payload signed with payload.ownerAnyID
bytes signature = 2;
}
message GetSubscriptionPortalLinkResponse {
string portalUrl = 1;
}
// NOTICE:
// 1 - User can not ask for a payment/other links on behalf of another user (a signature is required)
// 2 - Admin can do that on behalf of any user
service AnyPaymentProcessing {
rpc GetSubscriptionStatus(GetSubscriptionRequestSigned) returns (GetSubscriptionResponse) {}
@ -100,8 +131,13 @@ service AnyPaymentProcessing {
// b) TODO: upgrade your tier
// c) TODO: renew subscription
//
// WARNING:
// 1 - User can not ask for a payment link on behalf of another user (a signature is required)
// 2 - Admin can do that on behalf of a user
// you can call BuySubscription multiple times even if current payment is not processed yet
// (to get new payment link)
rpc BuySubscription(BuySubscriptionRequestSigned) returns (BuySubscriptionResponse) {}
// Will generate a link to the portal where user can:
// a) change his billing details
// b) see payment info, invoices, etc
// c) cancel the subscription
rpc GetSubscriptionPortalLink(GetSubscriptionPortalLinkRequestSigned) returns (GetSubscriptionPortalLinkResponse) {}
}