2016-07-28 12:01:03 +00:00
|
|
|
|
/**
|
|
|
|
|
* Интерфейс сервиса статистики и связанные с ним определения предметной области, основанные на моделях домена.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
include "base.thrift"
|
|
|
|
|
include "domain.thrift"
|
2016-11-24 09:08:10 +00:00
|
|
|
|
include "geo_ip.thrift"
|
2016-07-28 12:01:03 +00:00
|
|
|
|
|
|
|
|
|
namespace java com.rbkmoney.damsel.merch_stat
|
|
|
|
|
namespace erlang merchstat
|
|
|
|
|
|
|
|
|
|
/**
|
2017-05-23 14:14:41 +00:00
|
|
|
|
* Информация о платеже.
|
2016-07-28 12:01:03 +00:00
|
|
|
|
* **/
|
|
|
|
|
struct StatPayment {
|
2017-05-23 14:14:41 +00:00
|
|
|
|
1 : required domain.InvoicePaymentID id
|
|
|
|
|
2 : required domain.InvoiceID invoice_id
|
|
|
|
|
3 : required domain.PartyID owner_id
|
|
|
|
|
4 : required domain.ShopID shop_id
|
|
|
|
|
5 : required base.Timestamp created_at
|
|
|
|
|
6 : required InvoicePaymentStatus status
|
|
|
|
|
7 : required domain.Amount amount
|
|
|
|
|
8 : required domain.Amount fee
|
|
|
|
|
9 : required string currency_symbolic_code
|
|
|
|
|
10: required PaymentTool payment_tool
|
|
|
|
|
11: optional domain.IPAddress ip_address
|
|
|
|
|
12: optional domain.Fingerprint fingerprint
|
|
|
|
|
13: optional string phone_number
|
|
|
|
|
14: optional string email
|
|
|
|
|
15: required domain.PaymentSessionID session_id
|
|
|
|
|
16: optional base.Content context
|
|
|
|
|
17: optional geo_ip.LocationInfo location_info
|
2017-08-29 15:51:12 +00:00
|
|
|
|
18: required InvoicePaymentFlow flow
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union InvoicePaymentFlow {
|
|
|
|
|
1: InvoicePaymentFlowInstant instant
|
|
|
|
|
2: InvoicePaymentFlowHold hold
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoicePaymentFlowInstant {}
|
|
|
|
|
|
|
|
|
|
struct InvoicePaymentFlowHold {
|
|
|
|
|
1: required OnHoldExpiration on_hold_expiration
|
|
|
|
|
2: required base.Timestamp held_until
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum OnHoldExpiration {
|
|
|
|
|
cancel
|
|
|
|
|
capture
|
2017-05-23 14:14:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-20 13:16:28 +00:00
|
|
|
|
union OperationFailure {
|
|
|
|
|
1: OperationTimeout operation_timeout
|
|
|
|
|
2: ExternalFailure external_failure
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct OperationTimeout {}
|
|
|
|
|
|
|
|
|
|
struct ExternalFailure {
|
2017-05-23 14:14:41 +00:00
|
|
|
|
1: required string code
|
|
|
|
|
2: optional string description
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoicePaymentPending {}
|
|
|
|
|
struct InvoicePaymentProcessed {}
|
|
|
|
|
struct InvoicePaymentCaptured {}
|
|
|
|
|
struct InvoicePaymentCancelled {}
|
|
|
|
|
struct InvoicePaymentFailed { 1: required OperationFailure failure }
|
|
|
|
|
|
|
|
|
|
union InvoicePaymentStatus {
|
|
|
|
|
1: InvoicePaymentPending pending
|
|
|
|
|
4: InvoicePaymentProcessed processed
|
|
|
|
|
2: InvoicePaymentCaptured captured
|
|
|
|
|
5: InvoicePaymentCancelled cancelled
|
|
|
|
|
3: InvoicePaymentFailed failed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PaymentTool {
|
|
|
|
|
1: BankCard bank_card
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct BankCard {
|
|
|
|
|
1: required domain.Token token
|
|
|
|
|
2: required domain.BankCardPaymentSystem payment_system
|
|
|
|
|
3: required string bin
|
|
|
|
|
4: required string masked_pan
|
2016-07-28 12:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-09-04 15:40:55 +00:00
|
|
|
|
struct BankAccount {
|
|
|
|
|
1: required string account
|
|
|
|
|
2: required string bank_name
|
|
|
|
|
3: required string bank_post_account
|
|
|
|
|
4: required string bank_bik
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-28 12:01:03 +00:00
|
|
|
|
/**
|
2017-05-23 14:14:41 +00:00
|
|
|
|
* Информация об инвойсе.
|
2016-07-28 12:01:03 +00:00
|
|
|
|
*/
|
|
|
|
|
struct StatInvoice {
|
2017-05-23 14:14:41 +00:00
|
|
|
|
1 : required domain.InvoiceID id
|
|
|
|
|
2 : required domain.PartyID owner_id
|
|
|
|
|
3 : required domain.ShopID shop_id
|
|
|
|
|
4 : required base.Timestamp created_at
|
|
|
|
|
5 : required InvoiceStatus status
|
|
|
|
|
6 : required string product
|
|
|
|
|
7 : optional string description
|
|
|
|
|
8 : required base.Timestamp due
|
|
|
|
|
9 : required domain.Amount amount
|
|
|
|
|
10: required string currency_symbolic_code
|
|
|
|
|
11: optional base.Content context
|
2017-08-21 12:47:44 +00:00
|
|
|
|
12: optional domain.InvoiceCart cart
|
2017-05-23 14:14:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoiceUnpaid {}
|
|
|
|
|
struct InvoicePaid {}
|
|
|
|
|
struct InvoiceCancelled { 1: required string details }
|
|
|
|
|
struct InvoiceFulfilled { 1: required string details }
|
|
|
|
|
|
|
|
|
|
union InvoiceStatus {
|
|
|
|
|
1: InvoiceUnpaid unpaid
|
|
|
|
|
2: InvoicePaid paid
|
|
|
|
|
3: InvoiceCancelled cancelled
|
|
|
|
|
4: InvoiceFulfilled fulfilled
|
2016-07-28 12:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Информация о клиенте. Уникальность клиента определяется по fingerprint.
|
|
|
|
|
*/
|
|
|
|
|
struct StatCustomer {
|
|
|
|
|
1: required domain.Fingerprint id
|
|
|
|
|
2: required base.Timestamp created_at
|
|
|
|
|
}
|
|
|
|
|
|
2017-09-04 15:40:55 +00:00
|
|
|
|
typedef base.ID PayoutID
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Информация о выплате
|
|
|
|
|
*/
|
|
|
|
|
struct StatPayout {
|
|
|
|
|
1 : required PayoutID id
|
|
|
|
|
2 : required domain.PartyID party_id
|
|
|
|
|
3 : required domain.ShopID shop_id
|
|
|
|
|
4 : required base.Timestamp created_at
|
|
|
|
|
5 : required PayoutStatus status
|
|
|
|
|
6 : required domain.Amount amount
|
|
|
|
|
7 : required domain.Amount fee
|
|
|
|
|
8 : required string currency_symbolic_code
|
|
|
|
|
9 : required PayoutType type
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PayoutType {
|
|
|
|
|
1: PayoutCard bank_card
|
|
|
|
|
2: PayoutAccount bank_account
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PayoutCard {
|
|
|
|
|
1: required BankCard card
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PayoutAccount {
|
|
|
|
|
1: required BankAccount account
|
|
|
|
|
4: required string inn
|
|
|
|
|
5: required string purpose
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PayoutStatus {
|
|
|
|
|
1: PayoutUnpaid unpaid
|
|
|
|
|
2: PayoutPaid paid
|
|
|
|
|
3: PayoutCancelled cancelled
|
|
|
|
|
4: PayoutConfirmed confirmed
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PayoutUnpaid {}
|
|
|
|
|
struct PayoutPaid {}
|
|
|
|
|
struct PayoutCancelled { 1: required string details }
|
|
|
|
|
struct PayoutConfirmed {}
|
2016-08-08 08:11:42 +00:00
|
|
|
|
|
|
|
|
|
typedef map<string, string> StatInfo
|
|
|
|
|
typedef base.InvalidRequest InvalidRequest
|
|
|
|
|
|
2016-07-28 12:01:03 +00:00
|
|
|
|
/**
|
|
|
|
|
* Данные запроса к сервису. Формат и функциональность запроса зависят от DSL.
|
|
|
|
|
* DSL содержит условия выборки, а также id мерчанта, по которому производится выборка.
|
|
|
|
|
*/
|
|
|
|
|
struct StatRequest {
|
|
|
|
|
1: required string dsl
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-08 08:11:42 +00:00
|
|
|
|
/**
|
|
|
|
|
* Данные ответа сервиса.
|
|
|
|
|
* data - данные, тип зависит от целевой функции.
|
|
|
|
|
* total_count - ожидаемое общее количество данных (т.е. размер всех данных результата, без ограничений по количеству)
|
|
|
|
|
*/
|
|
|
|
|
struct StatResponse {
|
|
|
|
|
1: required StatResponseData data
|
|
|
|
|
2: optional i32 total_count
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Возможные варианты возвращаемых данных
|
|
|
|
|
*/
|
|
|
|
|
union StatResponseData {
|
|
|
|
|
1: list<StatPayment> payments
|
|
|
|
|
2: list<StatInvoice> invoices
|
|
|
|
|
3: list<StatCustomer> customers
|
2017-08-08 09:35:17 +00:00
|
|
|
|
4: list<StatInfo> records
|
2017-09-04 15:40:55 +00:00
|
|
|
|
5: list<StatPayout> payouts
|
2016-08-08 08:11:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ошибка превышения максимального размера блока данных, доступного для отправки клиенту.
|
|
|
|
|
* limit - текущий максимальный размер блока.
|
|
|
|
|
*/
|
|
|
|
|
exception DatasetTooBig {
|
|
|
|
|
1: i32 limit;
|
|
|
|
|
}
|
2016-07-28 12:01:03 +00:00
|
|
|
|
|
|
|
|
|
service MerchantStatistics {
|
2016-08-08 08:11:42 +00:00
|
|
|
|
/**
|
2016-12-13 17:23:13 +00:00
|
|
|
|
* Возвращает набор данных о платежах
|
|
|
|
|
*/
|
2016-08-08 08:11:42 +00:00
|
|
|
|
StatResponse GetPayments(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
|
2016-12-13 17:23:13 +00:00
|
|
|
|
|
2016-08-08 08:11:42 +00:00
|
|
|
|
/**
|
2016-12-13 17:23:13 +00:00
|
|
|
|
* Возвращает набор данных об инвойсах
|
|
|
|
|
*/
|
2016-08-08 08:11:42 +00:00
|
|
|
|
StatResponse GetInvoices(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
|
2016-12-13 17:23:13 +00:00
|
|
|
|
|
2016-08-08 08:11:42 +00:00
|
|
|
|
/**
|
2016-12-13 17:23:13 +00:00
|
|
|
|
* Возвращает набор данных о покупателях
|
|
|
|
|
*/
|
2016-08-08 08:11:42 +00:00
|
|
|
|
StatResponse GetCustomers(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
|
2016-07-28 12:01:03 +00:00
|
|
|
|
|
2017-09-04 15:40:55 +00:00
|
|
|
|
/**
|
|
|
|
|
* Возвращает набор данных о выплатах
|
|
|
|
|
*/
|
|
|
|
|
StatResponse GetPayouts(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
|
|
|
|
|
|
2016-07-28 12:01:03 +00:00
|
|
|
|
/**
|
2016-12-13 17:23:13 +00:00
|
|
|
|
* Возвращает аггрегированные данные в виде набора записей, формат возвращаемых данных зависит от целевой функции, указанной в DSL.
|
|
|
|
|
*/
|
2016-08-08 08:11:42 +00:00
|
|
|
|
StatResponse GetStatistics(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
|
2016-07-28 12:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
|