syntax = "proto3"; package paystack; import "google/protobuf/empty.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/soardigital/klozr-protobuf/paystack"; service TransactionService { rpc InitializeTransaction(InitializeTransactionRequest) returns (PaystackResponse); rpc VerifyTransaction(google.protobuf.StringValue) returns (TransactionResponse); rpc RefundTransactionByReference(google.protobuf.StringValue) returns (google.protobuf.BoolValue); rpc RefundTransactionById(google.protobuf.Int64Value) returns (google.protobuf.BoolValue); rpc GetTransactionByReference(google.protobuf.StringValue) returns (TransactionResponse); rpc GetTransactionsByReferences(PaystackStrings) returns (TransactionResponses); } message PaystackStrings { repeated string data = 1; } message PaystackResponse { map data = 1; } message InitializeTransactionRequest { string callback_url = 1; string reference = 2; string authorization_code = 3; string currency = 4; float amount = 5; string email = 6; string plan = 7; int64 invoice_limit = 8; map metadata = 9; string subaccount = 10; int64 transaction_charge = 11; string bearer = 12; repeated string channels = 13; } message TransactionResponses { repeated TransactionResponse transactions = 1; } message TransactionResponse { int64 id = 1; string createdAt = 2; string domain = 3; map metadata = 4; //TODO: why is transaction metadata a string? string status = 5; string reference = 6; float amount = 7; string message = 8; string gateway_response = 9; string paid_at = 10; string channel = 11; string currency = 12; string ip_address = 13; Log log = 14; // TODO: same as timeline? int64 int = 15; string fees_split = 16; // TODO: confirm data type Customer customer = 17; Authorization authorization = 18; Plan plan = 19; SubAccount sub_account = 20; } message Log { int64 start_time = 1; int64 time_spent = 2; int64 attempts = 3; int64 errors = 4; bool success = 5; bool mobile = 6; repeated History history = 7; } message History { string type = 1; string message = 2; int64 time = 3; } message SubAccount { int64 id = 1; string created_at = 2; string updated_at = 3; string domain = 4; int64 integration = 5; string business_name = 6; string subaccount_code = 7; string description = 8; string primary_contact_name = 9; string primary_contact_email = 10; string primary_contact_phone = 11; map metadata = 12; float percentage_charge = 13; bool is_verified = 14; string settlement_bank = 15; string account_number = 16; string settlement_schedule = 17; bool active = 18; bool migrate = 19; } message Authorization { string authorization_code = 1; string bin = 2; string last4 = 3; string exp_month = 4; string exp_year = 5; string channel = 6; string card_type = 7; string bank = 8; string country_code = 9; string brand = 10; bool reusable = 11; string signature = 12; } message Plan { int64 id = 1; string created_at = 2; string updated_at = 3; string domain = 4; int64 integration = 5; string name = 6; string description = 7; string plan_code = 8; float amount = 9; string interval = 10; bool send_invoices = 11; bool send_sms = 12; string currency = 13; float invoice_limit = 14; string hosted_page = 15; string hosted_page_url = 16; string hosted_page_summary = 17; } message Subscription { int64 id = 1; string created_at = 2; string updated_at = 3; string domain = 4; int64 integration = 5; // inconsistent API response. Create returns Customer code, Fetch returns an object Customer customer = 6; string plan = 7; string start = 8; // inconsistent API response. Fetch returns string, List returns an object Authorization authorization = 9; // Invoices []interface{} = 1;invoices= 1; string status = 10; int64 quantity = 11; int64 amount = 12; string subscription_code = 13; string email_token = 14; string easy_cron_id = 15; string cron_expression = 16; string next_payment_date = 17; string open_invoice = 18; } service CustomerService { rpc CreateCustomer(CreateCustomerRequest) returns (Customer); rpc UpdateCustomer(CreateCustomerRequest) returns (Customer); rpc GetCustomerById(google.protobuf.StringValue) returns (Customer); rpc ListCustomers(google.protobuf.Empty) returns (Customers); rpc ValidateCustomer(ValidateCustomerRequest) returns (google.protobuf.BoolValue); } message CreateCustomerRequest { int64 id = 1; google.protobuf.StringValue created_at = 2; google.protobuf.StringValue updated_at = 3; google.protobuf.StringValue domain = 4; int64 integration = 5; google.protobuf.StringValue first_name = 6; google.protobuf.StringValue last_name = 7; google.protobuf.StringValue email = 8; google.protobuf.StringValue phone = 9; map metadata = 10; google.protobuf.StringValue customer_code = 11; repeated Subscription subscriptions = 12; repeated Authorization authorizations = 13; google.protobuf.StringValue risk_action = 14; } message Customer { int64 id = 1; string created_at = 2; string updated_at = 3; string domain = 4; int64 integration = 5; google.protobuf.StringValue first_name = 6; google.protobuf.StringValue last_name = 7; string email = 8; google.protobuf.StringValue phone = 9; map metadata = 10; string customer_code = 11; repeated Subscription subscriptions = 12; repeated Authorization authorizations = 13; string risk_action = 14; } message Customers { ListMeta meta = 1; repeated Customer customers = 2; } message ListMeta { int64 total = 1; int64 skipped = 2; int64 per_page = 3; int64 page = 4; int64 page_count = 5; } message ValidateCustomerRequest { google.protobuf.StringValue country = 1; google.protobuf.StringValue type = 2; google.protobuf.StringValue account_number = 3; google.protobuf.StringValue bvn = 4; google.protobuf.StringValue bank_code = 5; google.protobuf.StringValue first_name = 6; google.protobuf.StringValue last_name = 7; string customerId = 8; } message ChargeRequest { string email = 1; float amount = 2; string authorization_code = 3; map metadata = 4; google.protobuf.StringValue reference = 5; }