syntax = "proto3";

package paymenttransaction;

import "public_messages.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/timestamp.proto";
import "google/api/annotations.proto";

option csharp_namespace = "CMSMicroservice.Protobuf.Protos.PaymentTransaction";

service PaymentTransactionContract
{
    rpc GetAllPaymentTransactionByFilter(GetAllPaymentTransactionByFilterRequest) returns (GetAllPaymentTransactionByFilterResponse){
        option (google.api.http) = {
            get: "/PaymentTransaction/GetAllByFilter"
        };
    };
    rpc GetPaymentTransactionSummary(GetPaymentTransactionSummaryRequest) returns (GetPaymentTransactionSummaryResponse){
        option (google.api.http) = {
            get: "/PaymentTransaction/GetSummary"
        };
    };
}

message GetAllPaymentTransactionByFilterRequest
{
    messages.PaginationState pagination_state = 1;
    google.protobuf.StringValue sort_by = 2;
    GetAllPaymentTransactionByFilterFilter filter = 3;
}

message GetAllPaymentTransactionByFilterFilter
{
    google.protobuf.Int64Value user_id = 1;
    google.protobuf.StringValue mobile = 2;
    google.protobuf.StringValue gateway_provider = 3;
    google.protobuf.BoolValue payment_status = 4;
    google.protobuf.StringValue authority = 5;
    google.protobuf.StringValue ref_id = 6;
    google.protobuf.StringValue order_id = 7;
    google.protobuf.Timestamp created_from = 8;
    google.protobuf.Timestamp created_to = 9;
}

message GetAllPaymentTransactionByFilterResponse
{
    messages.MetaData meta_data = 1;
    repeated PaymentTransactionModel models = 2;
}

message PaymentTransactionModel
{
    int64 id = 1;
    int64 user_id = 2;
    string mobile = 3;
    string gateway_provider = 4;
    int64 amount = 5;
    string authority = 6;
    bool payment_status = 7;
    google.protobuf.Int32Value verification_status_code = 8;
    string verification_status_message = 9;
    string ref_id = 10;
    string card_pan = 11;
    string order_id = 12;
    google.protobuf.Int64Value transaction_id = 13;
    string description = 14;
    google.protobuf.Timestamp created_at = 15;
}

message GetPaymentTransactionSummaryRequest
{
    GetAllPaymentTransactionByFilterFilter filter = 1;
}

message GetPaymentTransactionSummaryResponse
{
    int64 total_count = 1;
    int64 total_amount = 2;
    int64 successful_count = 3;
    int64 pending_count = 4;
}
