Files
stream.api/proto/app/v1/payments.proto
lethdat dfd999e058 feat: add test database setup and usage helpers
- Introduced a new test file for setting up an in-memory SQLite database for testing purposes.
- Added helper functions for seeding test data, including users, plans, subscriptions, and wallet transactions.
- Implemented usage helpers to load user video counts and storage usage.
- Created user payload struct and functions to build user payloads with preferences and wallet balance.
- Refactored gRPC server setup to include new services and handlers.
- Updated proto files to simplify service definitions by removing redundant service prefixes.
2026-03-25 18:36:03 +07:00

64 lines
1.4 KiB
Protocol Buffer

syntax = "proto3";
package stream.app.v1;
option go_package = "stream.api/internal/gen/proto/app/v1;appv1";
import "app/v1/common.proto";
service Payments {
rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse);
rpc ListPaymentHistory(ListPaymentHistoryRequest) returns (ListPaymentHistoryResponse);
rpc TopupWallet(TopupWalletRequest) returns (TopupWalletResponse);
rpc DownloadInvoice(DownloadInvoiceRequest) returns (DownloadInvoiceResponse);
}
message CreatePaymentRequest {
string plan_id = 1;
int32 term_months = 2;
string payment_method = 3;
optional double topup_amount = 4;
}
message CreatePaymentResponse {
Payment payment = 1;
PlanSubscription subscription = 2;
double wallet_balance = 3;
string invoice_id = 4;
string message = 5;
}
message ListPaymentHistoryRequest {
int32 page = 1;
int32 limit = 2;
}
message ListPaymentHistoryResponse {
repeated PaymentHistoryItem payments = 1;
int64 total = 2;
int32 page = 3;
int32 limit = 4;
bool has_prev = 5;
bool has_next = 6;
}
message TopupWalletRequest {
double amount = 1;
}
message TopupWalletResponse {
WalletTransaction wallet_transaction = 1;
double wallet_balance = 2;
string invoice_id = 3;
}
message DownloadInvoiceRequest {
string id = 1;
}
message DownloadInvoiceResponse {
string filename = 1;
string content_type = 2;
string content = 3;
}