syntax = "proto3"; package transactions; import "public_messages.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; import "google/protobuf/duration.proto"; import "google/protobuf/timestamp.proto"; import "google/api/annotations.proto"; option csharp_namespace = "CMSMicroservice.Protobuf.Protos.Transactions"; service TransactionsContract { rpc CreateNewTransactions(CreateNewTransactionsRequest) returns (CreateNewTransactionsResponse){ option (google.api.http) = { post: "/CreateNewTransactions" body: "*" }; }; rpc UpdateTransactions(UpdateTransactionsRequest) returns (google.protobuf.Empty){ option (google.api.http) = { put: "/UpdateTransactions" body: "*" }; }; rpc DeleteTransactions(DeleteTransactionsRequest) returns (google.protobuf.Empty){ option (google.api.http) = { delete: "/DeleteTransactions" body: "*" }; }; rpc GetTransactions(GetTransactionsRequest) returns (GetTransactionsResponse){ option (google.api.http) = { get: "/GetTransactions" }; }; rpc GetAllTransactionsByFilter(GetAllTransactionsByFilterRequest) returns (GetAllTransactionsByFilterResponse){ option (google.api.http) = { get: "/GetAllTransactionsByFilter" }; }; rpc VerifyTransaction(VerifyTransactionRequest) returns (VerifyTransactionResponse){ option (google.api.http) = { post: "/VerifyTransaction" body: "*" }; }; rpc RefundTransaction(RefundTransactionRequest) returns (RefundTransactionResponse){ option (google.api.http) = { post: "/RefundTransaction" body: "*" }; }; // ============= Customer-specific Methods ============= rpc GetCustomerTransaction(GetCustomerTransactionRequest) returns (GetCustomerTransactionResponse){ option (google.api.http) = { get: "/Customer/GetTransaction" }; }; rpc GetCustomerTransactionsByFilter(GetCustomerTransactionsByFilterRequest) returns (GetCustomerTransactionsByFilterResponse){ option (google.api.http) = { get: "/Customer/GetTransactions" }; }; rpc CustomerPaymentRequest(CustomerPaymentRequestRequest) returns (CustomerPaymentRequestResponse){ option (google.api.http) = { post: "/Customer/PaymentRequest" body: "*" }; }; rpc CustomerPaymentVerification(CustomerPaymentVerificationRequest) returns (CustomerPaymentVerificationResponse){ option (google.api.http) = { post: "/Customer/PaymentVerification" body: "*" }; }; } message CreateNewTransactionsRequest { int64 amount = 1; string description = 2; oneof PaymentStatus_item { messages.PaymentStatus payment_status = 3; } google.protobuf.Timestamp payment_date = 4; google.protobuf.StringValue ref_id = 5; oneof Type_item { messages.TransactionType type = 6; } } message CreateNewTransactionsResponse { int64 id = 1; } message UpdateTransactionsRequest { int64 id = 1; int64 amount = 2; string description = 3; oneof PaymentStatus_item { messages.PaymentStatus payment_status = 4; } google.protobuf.Timestamp payment_date = 5; google.protobuf.StringValue ref_id = 6; oneof Type_item { messages.TransactionType type = 7; } } message DeleteTransactionsRequest { int64 id = 1; } message GetTransactionsRequest { int64 id = 1; } message GetTransactionsResponse { int64 id = 1; int64 amount = 2; string description = 3; oneof PaymentStatus_item { messages.PaymentStatus payment_status = 4; } google.protobuf.Timestamp payment_date = 5; google.protobuf.StringValue ref_id = 6; oneof Type_item { messages.TransactionType type = 7; } } message GetAllTransactionsByFilterRequest { messages.PaginationState pagination_state = 1; google.protobuf.StringValue sort_by = 2; GetAllTransactionsByFilterFilter filter = 3; } message GetAllTransactionsByFilterFilter { google.protobuf.Int64Value id = 1; google.protobuf.Int64Value amount = 2; google.protobuf.StringValue description = 3; oneof PaymentStatus_item { messages.PaymentStatus payment_status = 4; } google.protobuf.Timestamp payment_date = 5; google.protobuf.StringValue ref_id = 6; oneof Type_item { messages.TransactionType type = 7; } } message GetAllTransactionsByFilterResponse { messages.MetaData meta_data = 1; repeated GetAllTransactionsByFilterResponseModel models = 2; } message GetAllTransactionsByFilterResponseModel { int64 id = 1; int64 amount = 2; string description = 3; oneof PaymentStatus_item { messages.PaymentStatus payment_status = 4; } google.protobuf.Timestamp payment_date = 5; google.protobuf.StringValue ref_id = 6; oneof Type_item { messages.TransactionType type = 7; } } // VerifyTransaction Messages message VerifyTransactionRequest { int64 transaction_id = 1; string ref_id = 2; messages.PaymentStatus status = 3; google.protobuf.Timestamp payment_date = 4; } message VerifyTransactionResponse { int64 transaction_id = 1; messages.PaymentStatus status = 2; string ref_id = 3; string message = 4; } // RefundTransaction Messages message RefundTransactionRequest { int64 transaction_id = 1; string refund_reason = 2; google.protobuf.Int64Value refund_amount = 3; } message RefundTransactionResponse { int64 original_transaction_id = 1; int64 refund_transaction_id = 2; int64 refund_amount = 3; string message = 4; } // ============= Customer-specific Messages ============= // Customer Transaction Models message GetCustomerTransactionRequest { google.protobuf.Int64Value id = 1; google.protobuf.StringValue authority = 2; } message GetCustomerTransactionResponse { int64 id = 1; string merchant_id = 2; int64 amount = 3; string callback_url = 4; string description = 5; google.protobuf.StringValue mobile = 6; google.protobuf.StringValue email = 7; google.protobuf.Int32Value request_status_code = 8; google.protobuf.StringValue request_status_message = 9; google.protobuf.StringValue authority = 10; google.protobuf.StringValue fee_type = 11; google.protobuf.Int64Value fee = 12; CurrencyEnum currency = 13; bool payment_status = 14; google.protobuf.Int32Value verification_status_code = 15; google.protobuf.StringValue verification_status_message = 16; google.protobuf.StringValue card_hash = 17; google.protobuf.StringValue card_pan = 18; google.protobuf.StringValue ref_id = 19; google.protobuf.StringValue order_id = 20; TransactionTypeEnum type = 21; } // Customer Filter Messages message GetCustomerTransactionsByFilterRequest { messages.PaginationState pagination_state = 1; google.protobuf.StringValue sort_by = 2; GetCustomerTransactionsByFilterFilter filter = 3; } message GetCustomerTransactionsByFilterFilter { google.protobuf.Int64Value id = 1; google.protobuf.Int64Value amount = 2; google.protobuf.StringValue description = 3; google.protobuf.StringValue authority = 4; google.protobuf.BoolValue payment_status = 5; google.protobuf.StringValue ref_id = 6; google.protobuf.StringValue order_id = 7; CurrencyEnum currency = 8; TransactionTypeEnum type = 9; } message GetCustomerTransactionsByFilterResponse { messages.MetaData meta_data = 1; repeated GetCustomerTransactionsByFilterResponseModel models = 2; } message GetCustomerTransactionsByFilterResponseModel { int64 id = 1; string merchant_id = 2; int64 amount = 3; string callback_url = 4; string description = 5; google.protobuf.StringValue mobile = 6; google.protobuf.StringValue email = 7; google.protobuf.StringValue authority = 8; google.protobuf.Int64Value fee = 9; CurrencyEnum currency = 10; bool payment_status = 11; google.protobuf.StringValue card_hash = 12; google.protobuf.StringValue card_pan = 13; google.protobuf.StringValue ref_id = 14; google.protobuf.StringValue order_id = 15; TransactionTypeEnum type = 16; } // Customer Payment Request/Verification message CustomerPaymentRequestRequest { int64 amount = 1; string callback_url = 2; google.protobuf.StringValue description = 3; google.protobuf.StringValue mobile = 4; google.protobuf.StringValue email = 5; CurrencyEnum currency = 6; TransactionTypeEnum type = 7; google.protobuf.StringValue order_id = 8; } message CustomerPaymentRequestResponse { string payment_g_w_url = 1; } message CustomerPaymentVerificationRequest { string authority = 1; string status = 2; } message CustomerPaymentVerificationResponse { int64 id = 1; bool payment_status = 2; string message = 3; google.protobuf.StringValue ref_id = 4; google.protobuf.StringValue order_id = 5; google.protobuf.Int32Value verification_status_code = 6; } // Enums for Customer API enum CurrencyEnum { IRR = 0; IRT = 1; } enum TransactionTypeEnum { Real = 0; Sandbox = 1; }