2016-04-19 15:59:22 +00:00
|
|
|
|
/**
|
|
|
|
|
* Определения предметной области.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
include "base.thrift"
|
2017-08-03 10:48:31 +00:00
|
|
|
|
include "msgpack.thrift"
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-06-16 15:07:06 +00:00
|
|
|
|
namespace java com.rbkmoney.damsel.domain
|
|
|
|
|
namespace erlang domain
|
|
|
|
|
|
2016-06-02 11:38:27 +00:00
|
|
|
|
typedef i64 DataRevision
|
2016-04-19 15:59:22 +00:00
|
|
|
|
typedef i32 ObjectID
|
|
|
|
|
|
|
|
|
|
/* Common */
|
|
|
|
|
|
2016-10-07 10:40:54 +00:00
|
|
|
|
/** Контактная информация. **/
|
|
|
|
|
struct ContactInfo {
|
|
|
|
|
1: optional string phone_number
|
|
|
|
|
2: optional string email
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
union OperationFailure {
|
|
|
|
|
1: OperationTimeout operation_timeout
|
|
|
|
|
2: ExternalFailure external_failure
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct OperationTimeout {}
|
|
|
|
|
|
|
|
|
|
struct ExternalFailure {
|
2016-12-13 17:23:13 +00:00
|
|
|
|
/** Уникальный признак ошибки, пригодный для обработки машиной */
|
|
|
|
|
1: required string code
|
|
|
|
|
/** Описание ошибки, пригодное для восприятия человеком */
|
|
|
|
|
2: optional string description
|
|
|
|
|
}
|
2016-05-20 16:31:53 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/** Сумма в минимальных денежных единицах. */
|
|
|
|
|
typedef i64 Amount
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/** Номер счёта. */
|
|
|
|
|
typedef i64 AccountID
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/** Денежные средства, состоящие из суммы и валюты. */
|
|
|
|
|
struct Cash {
|
2016-05-18 16:27:06 +00:00
|
|
|
|
1: required Amount amount
|
2016-12-13 17:23:13 +00:00
|
|
|
|
2: required CurrencyRef currency
|
2016-06-02 11:38:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Contractor transactions */
|
|
|
|
|
|
|
|
|
|
struct TransactionInfo {
|
|
|
|
|
1: required string id
|
|
|
|
|
2: optional base.Timestamp timestamp
|
2017-01-20 09:16:31 +00:00
|
|
|
|
3: required base.StringMap extra
|
2016-05-18 16:27:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-20 16:31:53 +00:00
|
|
|
|
/* Invoices */
|
|
|
|
|
|
|
|
|
|
typedef base.ID InvoiceID
|
|
|
|
|
typedef base.ID InvoicePaymentID
|
2017-06-15 16:24:35 +00:00
|
|
|
|
typedef base.ID InvoicePaymentAdjustmentID
|
2016-10-10 13:14:58 +00:00
|
|
|
|
typedef base.Content InvoiceContext
|
|
|
|
|
typedef base.Content InvoicePaymentContext
|
2017-05-23 14:14:41 +00:00
|
|
|
|
typedef string PaymentSessionID
|
2016-07-28 12:01:03 +00:00
|
|
|
|
typedef string Fingerprint
|
|
|
|
|
typedef string IPAddress
|
|
|
|
|
|
2016-05-20 16:31:53 +00:00
|
|
|
|
struct Invoice {
|
2016-12-13 17:23:13 +00:00
|
|
|
|
1 : required InvoiceID id
|
|
|
|
|
2 : required PartyID owner_id
|
|
|
|
|
3 : required ShopID shop_id
|
|
|
|
|
4 : required base.Timestamp created_at
|
|
|
|
|
6 : required InvoiceStatus status
|
2016-12-21 12:53:12 +00:00
|
|
|
|
7 : required InvoiceDetails details
|
2016-12-13 17:23:13 +00:00
|
|
|
|
8 : required base.Timestamp due
|
|
|
|
|
10: required Cash cost
|
|
|
|
|
11: optional InvoiceContext context
|
2017-07-26 10:32:38 +00:00
|
|
|
|
12: optional InvoiceTemplateID template_id
|
2016-12-13 17:23:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-21 12:53:12 +00:00
|
|
|
|
struct InvoiceDetails {
|
2016-12-13 17:23:13 +00:00
|
|
|
|
1: required string product
|
|
|
|
|
2: optional string description
|
2017-08-03 10:48:31 +00:00
|
|
|
|
3: optional InvoiceCart cart
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoiceCart {
|
|
|
|
|
1: required list<InvoiceLine> lines
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoiceLine {
|
|
|
|
|
1: required string product
|
|
|
|
|
2: required i32 quantity
|
|
|
|
|
3: required Cash price
|
|
|
|
|
/* Taxes and other stuff goes here */
|
|
|
|
|
4: required map<string, msgpack.Value> metadata
|
2016-05-20 16:31:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-16 15:07:06 +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-05-20 16:31:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoicePayment {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: required InvoicePaymentID id
|
|
|
|
|
2: required base.Timestamp created_at
|
|
|
|
|
10: required DataRevision domain_revision
|
|
|
|
|
3: required InvoicePaymentStatus status
|
|
|
|
|
5: required Payer payer
|
|
|
|
|
8: required Cash cost
|
|
|
|
|
6: optional InvoicePaymentContext context
|
2016-05-20 16:31:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-16 15:07:06 +00:00
|
|
|
|
struct InvoicePaymentPending {}
|
2016-09-27 13:01:50 +00:00
|
|
|
|
struct InvoicePaymentProcessed {}
|
|
|
|
|
struct InvoicePaymentCaptured {}
|
|
|
|
|
struct InvoicePaymentCancelled {}
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct InvoicePaymentFailed { 1: required OperationFailure failure }
|
2016-06-16 15:07:06 +00:00
|
|
|
|
|
2017-07-26 10:32:38 +00:00
|
|
|
|
/**
|
|
|
|
|
* Шаблон инвойса.
|
|
|
|
|
* Согласно https://github.com/rbkmoney/coredocs/blob/0a5ae1a79f977be3134c3b22028631da5225d407/docs/domain/entities/invoice.md#шаблон-инвойса
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
typedef base.ID InvoiceTemplateID
|
|
|
|
|
|
|
|
|
|
struct InvoiceTemplate {
|
|
|
|
|
1: required InvoiceTemplateID id
|
|
|
|
|
2: required PartyID owner_id
|
|
|
|
|
3: required ShopID shop_id
|
|
|
|
|
4: required InvoiceDetails details
|
|
|
|
|
5: required LifetimeInterval invoice_lifetime
|
|
|
|
|
6: required InvoiceTemplateCost cost
|
|
|
|
|
7: optional InvoiceContext context
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union InvoiceTemplateCost {
|
|
|
|
|
1: Cash fixed
|
|
|
|
|
2: CashRange range
|
|
|
|
|
3: InvoiceTemplateCostUnlimited unlim
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoiceTemplateCostUnlimited {}
|
|
|
|
|
|
2016-09-27 13:01:50 +00:00
|
|
|
|
/**
|
|
|
|
|
* Статус платежа.
|
|
|
|
|
* Согласно https://github.com/rbkmoney/coredocs/blob/589799f/docs/domain/entities/payment.md
|
|
|
|
|
*/
|
2016-06-16 15:07:06 +00:00
|
|
|
|
union InvoicePaymentStatus {
|
|
|
|
|
1: InvoicePaymentPending pending
|
2016-09-27 13:01:50 +00:00
|
|
|
|
4: InvoicePaymentProcessed processed
|
|
|
|
|
2: InvoicePaymentCaptured captured
|
|
|
|
|
5: InvoicePaymentCancelled cancelled
|
2016-06-16 15:07:06 +00:00
|
|
|
|
3: InvoicePaymentFailed failed
|
2016-05-20 16:31:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
/**
|
|
|
|
|
* Целевое значение статуса платежа.
|
|
|
|
|
*/
|
|
|
|
|
union TargetInvoicePaymentStatus {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Платёж обработан.
|
|
|
|
|
*
|
|
|
|
|
* При достижении платежом этого статуса процессинг должен обладать:
|
|
|
|
|
* - фактом того, что провайдер _по крайней мере_ авторизовал списание денежных средств в
|
|
|
|
|
* пользу системы;
|
|
|
|
|
* - данными транзакции провайдера.
|
|
|
|
|
*/
|
|
|
|
|
1: InvoicePaymentProcessed processed
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Платёж подтверждён.
|
|
|
|
|
*
|
|
|
|
|
* При достижении платежом этого статуса процессинг должен быть уверен в том, что провайдер
|
|
|
|
|
* _по крайней мере_ подтвердил финансовые обязательства перед системой.
|
|
|
|
|
*/
|
|
|
|
|
2: InvoicePaymentCaptured captured
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Платёж отменён.
|
|
|
|
|
*
|
|
|
|
|
* При достижении платежом этого статуса процессинг должен быть уверен в том, что провайдер
|
|
|
|
|
* аннулировал неподтверждённое списание денежных средств.
|
|
|
|
|
*
|
|
|
|
|
* В случае, если в рамках сессии проведения платежа провайдер авторизовал, но _ещё не
|
|
|
|
|
* подтвердил_ списание средств, эта цель является обратной цели `processed`. В ином случае
|
|
|
|
|
* эта цель недостижима, и взаимодействие в рамках сессии должно завершится с ошибкой.
|
|
|
|
|
*/
|
|
|
|
|
3: InvoicePaymentCancelled cancelled
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-28 12:01:03 +00:00
|
|
|
|
struct Payer {
|
|
|
|
|
1: required PaymentTool payment_tool
|
2017-05-23 14:14:41 +00:00
|
|
|
|
2: required PaymentSessionID session_id
|
2016-07-28 12:01:03 +00:00
|
|
|
|
3: required ClientInfo client_info
|
2016-10-10 13:14:58 +00:00
|
|
|
|
4: required ContactInfo contact_info
|
2016-07-28 12:01:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ClientInfo {
|
|
|
|
|
1: optional IPAddress ip_address
|
|
|
|
|
2: optional Fingerprint fingerprint
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-17 14:27:32 +00:00
|
|
|
|
struct InvoicePaymentRoute {
|
|
|
|
|
1: required ProviderRef provider
|
|
|
|
|
2: required TerminalRef terminal
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-15 16:24:35 +00:00
|
|
|
|
struct InvoicePaymentAdjustment {
|
|
|
|
|
1: required InvoicePaymentAdjustmentID id
|
|
|
|
|
2: required InvoicePaymentAdjustmentStatus status
|
|
|
|
|
3: required base.Timestamp created_at
|
|
|
|
|
4: required DataRevision domain_revision
|
|
|
|
|
5: required string reason
|
|
|
|
|
6: required FinalCashFlow new_cash_flow
|
|
|
|
|
7: required FinalCashFlow old_cash_flow_inverse
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InvoicePaymentAdjustmentPending {}
|
|
|
|
|
struct InvoicePaymentAdjustmentCaptured { 1: required base.Timestamp at }
|
|
|
|
|
struct InvoicePaymentAdjustmentCancelled { 1: required base.Timestamp at }
|
|
|
|
|
|
|
|
|
|
union InvoicePaymentAdjustmentStatus {
|
|
|
|
|
1: InvoicePaymentAdjustmentPending pending
|
|
|
|
|
2: InvoicePaymentAdjustmentCaptured captured
|
|
|
|
|
3: InvoicePaymentAdjustmentCancelled cancelled
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-10 12:06:59 +00:00
|
|
|
|
/* Blocking and suspension */
|
|
|
|
|
|
|
|
|
|
union Blocking {
|
|
|
|
|
1: Unblocked unblocked
|
|
|
|
|
2: Blocked blocked
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Unblocked {
|
|
|
|
|
1: required string reason
|
2017-07-17 10:21:41 +00:00
|
|
|
|
2: required base.Timestamp since
|
2016-08-10 12:06:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Blocked {
|
|
|
|
|
1: required string reason
|
2017-07-17 10:21:41 +00:00
|
|
|
|
2: required base.Timestamp since
|
2016-08-10 12:06:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union Suspension {
|
|
|
|
|
1: Active active
|
|
|
|
|
2: Suspended suspended
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
struct Active {
|
|
|
|
|
1: required base.Timestamp since
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Suspended {
|
|
|
|
|
1: required base.Timestamp since
|
|
|
|
|
}
|
2016-08-10 12:06:59 +00:00
|
|
|
|
|
|
|
|
|
/* Parties */
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-08-10 12:06:59 +00:00
|
|
|
|
typedef base.ID PartyID
|
|
|
|
|
|
2017-08-03 10:48:31 +00:00
|
|
|
|
typedef string PartyMetaNamespace
|
|
|
|
|
typedef msgpack.Value PartyMetaData
|
|
|
|
|
typedef map<PartyMetaNamespace, PartyMetaData> PartyMeta
|
|
|
|
|
|
2016-08-10 12:06:59 +00:00
|
|
|
|
/** Участник. */
|
|
|
|
|
struct Party {
|
|
|
|
|
1: required PartyID id
|
2017-01-17 13:12:35 +00:00
|
|
|
|
7: required PartyContactInfo contact_info
|
2017-07-17 10:21:41 +00:00
|
|
|
|
8: required base.Timestamp created_at
|
2016-08-10 12:06:59 +00:00
|
|
|
|
2: required Blocking blocking
|
|
|
|
|
3: required Suspension suspension
|
2017-01-20 09:16:31 +00:00
|
|
|
|
4: required map<ContractID, Contract> contracts
|
|
|
|
|
5: required map<ShopID, Shop> shops
|
2016-08-10 12:06:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-17 13:12:35 +00:00
|
|
|
|
struct PartyContactInfo {
|
|
|
|
|
1: required string email
|
|
|
|
|
}
|
|
|
|
|
|
2016-08-10 12:06:59 +00:00
|
|
|
|
/* Shops */
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
typedef base.ID ShopID
|
2016-08-10 12:06:59 +00:00
|
|
|
|
|
|
|
|
|
/** Магазин мерчанта. */
|
|
|
|
|
struct Shop {
|
|
|
|
|
1: required ShopID id
|
2017-07-17 10:21:41 +00:00
|
|
|
|
11: required base.Timestamp created_at
|
2016-08-10 12:06:59 +00:00
|
|
|
|
2: required Blocking blocking
|
|
|
|
|
3: required Suspension suspension
|
2016-10-10 13:14:58 +00:00
|
|
|
|
4: required ShopDetails details
|
2017-07-17 10:21:41 +00:00
|
|
|
|
10: required ShopLocation location
|
2016-10-10 13:14:58 +00:00
|
|
|
|
5: required CategoryRef category
|
2016-12-14 11:09:57 +00:00
|
|
|
|
6: optional ShopAccount account
|
2016-12-09 12:05:35 +00:00
|
|
|
|
7: required ContractID contract_id
|
2017-01-20 09:16:31 +00:00
|
|
|
|
8: optional PayoutToolID payout_tool_id
|
2017-01-13 14:24:47 +00:00
|
|
|
|
9: optional Proxy proxy
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
struct ShopAccount {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required CurrencyRef currency
|
2016-12-14 11:09:57 +00:00
|
|
|
|
2: required AccountID settlement
|
2016-10-10 13:14:58 +00:00
|
|
|
|
3: required AccountID guarantee
|
2017-01-19 13:32:22 +00:00
|
|
|
|
/* Аккаунт на который выводятся деньги из системы */
|
|
|
|
|
4: required AccountID payout
|
2016-08-10 12:06:59 +00:00
|
|
|
|
}
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-08-10 12:06:59 +00:00
|
|
|
|
struct ShopDetails {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: optional string description
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 12:05:35 +00:00
|
|
|
|
union ShopLocation {
|
|
|
|
|
1: string url
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 13:03:31 +00:00
|
|
|
|
/* Инспекция платежа */
|
|
|
|
|
|
|
|
|
|
enum RiskScore {
|
|
|
|
|
low = 1
|
|
|
|
|
high = 100
|
2017-08-10 08:43:26 +00:00
|
|
|
|
fatal = 9999
|
2016-12-09 13:03:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/* Contracts */
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct ContractorRef { 1: required ObjectID id }
|
|
|
|
|
|
2016-04-26 16:01:04 +00:00
|
|
|
|
/** Лицо, выступающее стороной договора. */
|
2017-07-17 10:21:41 +00:00
|
|
|
|
union Contractor {
|
|
|
|
|
1: LegalEntity legal_entity
|
|
|
|
|
2: RegisteredUser registered_user
|
2016-12-09 15:01:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
struct RegisteredUser {
|
|
|
|
|
1: required string email
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union LegalEntity {
|
2016-12-09 15:01:35 +00:00
|
|
|
|
1: RussianLegalEntity russian_legal_entity
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 15:01:35 +00:00
|
|
|
|
/** Юридическое лицо-резидент РФ */
|
|
|
|
|
struct RussianLegalEntity {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* Наименование */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
1: required string registered_name
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* ОГРН */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
2: required string registered_number
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* ИНН/КПП */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
3: required string inn
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* Адрес места нахождения */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
4: required string actual_address
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* Адрес для отправки корреспонденции (почтовый) */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
5: required string post_address
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* Наименование должности ЕИО/представителя */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
6: required string representative_position
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* ФИО ЕИО/представителя */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
7: required string representative_full_name
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/* Наименование документа, на основании которого действует ЕИО/представитель */
|
2016-12-09 15:01:35 +00:00
|
|
|
|
8: required string representative_document
|
2017-07-17 10:21:41 +00:00
|
|
|
|
/* Реквизиты юр.лица */
|
|
|
|
|
9: required BankAccount bank_account
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Банковский счёт. */
|
2016-12-09 12:05:35 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
struct BankAccount {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: required string account
|
|
|
|
|
2: required string bank_name
|
|
|
|
|
3: required string bank_post_account
|
|
|
|
|
4: required string bank_bik
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
typedef base.ID PayoutToolID
|
2016-12-09 12:05:35 +00:00
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
struct PayoutTool {
|
|
|
|
|
1: required PayoutToolID id
|
2017-07-17 10:21:41 +00:00
|
|
|
|
4: required base.Timestamp created_at
|
2016-12-09 12:05:35 +00:00
|
|
|
|
2: required CurrencyRef currency
|
2017-01-20 09:16:31 +00:00
|
|
|
|
3: required PayoutToolInfo payout_tool_info
|
2016-12-09 12:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
union PayoutToolInfo {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: BankAccount bank_account
|
|
|
|
|
}
|
|
|
|
|
|
2017-07-17 10:21:41 +00:00
|
|
|
|
typedef base.ID ContractID
|
2016-12-09 12:05:35 +00:00
|
|
|
|
|
|
|
|
|
/** Договор */
|
|
|
|
|
struct Contract {
|
|
|
|
|
1: required ContractID id
|
2016-12-12 16:12:03 +00:00
|
|
|
|
3: optional Contractor contractor
|
2017-07-17 10:21:41 +00:00
|
|
|
|
11: required base.Timestamp created_at
|
2017-01-20 09:16:31 +00:00
|
|
|
|
4: optional base.Timestamp valid_since
|
|
|
|
|
5: optional base.Timestamp valid_until
|
|
|
|
|
6: required ContractStatus status
|
|
|
|
|
7: required TermSetHierarchyRef terms
|
|
|
|
|
8: required list<ContractAdjustment> adjustments
|
|
|
|
|
9: required list<PayoutTool> payout_tools
|
|
|
|
|
10: optional LegalAgreement legal_agreement
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
/** Юридическое соглашение */
|
|
|
|
|
struct LegalAgreement {
|
|
|
|
|
1: required base.Timestamp signed_at
|
|
|
|
|
2: required string legal_agreement_id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union ContractStatus {
|
|
|
|
|
1: ContractActive active
|
|
|
|
|
2: ContractTerminated terminated
|
2017-07-17 10:21:41 +00:00
|
|
|
|
3: ContractExpired expired
|
2017-01-20 09:16:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ContractActive {}
|
|
|
|
|
struct ContractTerminated { 1: required base.Timestamp terminated_at }
|
2017-07-17 10:21:41 +00:00
|
|
|
|
struct ContractExpired {}
|
2016-12-09 12:05:35 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/* Categories */
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct CategoryRef { 1: required ObjectID id }
|
|
|
|
|
|
2016-10-20 10:47:12 +00:00
|
|
|
|
enum CategoryType {
|
|
|
|
|
test
|
|
|
|
|
live
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/** Категория продаваемых товаров или услуг. */
|
|
|
|
|
struct Category {
|
|
|
|
|
1: required string name
|
2016-10-20 10:47:12 +00:00
|
|
|
|
2: required string description
|
|
|
|
|
3: optional CategoryType type = CategoryType.test
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 12:05:35 +00:00
|
|
|
|
struct ContractTemplateRef { 1: required ObjectID id }
|
|
|
|
|
|
|
|
|
|
/** Шаблон договора или поправки **/
|
|
|
|
|
struct ContractTemplate {
|
2017-05-24 09:41:15 +00:00
|
|
|
|
4: optional string name
|
|
|
|
|
5: optional string description
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: optional Lifetime valid_since
|
|
|
|
|
2: optional Lifetime valid_until
|
|
|
|
|
3: required TermSetHierarchyRef terms
|
2016-12-09 12:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union Lifetime {
|
|
|
|
|
1: base.Timestamp timestamp
|
2017-01-20 09:16:31 +00:00
|
|
|
|
2: LifetimeInterval interval
|
2016-12-09 12:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
struct LifetimeInterval {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: optional i16 years
|
|
|
|
|
2: optional i16 months
|
|
|
|
|
3: optional i16 days
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Поправки к договору **/
|
2017-07-17 10:21:41 +00:00
|
|
|
|
typedef base.ID ContractAdjustmentID
|
|
|
|
|
|
2016-12-09 12:05:35 +00:00
|
|
|
|
struct ContractAdjustment {
|
2017-07-17 10:21:41 +00:00
|
|
|
|
1: required ContractAdjustmentID id
|
|
|
|
|
5: required base.Timestamp created_at
|
2017-01-20 09:16:31 +00:00
|
|
|
|
2: optional base.Timestamp valid_since
|
|
|
|
|
3: optional base.Timestamp valid_until
|
|
|
|
|
4: required TermSetHierarchyRef terms
|
2016-12-09 12:05:35 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Условия **/
|
|
|
|
|
// Service
|
|
|
|
|
// Payments
|
|
|
|
|
// Regular
|
|
|
|
|
// Held
|
|
|
|
|
// Recurring
|
|
|
|
|
// ...
|
|
|
|
|
// Payouts
|
|
|
|
|
// ...
|
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
struct TermSet {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: optional PaymentsServiceTerms payments
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
struct TimedTermSet {
|
|
|
|
|
1: required base.TimestampInterval action_time
|
|
|
|
|
2: required TermSet terms
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct TermSetHierarchy {
|
2017-05-24 09:41:15 +00:00
|
|
|
|
3: optional string name
|
|
|
|
|
4: optional string description
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: optional TermSetHierarchyRef parent_terms
|
|
|
|
|
2: required list<TimedTermSet> term_sets
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct TermSetHierarchyRef { 1: required ObjectID id }
|
|
|
|
|
|
2016-12-09 12:05:35 +00:00
|
|
|
|
/* Service terms */
|
|
|
|
|
|
|
|
|
|
struct PaymentsServiceTerms {
|
|
|
|
|
/* Shop level */
|
|
|
|
|
1: optional CurrencySelector currencies
|
|
|
|
|
2: optional CategorySelector categories
|
|
|
|
|
/* Invoice level*/
|
|
|
|
|
4: optional PaymentMethodSelector payment_methods
|
2016-12-14 11:09:57 +00:00
|
|
|
|
5: optional CashLimitSelector cash_limit
|
2016-12-09 12:05:35 +00:00
|
|
|
|
/* Payment level */
|
|
|
|
|
6: optional CashFlowSelector fees
|
|
|
|
|
/* Undefined level */
|
|
|
|
|
3: optional GuaranteeFundTerms guarantee_fund
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct GuaranteeFundTerms {
|
2016-12-14 11:09:57 +00:00
|
|
|
|
1: optional CashLimitSelector limits
|
2016-12-09 12:05:35 +00:00
|
|
|
|
2: optional CashFlowSelector fees
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/* Currencies */
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/** Символьный код, уникально идентифицирующий валюту. */
|
|
|
|
|
typedef string CurrencySymbolicCode
|
|
|
|
|
|
|
|
|
|
struct CurrencyRef { 1: required CurrencySymbolicCode symbolic_code }
|
|
|
|
|
|
|
|
|
|
/** Валюта. */
|
|
|
|
|
struct Currency {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required CurrencySymbolicCode symbolic_code
|
|
|
|
|
3: required i16 numeric_code
|
|
|
|
|
4: required i16 exponent
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 12:05:35 +00:00
|
|
|
|
union CurrencySelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<CurrencyDecision> decisions
|
2016-12-09 12:05:35 +00:00
|
|
|
|
2: set<CurrencyRef> value
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct CurrencyDecision {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required CurrencySelector then_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Категории */
|
|
|
|
|
|
|
|
|
|
union CategorySelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<CategoryDecision> decisions
|
2016-12-09 12:05:35 +00:00
|
|
|
|
2: set<CategoryRef> value
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct CategoryDecision {
|
2016-12-09 12:05:35 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required CategorySelector then_
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/* Limits */
|
|
|
|
|
|
2017-02-01 10:38:33 +00:00
|
|
|
|
struct CashRange {
|
|
|
|
|
1: required CashBound upper
|
|
|
|
|
2: required CashBound lower
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
union CashBound {
|
|
|
|
|
1: Cash inclusive
|
|
|
|
|
2: Cash exclusive
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
union CashLimitSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<CashLimitDecision> decisions
|
2017-02-01 10:38:33 +00:00
|
|
|
|
2: CashRange value
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
struct CashLimitDecision {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required Predicate if_
|
2016-12-14 11:09:57 +00:00
|
|
|
|
2: required CashLimitSelector then_
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Payment methods */
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
union PaymentMethod {
|
|
|
|
|
1: BankCardPaymentSystem bank_card
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum BankCardPaymentSystem {
|
|
|
|
|
visa
|
|
|
|
|
mastercard
|
2016-10-20 10:44:47 +00:00
|
|
|
|
visaelectron
|
|
|
|
|
maestro
|
|
|
|
|
forbrugsforeningen
|
|
|
|
|
dankort
|
|
|
|
|
amex
|
|
|
|
|
dinersclub
|
|
|
|
|
discover
|
|
|
|
|
unionpay
|
|
|
|
|
jcb
|
|
|
|
|
nspkmir
|
2016-04-26 16:01:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PaymentTool {
|
|
|
|
|
1: BankCard bank_card
|
2017-08-11 09:01:10 +00:00
|
|
|
|
2: PaymentTerminal payment_terminal
|
2016-04-26 16:01:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-26 12:06:07 +00:00
|
|
|
|
typedef string Token
|
|
|
|
|
|
|
|
|
|
struct BankCard {
|
|
|
|
|
1: required Token token
|
|
|
|
|
2: required BankCardPaymentSystem payment_system
|
|
|
|
|
3: required string bin
|
|
|
|
|
4: required string masked_pan
|
|
|
|
|
}
|
|
|
|
|
|
2017-08-11 09:01:10 +00:00
|
|
|
|
/** Платеж через терминал **/
|
|
|
|
|
struct PaymentTerminal {
|
|
|
|
|
1: required TerminalPaymentProvider terminal_type
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Вид платежного терминала
|
|
|
|
|
*
|
|
|
|
|
* например Евросеть
|
|
|
|
|
**/
|
|
|
|
|
enum TerminalPaymentProvider {
|
|
|
|
|
euroset
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct BankCardBINRangeRef { 1: required ObjectID id }
|
|
|
|
|
|
|
|
|
|
struct BankCardBINRange {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
|
|
|
|
3: required set<string> bins
|
2016-05-26 12:06:07 +00:00
|
|
|
|
}
|
2016-04-26 16:01:04 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct PaymentMethodRef { 1: required PaymentMethod id }
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/** Способ платежа, категория платёжного средства. */
|
2016-04-26 16:01:04 +00:00
|
|
|
|
struct PaymentMethodDefinition {
|
2016-04-19 15:59:22 +00:00
|
|
|
|
1: required string name
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: required string description
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
union PaymentMethodSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<PaymentMethodDecision> decisions
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: set<PaymentMethodRef> value
|
|
|
|
|
}
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct PaymentMethodDecision {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required PaymentMethodSelector then_
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/* Flows */
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
// TODO
|
|
|
|
|
|
|
|
|
|
/* Cash flows */
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
/** Счёт в графе финансовых потоков. */
|
|
|
|
|
union CashFlowAccount {
|
|
|
|
|
1: MerchantCashFlowAccount merchant
|
|
|
|
|
2: ProviderCashFlowAccount provider
|
|
|
|
|
3: SystemCashFlowAccount system
|
|
|
|
|
4: ExternalCashFlowAccount external
|
2016-10-17 14:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
enum MerchantCashFlowAccount {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Расчётный счёт:
|
|
|
|
|
* - учёт прибыли по платежам в магазине;
|
|
|
|
|
* - учёт возмещённых вознаграждений.
|
|
|
|
|
*/
|
|
|
|
|
settlement
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Счёт гарантийного депозита:
|
|
|
|
|
* - учёт средств для погашения реализовавшихся рисков по мерчанту.
|
|
|
|
|
*/
|
|
|
|
|
guarantee
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum ProviderCashFlowAccount {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Расчётный счёт:
|
|
|
|
|
* - учёт полученных средств;
|
|
|
|
|
* - учёт вознаграждений.
|
|
|
|
|
*/
|
|
|
|
|
settlement
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum SystemCashFlowAccount {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Расчётный счёт:
|
|
|
|
|
* - учёт полученных и возмещённых вознаграждений.
|
|
|
|
|
*/
|
|
|
|
|
settlement
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum ExternalCashFlowAccount {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Счёт поступлений:
|
|
|
|
|
* - учёт любых поступлений в систему извне.
|
|
|
|
|
*/
|
|
|
|
|
income
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Счёт выводов:
|
|
|
|
|
* - учёт любых выводов из системы вовне.
|
|
|
|
|
*/
|
|
|
|
|
outcome
|
|
|
|
|
|
|
|
|
|
}
|
2016-10-17 14:27:32 +00:00
|
|
|
|
|
|
|
|
|
enum CashFlowConstant {
|
|
|
|
|
invoice_amount
|
|
|
|
|
payment_amount
|
|
|
|
|
// ...
|
|
|
|
|
// TODO
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
typedef map<CashFlowConstant, Cash> CashFlowContext
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
|
|
|
|
/** Граф финансовых потоков. */
|
|
|
|
|
typedef list<CashFlowPosting> CashFlow
|
|
|
|
|
|
|
|
|
|
/** Денежный поток между двумя участниками. */
|
|
|
|
|
struct CashFlowPosting {
|
|
|
|
|
1: required CashFlowAccount source
|
|
|
|
|
2: required CashFlowAccount destination
|
|
|
|
|
3: required CashVolume volume
|
2016-12-14 11:09:57 +00:00
|
|
|
|
4: optional string details
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Полностью вычисленный граф финансовых потоков с проводками всех участников. */
|
|
|
|
|
typedef list<FinalCashFlowPosting> FinalCashFlow
|
|
|
|
|
|
|
|
|
|
/** Вычисленный денежный поток между двумя участниками. */
|
|
|
|
|
struct FinalCashFlowPosting {
|
|
|
|
|
1: required FinalCashFlowAccount source
|
|
|
|
|
2: required FinalCashFlowAccount destination
|
|
|
|
|
3: required Cash volume
|
|
|
|
|
4: optional string details
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct FinalCashFlowAccount {
|
|
|
|
|
1: required CashFlowAccount account_type
|
|
|
|
|
2: required AccountID account_id
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/** Объём финансовой проводки. */
|
|
|
|
|
union CashVolume {
|
|
|
|
|
1: CashVolumeFixed fixed
|
|
|
|
|
2: CashVolumeShare share
|
2016-12-14 11:09:57 +00:00
|
|
|
|
3: CashVolumeProduct product
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/** Объём в абсолютных денежных единицах. */
|
|
|
|
|
struct CashVolumeFixed {
|
2016-12-14 11:09:57 +00:00
|
|
|
|
1: required Cash cash
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Объём в относительных единицах. */
|
|
|
|
|
struct CashVolumeShare {
|
|
|
|
|
1: required base.Rational parts
|
|
|
|
|
2: required CashFlowConstant of
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
/** Композиция различных объёмов. */
|
|
|
|
|
union CashVolumeProduct {
|
|
|
|
|
/** Минимальный из полученных объёмов. */
|
|
|
|
|
1: set<CashVolume> min_of
|
|
|
|
|
/** Максимальный из полученных объёмов. */
|
|
|
|
|
2: set<CashVolume> max_of
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
union CashFlowSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<CashFlowDecision> decisions
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: CashFlow value
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct CashFlowDecision {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required CashFlowSelector then_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Providers */
|
|
|
|
|
|
|
|
|
|
struct ProviderRef { 1: required ObjectID id }
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct Provider {
|
2016-04-19 15:59:22 +00:00
|
|
|
|
1: required string name
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: required string description
|
|
|
|
|
3: required Proxy proxy
|
|
|
|
|
4: required TerminalSelector terminal
|
2017-01-19 13:32:22 +00:00
|
|
|
|
/* Счет для платажей принятых эквайеромв АБС*/
|
|
|
|
|
5: required string abs_account
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
union ProviderSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<ProviderDecision> decisions
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: set<ProviderRef> value
|
|
|
|
|
}
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct ProviderDecision {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required ProviderSelector then_
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct TerminalRef { 1: required ObjectID id }
|
2016-06-02 11:38:27 +00:00
|
|
|
|
|
2016-12-09 13:03:31 +00:00
|
|
|
|
/** Inspectors */
|
|
|
|
|
|
|
|
|
|
struct InspectorRef { 1: required ObjectID id }
|
|
|
|
|
|
|
|
|
|
struct Inspector {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
|
|
|
|
3: required Proxy proxy
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-01 10:38:33 +00:00
|
|
|
|
union InspectorSelector {
|
2017-02-03 13:16:37 +00:00
|
|
|
|
1: list<InspectorDecision> decisions
|
2017-02-01 10:38:33 +00:00
|
|
|
|
2: InspectorRef value
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct InspectorDecision {
|
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required InspectorSelector then_
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/**
|
|
|
|
|
* Обобщённый терминал у провайдера.
|
|
|
|
|
*
|
|
|
|
|
* Представляет собой единицу предоставления услуг по процессингу платежей со
|
|
|
|
|
* стороны провайдера, согласно нашим с ним договорённостям.
|
|
|
|
|
*/
|
|
|
|
|
struct Terminal {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
|
|
|
|
3: required PaymentMethodRef payment_method
|
|
|
|
|
4: required CategoryRef category
|
|
|
|
|
6: required CashFlow cash_flow
|
2016-12-14 11:09:57 +00:00
|
|
|
|
7: required TerminalAccount account
|
2016-10-20 10:47:12 +00:00
|
|
|
|
// TODO
|
|
|
|
|
// 8: optional TerminalDescriptor descriptor
|
2016-12-13 17:23:13 +00:00
|
|
|
|
9: optional ProxyOptions options
|
2016-12-09 13:03:31 +00:00
|
|
|
|
10: required RiskScore risk_coverage
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
2016-06-02 11:38:27 +00:00
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
struct TerminalAccount {
|
|
|
|
|
1: required CurrencyRef currency
|
|
|
|
|
2: required AccountID settlement
|
2016-06-02 11:38:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
union TerminalSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<TerminalDecision> decisions
|
2016-10-10 13:14:58 +00:00
|
|
|
|
2: set<TerminalRef> value
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct TerminalDecision {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required TerminalSelector then_
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Predicates / conditions */
|
|
|
|
|
|
|
|
|
|
union Predicate {
|
2017-02-01 10:38:33 +00:00
|
|
|
|
5: bool constant
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: Condition condition
|
|
|
|
|
2: Predicate is_not
|
|
|
|
|
3: set<Predicate> all_of
|
|
|
|
|
4: set<Predicate> any_of
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union Condition {
|
|
|
|
|
1: CategoryRef category_is
|
|
|
|
|
2: CurrencyRef currency_is
|
2017-02-01 10:38:33 +00:00
|
|
|
|
4: CashRange cost_in
|
2016-12-13 17:23:13 +00:00
|
|
|
|
3: PaymentToolCondition payment_tool
|
2017-02-01 10:38:33 +00:00
|
|
|
|
5: ShopLocation shop_location_is
|
|
|
|
|
6: PartyCondition party
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PaymentToolCondition {
|
2016-12-13 17:23:13 +00:00
|
|
|
|
1: BankCardCondition bank_card
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union BankCardCondition {
|
|
|
|
|
1: BankCardPaymentSystem payment_system_is
|
|
|
|
|
2: BankCardBINRangeRef bin_in
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-01 10:38:33 +00:00
|
|
|
|
struct PartyCondition {
|
|
|
|
|
1: required PartyID id
|
|
|
|
|
2: optional PartyConditionDefinition definition
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union PartyConditionDefinition {
|
|
|
|
|
1: ShopID shop_is
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
/* Proxies */
|
|
|
|
|
|
|
|
|
|
typedef base.StringMap ProxyOptions
|
|
|
|
|
|
2016-06-02 11:38:27 +00:00
|
|
|
|
struct ProxyRef { 1: required ObjectID id }
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct ProxyDefinition {
|
2016-12-13 17:23:13 +00:00
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
|
|
|
|
3: required string url
|
|
|
|
|
4: required ProxyOptions options
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct Proxy {
|
2016-06-02 11:38:27 +00:00
|
|
|
|
1: required ProxyRef ref
|
2017-01-13 14:24:47 +00:00
|
|
|
|
2: required ProxyOptions additional
|
2016-06-02 11:38:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-17 14:27:32 +00:00
|
|
|
|
/* System accounts */
|
|
|
|
|
|
|
|
|
|
struct SystemAccountSetRef { 1: required ObjectID id }
|
|
|
|
|
|
|
|
|
|
struct SystemAccountSet {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
2016-12-14 11:09:57 +00:00
|
|
|
|
3: required map<CurrencyRef, SystemAccount> accounts
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct SystemAccount {
|
|
|
|
|
1: required AccountID settlement
|
2016-10-17 14:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union SystemAccountSetSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<SystemAccountSetDecision> decisions
|
2016-12-14 11:09:57 +00:00
|
|
|
|
2: SystemAccountSetRef value
|
2016-10-17 14:27:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-13 17:23:13 +00:00
|
|
|
|
struct SystemAccountSetDecision {
|
2016-10-17 14:27:32 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required SystemAccountSetSelector then_
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
/* External accounts */
|
|
|
|
|
|
|
|
|
|
struct ExternalAccountSetRef { 1: required ObjectID id }
|
|
|
|
|
|
|
|
|
|
struct ExternalAccountSet {
|
|
|
|
|
1: required string name
|
|
|
|
|
2: required string description
|
|
|
|
|
3: required map<CurrencyRef, ExternalAccount> accounts
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ExternalAccount {
|
|
|
|
|
1: required AccountID income
|
|
|
|
|
2: required AccountID outcome
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
union ExternalAccountSetSelector {
|
2017-01-20 09:16:31 +00:00
|
|
|
|
1: list<ExternalAccountSetDecision> decisions
|
2016-12-14 11:09:57 +00:00
|
|
|
|
2: ExternalAccountSetRef value
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-11 14:33:44 +00:00
|
|
|
|
struct ExternalAccountSetDecision {
|
2016-12-14 11:09:57 +00:00
|
|
|
|
1: required Predicate if_
|
|
|
|
|
2: required ExternalAccountSetSelector then_
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/* Merchant prototype */
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct PartyPrototypeRef { 1: required ObjectID id }
|
2016-05-18 16:27:06 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/** Прототип мерчанта по умолчанию. */
|
2016-08-10 12:06:59 +00:00
|
|
|
|
struct PartyPrototype {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required ShopPrototype shop
|
2017-07-17 10:21:41 +00:00
|
|
|
|
3: required ContractPrototype contract
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ShopPrototype {
|
2017-07-17 10:21:41 +00:00
|
|
|
|
5: required ShopID shop_id
|
2016-10-10 13:14:58 +00:00
|
|
|
|
1: required CategoryRef category
|
|
|
|
|
2: required CurrencyRef currency
|
2017-07-17 10:21:41 +00:00
|
|
|
|
3: required ShopDetails details
|
|
|
|
|
4: required ShopLocation location
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ContractPrototype {
|
|
|
|
|
1: required ContractID contract_id
|
|
|
|
|
2: required ContractTemplateRef test_contract_template
|
|
|
|
|
3: required PayoutToolPrototype payout_tool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PayoutToolPrototype {
|
|
|
|
|
1: required PayoutToolID payout_tool_id
|
|
|
|
|
2: required PayoutToolInfo payout_tool_info
|
|
|
|
|
3: required CurrencyRef payout_tool_currency
|
2016-10-10 13:14:58 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Root config */
|
|
|
|
|
|
|
|
|
|
struct GlobalsRef {}
|
|
|
|
|
|
|
|
|
|
struct Globals {
|
|
|
|
|
1: required PartyPrototypeRef party_prototype
|
|
|
|
|
2: required ProviderSelector providers
|
2016-12-14 11:09:57 +00:00
|
|
|
|
3: required SystemAccountSetSelector system_account_set
|
|
|
|
|
4: required ExternalAccountSetSelector external_account_set
|
2017-02-01 10:38:33 +00:00
|
|
|
|
5: required InspectorSelector inspector
|
2016-12-14 11:09:57 +00:00
|
|
|
|
6: required ContractTemplateRef default_contract_template
|
2017-01-13 14:24:47 +00:00
|
|
|
|
7: required ProxyRef common_merchant_proxy
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-10-08 12:07:07 +00:00
|
|
|
|
/** Dummy (for integrity test purpose) */
|
|
|
|
|
struct Dummy {}
|
|
|
|
|
|
|
|
|
|
struct DummyRef {
|
|
|
|
|
1: base.ID id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct DummyObject {
|
|
|
|
|
1: DummyRef ref
|
|
|
|
|
2: Dummy data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct DummyLink {
|
|
|
|
|
1: DummyRef link
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct DummyLinkRef {
|
|
|
|
|
1: base.ID id
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct DummyLinkObject {
|
|
|
|
|
1: DummyLinkRef ref
|
|
|
|
|
2: DummyLink data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
/* Type enumerations */
|
2016-12-09 12:05:35 +00:00
|
|
|
|
struct ContractTemplateObject {
|
|
|
|
|
1: required ContractTemplateRef ref
|
|
|
|
|
2: required ContractTemplate data
|
|
|
|
|
}
|
2016-04-19 15:59:22 +00:00
|
|
|
|
|
2017-01-20 09:16:31 +00:00
|
|
|
|
struct TermSetHierarchyObject {
|
|
|
|
|
1: required TermSetHierarchyRef ref
|
|
|
|
|
2: required TermSetHierarchy data
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct CategoryObject {
|
|
|
|
|
1: required CategoryRef ref
|
|
|
|
|
2: required Category data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct CurrencyObject {
|
|
|
|
|
1: required CurrencyRef ref
|
|
|
|
|
2: required Currency data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PaymentMethodObject {
|
|
|
|
|
1: required PaymentMethodRef ref
|
|
|
|
|
2: required PaymentMethodDefinition data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct BankCardBINRangeObject {
|
|
|
|
|
1: required BankCardBINRangeRef ref
|
|
|
|
|
2: required BankCardBINRange data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ContractorObject {
|
|
|
|
|
1: required ContractorRef ref
|
|
|
|
|
2: required Contractor data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct ProviderObject {
|
|
|
|
|
1: required ProviderRef ref
|
|
|
|
|
2: required Provider data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct TerminalObject {
|
|
|
|
|
1: required TerminalRef ref
|
|
|
|
|
2: required Terminal data
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-09 13:03:31 +00:00
|
|
|
|
struct InspectorObject {
|
|
|
|
|
1: required InspectorRef ref
|
|
|
|
|
2: required Inspector data
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-17 14:27:32 +00:00
|
|
|
|
struct SystemAccountSetObject {
|
|
|
|
|
1: required SystemAccountSetRef ref
|
|
|
|
|
2: required SystemAccountSet data
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
struct ExternalAccountSetObject {
|
|
|
|
|
1: required ExternalAccountSetRef ref
|
|
|
|
|
2: required ExternalAccountSet data
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-10 13:14:58 +00:00
|
|
|
|
struct ProxyObject {
|
|
|
|
|
1: required ProxyRef ref
|
|
|
|
|
2: required ProxyDefinition data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct PartyPrototypeObject {
|
|
|
|
|
1: required PartyPrototypeRef ref
|
|
|
|
|
2: required PartyPrototype data
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct GlobalsObject {
|
|
|
|
|
1: required GlobalsRef ref
|
|
|
|
|
2: required Globals data
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
union Reference {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
1 : CategoryRef category
|
|
|
|
|
2 : CurrencyRef currency
|
|
|
|
|
3 : PaymentMethodRef payment_method
|
|
|
|
|
4 : ContractorRef contractor
|
|
|
|
|
5 : BankCardBINRangeRef bank_card_bin_range
|
|
|
|
|
6 : ContractTemplateRef contract_template
|
2017-01-20 09:16:31 +00:00
|
|
|
|
17 : TermSetHierarchyRef term_set_hierarchy
|
2016-12-14 11:09:57 +00:00
|
|
|
|
7 : ProviderRef provider
|
|
|
|
|
8 : TerminalRef terminal
|
|
|
|
|
15 : InspectorRef inspector
|
|
|
|
|
14 : SystemAccountSetRef system_account_set
|
|
|
|
|
16 : ExternalAccountSetRef external_account_set
|
|
|
|
|
9 : ProxyRef proxy
|
|
|
|
|
10 : PartyPrototypeRef party_prototype
|
|
|
|
|
11 : GlobalsRef globals
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
12 : DummyRef dummy
|
|
|
|
|
13 : DummyLinkRef dummy_link
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-05-26 12:06:07 +00:00
|
|
|
|
union DomainObject {
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
2016-12-14 11:09:57 +00:00
|
|
|
|
1 : CategoryObject category
|
|
|
|
|
2 : CurrencyObject currency
|
|
|
|
|
3 : PaymentMethodObject payment_method
|
|
|
|
|
4 : ContractorObject contractor
|
|
|
|
|
5 : BankCardBINRangeObject bank_card_bin_range
|
|
|
|
|
6 : ContractTemplateObject contract_template
|
2017-01-20 09:16:31 +00:00
|
|
|
|
17 : TermSetHierarchyObject term_set_hierarchy
|
2016-12-14 11:09:57 +00:00
|
|
|
|
7 : ProviderObject provider
|
|
|
|
|
8 : TerminalObject terminal
|
|
|
|
|
15 : InspectorObject inspector
|
|
|
|
|
14 : SystemAccountSetObject system_account_set
|
|
|
|
|
16 : ExternalAccountSetObject external_account_set
|
|
|
|
|
9 : ProxyObject proxy
|
|
|
|
|
10 : PartyPrototypeObject party_prototype
|
|
|
|
|
11 : GlobalsObject globals
|
|
|
|
|
|
|
|
|
|
12 : DummyObject dummy
|
|
|
|
|
13 : DummyLinkObject dummy_link
|
2016-10-10 13:14:58 +00:00
|
|
|
|
|
2016-04-19 15:59:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Domain */
|
|
|
|
|
|
2016-05-26 12:06:07 +00:00
|
|
|
|
typedef map<Reference, DomainObject> Domain
|