mirror of
https://github.com/valitydev/geck.git
synced 2024-11-06 01:35:22 +00:00
Ft/bj 140/use more than one damsel versions (#28)
* init * remove copy past * use many versions of damsel in project remove copy-paste thrift files
This commit is contained in:
parent
e222f9c83d
commit
97d38eaaae
36
Makefile
Normal file
36
Makefile
Normal file
@ -0,0 +1,36 @@
|
||||
UTILS_PATH := build_utils
|
||||
TEMPLATES_PATH := .
|
||||
|
||||
# Name of the service
|
||||
SERVICE_NAME := geck
|
||||
# Service image default tag
|
||||
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
||||
# The tag for service image to be pushed with
|
||||
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
||||
|
||||
BUILD_IMAGE_TAG := 3ed839a79132205fd470c1f66c0b6aa37792c809
|
||||
|
||||
CALL_W_CONTAINER := clean all create java_compile compile doc deploy_nexus java_install
|
||||
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
||||
|
||||
|
||||
ifdef SETTINGS_XML
|
||||
DOCKER_RUN_OPTS = -v $(SETTINGS_XML):$(SETTINGS_XML)
|
||||
DOCKER_RUN_OPTS += -e SETTINGS_XML=$(SETTINGS_XML)
|
||||
endif
|
||||
|
||||
ifdef LOCAL_BUILD
|
||||
DOCKER_RUN_OPTS += -v $$HOME/.m2:/home/$(UNAME)/.m2:rw
|
||||
endif
|
||||
|
||||
java_compile:
|
||||
$(if $(SETTINGS_XML),,echo "SETTINGS_XML not defined" ; exit 1)
|
||||
mvn compile -s $(SETTINGS_XML)
|
||||
|
||||
deploy_nexus:
|
||||
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)
|
||||
mvn deploy -s $(SETTINGS_XML)
|
||||
|
||||
java_install:
|
||||
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)
|
||||
mvn install -s $(SETTINGS_XML)
|
@ -7,3 +7,11 @@
|
||||
- mock
|
||||
- ~~migrator~~
|
||||
- ~~filter~~
|
||||
|
||||
|
||||
|
||||
### HOW-TO
|
||||
|
||||
Собрать и инсталировать jar(s) в локальный мавен репозиторий(без локально установленного трифта):
|
||||
|
||||
* make wc_java_install LOCAL_BUILD=true SETTINGS_XML=path_to_rbk_maven_settings
|
@ -49,6 +49,20 @@
|
||||
<artifactId>json</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>damsel</artifactId>
|
||||
<version>1.113-bfed187</version>
|
||||
<classifier>v113</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.rbkmoney</groupId>
|
||||
<artifactId>damsel</artifactId>
|
||||
<version>1.130-4e4e214</version>
|
||||
<classifier>v130</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.rbkmoney.geck.serializer;
|
||||
|
||||
import com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted;
|
||||
import com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted;
|
||||
import com.rbkmoney.geck.serializer.test.Status;
|
||||
import com.rbkmoney.geck.serializer.test.TestObject;
|
||||
import com.rbkmoney.geck.serializer.kit.mock.MockTBaseProcessor;
|
||||
|
@ -2,9 +2,9 @@ package com.rbkmoney.geck.serializer.kit.damsel;
|
||||
|
||||
import com.bazaarvoice.jolt.Chainr;
|
||||
import com.bazaarvoice.jolt.JsonUtils;
|
||||
import com.rbkmoney.damsel_v133.domain.Invoice;
|
||||
import com.rbkmoney.damsel_v133.payment_processing.*;
|
||||
import com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted;
|
||||
import com.rbkmoney.damsel.v113.domain.Invoice;
|
||||
import com.rbkmoney.damsel.v113.payment_processing.*;
|
||||
import com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted;
|
||||
import com.rbkmoney.geck.serializer.GeckTestUtil;
|
||||
import com.rbkmoney.geck.serializer.kit.json.JsonHandler;
|
||||
import com.rbkmoney.geck.serializer.kit.mock.FixedValueGenerator;
|
||||
@ -16,8 +16,6 @@ import com.rbkmoney.geck.serializer.kit.object.ObjectHandler;
|
||||
import com.rbkmoney.geck.serializer.kit.object.ObjectProcessor;
|
||||
import com.rbkmoney.geck.serializer.kit.tbase.TBaseHandler;
|
||||
import com.rbkmoney.geck.serializer.kit.tbase.TBaseProcessor;
|
||||
import com.rbkmoney.geck.serializer.test.MapListTest;
|
||||
import com.rbkmoney.geck.serializer.test.Unknown;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.junit.Assert;
|
||||
@ -25,6 +23,7 @@ import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -33,8 +32,8 @@ import java.util.List;
|
||||
public class DamselTest {
|
||||
@Test
|
||||
public void jsonInvoiceTest() throws JSONException, IOException {
|
||||
//com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted invoice = new MockTBaseProcessor().process(new com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted.class));
|
||||
com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted invoice = new MockTBaseProcessor().process(new com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted.class));
|
||||
//com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted invoice = new MockTBaseProcessor().process(new com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted.class));
|
||||
com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted invoice = new MockTBaseProcessor().process(new com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted.class));
|
||||
String json = new TBaseProcessor().process(invoice, new JsonHandler()).toString();
|
||||
System.out.println(json);
|
||||
new JSONObject(json);
|
||||
@ -79,69 +78,71 @@ public class DamselTest {
|
||||
|
||||
@Test
|
||||
public void pathMatchingTest() throws IOException {
|
||||
List<com.rbkmoney.damsel_v133.payment_processing.Event> eventV133List = new ArrayList<>();
|
||||
List<com.rbkmoney.damsel.v113.payment_processing.Event> eventV113List = new ArrayList<>();
|
||||
|
||||
//generated 10 "invoice created" events
|
||||
addV133InvoiceEvents(eventV133List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_created(new InvoiceCreated(new Invoice()))));
|
||||
addV113InvoiceEvents(eventV113List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_created(new InvoiceCreated(new Invoice()))));
|
||||
|
||||
//generated 10 "invoice payment started" events
|
||||
addV133InvoiceEvents(eventV133List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_payment_event(InvoicePaymentEvent.invoice_payment_started(new com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted()))));
|
||||
addV113InvoiceEvents(eventV113List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_payment_event(InvoicePaymentEvent.invoice_payment_started(new com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted()))));
|
||||
|
||||
//generated 10 "invoice status changed" events
|
||||
addV133InvoiceEvents(eventV133List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_status_changed(new InvoiceStatusChanged())));
|
||||
addV113InvoiceEvents(eventV113List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_status_changed(new InvoiceStatusChanged())));
|
||||
|
||||
//generated 10 "invoice payment status changed" events
|
||||
addV133InvoiceEvents(eventV133List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_payment_event(InvoicePaymentEvent.invoice_payment_status_changed(new com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStatusChanged()))));
|
||||
addV113InvoiceEvents(eventV113List, 10, EventPayload.invoice_event(InvoiceEvent.invoice_payment_event(InvoicePaymentEvent.invoice_payment_status_changed(new com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStatusChanged()))));
|
||||
|
||||
|
||||
for (com.rbkmoney.damsel_v133.payment_processing.Event event133Thrift : eventV133List) {
|
||||
Object event133Jolt = new TBaseProcessor().process(event133Thrift, new ObjectHandler());
|
||||
for (com.rbkmoney.damsel.v113.payment_processing.Event event113Thrift : eventV113List) {
|
||||
Object event113Jolt = new TBaseProcessor().process(event113Thrift, new ObjectHandler());
|
||||
List chainrSpecJSON = JsonUtils.jsonToList(this.getClass().getResourceAsStream("/spec_event.json"));
|
||||
Chainr chainr = Chainr.fromSpec(chainrSpecJSON);
|
||||
Object event136Jolt = chainr.transform(event133Jolt);
|
||||
Object event130Jolt = chainr.transform(event113Jolt);
|
||||
try {
|
||||
new ObjectProcessor().process(event136Jolt, new TBaseHandler<>(com.rbkmoney.damsel_v136.payment_processing.Event.class));
|
||||
new ObjectProcessor().process(event130Jolt, new TBaseHandler<>(com.rbkmoney.damsel.v130.payment_processing.Event.class));
|
||||
} catch (IOException ex) {
|
||||
System.out.println("v133:\n" + JsonUtils.toPrettyJsonString(event133Jolt));
|
||||
System.out.println("v136:\n" + JsonUtils.toPrettyJsonString(event136Jolt));
|
||||
System.out.println("v113:\n" + JsonUtils.toPrettyJsonString(event113Jolt));
|
||||
System.out.println("v130:\n" + JsonUtils.toPrettyJsonString(event130Jolt));
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addV133InvoiceEvents(List<com.rbkmoney.damsel_v133.payment_processing.Event> events, int count, EventPayload eventPayload) throws IOException {
|
||||
private void addV113InvoiceEvents(List<com.rbkmoney.damsel.v113.payment_processing.Event> events, int count, EventPayload eventPayload) throws IOException {
|
||||
for (int i = 0; i < count; i++) {
|
||||
com.rbkmoney.damsel_v133.payment_processing.Event event133 = new com.rbkmoney.damsel_v133.payment_processing.Event();
|
||||
event133.setPayload(eventPayload);
|
||||
com.rbkmoney.damsel.v113.payment_processing.Event event113 = new com.rbkmoney.damsel.v113.payment_processing.Event();
|
||||
event113.setPayload(eventPayload);
|
||||
|
||||
events.add(new MockTBaseProcessor(MockMode.ALL)
|
||||
.process(event133,
|
||||
new TBaseHandler<>(com.rbkmoney.damsel_v133.payment_processing.Event.class)));
|
||||
events.add(new MockTBaseProcessor(MockMode.REQUIRED_ONLY)
|
||||
.process(event113,
|
||||
new TBaseHandler<>(com.rbkmoney.damsel.v113.payment_processing.Event.class)));
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test() throws IOException {
|
||||
com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted invoice_v136 =
|
||||
new MockTBaseProcessor(MockMode.ALL, new FixedValueGenerator()).process(new com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel_v136.payment_processing.InvoicePaymentStarted.class));
|
||||
String json_v136 = new TBaseProcessor().process(invoice_v136, new JsonHandler()).toString();
|
||||
System.out.println(json_v136);
|
||||
Object inputJSON_v136 = JsonUtils.jsonToObject(json_v136);
|
||||
com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted invoice_v130 =
|
||||
new MockTBaseProcessor(MockMode.ALL, new FixedValueGenerator()).process(new com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel.v130.payment_processing.InvoicePaymentStarted.class));
|
||||
invoice_v130.cash_flow = null;
|
||||
invoice_v130.payment.trx.extra = new HashMap<>();
|
||||
String json_v130 = new TBaseProcessor().process(invoice_v130, new JsonHandler()).toString();
|
||||
System.out.println(json_v130);
|
||||
Object inputJSON_v130 = JsonUtils.jsonToObject(json_v130);
|
||||
|
||||
List chainrSpecJSON = JsonUtils.jsonToList(this.getClass().getResourceAsStream("/spec_invoice.json"));
|
||||
Chainr chainr = Chainr.fromSpec(chainrSpecJSON);
|
||||
|
||||
Object transformedOutput = chainr.transform(inputJSON_v136);
|
||||
Object transformedOutput = chainr.transform(inputJSON_v130);
|
||||
String transformedInvoice = JsonUtils.toJsonString(transformedOutput);
|
||||
System.out.println(transformedInvoice);
|
||||
|
||||
com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted invoice_v133 =
|
||||
new MockTBaseProcessor(MockMode.ALL, new FixedValueGenerator()).process(new com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel_v133.payment_processing.InvoicePaymentStarted.class));
|
||||
String json_v133 = new TBaseProcessor().process(invoice_v133, new JsonHandler()).toString();
|
||||
Object inputJSON_v133 = JsonUtils.jsonToObject(json_v133);
|
||||
System.out.println(json_v133);
|
||||
com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted invoice_v113 =
|
||||
new MockTBaseProcessor(MockMode.ALL, new FixedValueGenerator()).process(new com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted(), new TBaseHandler<>(com.rbkmoney.damsel.v113.payment_processing.InvoicePaymentStarted.class));
|
||||
invoice_v113.cash_flow = null;
|
||||
String json_v113 = new TBaseProcessor().process(invoice_v113, new JsonHandler()).toString();
|
||||
Object inputJSON_v113 = JsonUtils.jsonToObject(json_v113);
|
||||
System.out.println(json_v113);
|
||||
|
||||
Assert.assertEquals(inputJSON_v133, transformedOutput);
|
||||
Assert.assertEquals(inputJSON_v113,transformedOutput);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,94 +0,0 @@
|
||||
/*
|
||||
* Базовые, наиболее общие определения
|
||||
*/
|
||||
|
||||
namespace java com.rbkmoney.damsel_v133.base
|
||||
|
||||
/** Идентификатор */
|
||||
typedef string ID
|
||||
|
||||
/** Пространство имён */
|
||||
typedef string Namespace
|
||||
|
||||
/** Идентификатор некоторого события */
|
||||
typedef i64 EventID
|
||||
|
||||
/** Непрозрачный для участника общения набор данных */
|
||||
typedef binary Opaque
|
||||
|
||||
/** Набор данных, подлежащий интерпретации согласно типу содержимого. */
|
||||
struct Content {
|
||||
/** Тип содержимого, согласно [RFC2046](https://www.ietf.org/rfc/rfc2046) */
|
||||
1: required string type
|
||||
2: required binary data
|
||||
}
|
||||
|
||||
/**
|
||||
* Отметка во времени согласно RFC 3339.
|
||||
*
|
||||
* Строка должна содержать дату и время в UTC в следующем формате:
|
||||
* `2016-03-22T06:12:27Z`.
|
||||
*/
|
||||
typedef string Timestamp
|
||||
|
||||
/** Отображение из строки в строку */
|
||||
typedef map<string, string> StringMap
|
||||
|
||||
/** Рациональное число. */
|
||||
struct Rational {
|
||||
1: required i64 p
|
||||
2: required i64 q
|
||||
}
|
||||
|
||||
/** Отрезок времени в секундах */
|
||||
typedef i32 Timeout
|
||||
|
||||
/** Значение ассоциации */
|
||||
typedef string Tag
|
||||
|
||||
/** Критерий остановки таймера */
|
||||
union Timer {
|
||||
/** Отрезок времени, после истечения которого таймер остановится */
|
||||
1: Timeout timeout
|
||||
/** Отметка во времени, при пересечении которой таймер остановится */
|
||||
2: Timestamp deadline
|
||||
}
|
||||
|
||||
/** Общий успех */
|
||||
struct Ok {
|
||||
}
|
||||
|
||||
/** Общая ошибка */
|
||||
struct Error {
|
||||
/** Уникальный признак ошибки, пригодный для обработки машиной */
|
||||
1: required string code
|
||||
/** Описание ошибки, пригодное для восприятия человеком */
|
||||
2: optional string description
|
||||
}
|
||||
|
||||
/** Общее исключение */
|
||||
exception Failure {
|
||||
/** Ошибка, которая привела к возникновению исключения */
|
||||
//Нельзя назвать поле `error` из-за особенностей генерации thrift Go - приводит к одинаковым именам для функции и поля структуры
|
||||
1: required Error e
|
||||
}
|
||||
|
||||
/**
|
||||
* Исключение, сигнализирующее о возникновение транзиентной проблемы, которая с высокой
|
||||
* вероятностью не повторится при последующих попытках
|
||||
*/
|
||||
exception TryLater {
|
||||
/** Транзиентная ошибка, которая привела к возникновению исключения */
|
||||
1: required Error e
|
||||
}
|
||||
|
||||
/**
|
||||
* Исключение, сигнализирующее о непригодных с точки зрения бизнес-логики входных данных
|
||||
*/
|
||||
exception InvalidRequest {
|
||||
/** Список пригодных для восприятия человеком ошибок во входных данных */
|
||||
1: required list<string> errors
|
||||
}
|
||||
|
||||
/** Исключение, сигнализирующее об отсутствии объекта или процесса */
|
||||
exception NotFound {}
|
@ -1,835 +0,0 @@
|
||||
/**
|
||||
* Определения предметной области.
|
||||
*/
|
||||
|
||||
include "base.thrift"
|
||||
|
||||
namespace java com.rbkmoney.damsel_v133.domain
|
||||
namespace erlang domain
|
||||
|
||||
typedef i32 SchemaRevision
|
||||
typedef i64 DataRevision
|
||||
|
||||
const SchemaRevision SCHEMA_REVISION = 42
|
||||
|
||||
typedef i32 ObjectID
|
||||
|
||||
/* Common */
|
||||
|
||||
/** Контактная информация. **/
|
||||
struct ContactInfo {
|
||||
1: optional string phone_number
|
||||
2: optional string email
|
||||
}
|
||||
|
||||
typedef base.Error OperationError
|
||||
|
||||
/** Сумма в минимальных денежных единицах. */
|
||||
typedef i64 Amount
|
||||
|
||||
/** Номер счёта. */
|
||||
typedef i64 AccountID
|
||||
|
||||
/** Денежные средства, состоящие из суммы и валюты. */
|
||||
struct Cash {
|
||||
1: required Amount amount
|
||||
2: required Currency currency
|
||||
}
|
||||
|
||||
/* Contractor transactions */
|
||||
|
||||
struct TransactionInfo {
|
||||
1: required string id
|
||||
2: optional base.Timestamp timestamp
|
||||
3: required base.StringMap extra
|
||||
}
|
||||
|
||||
/* Invoices */
|
||||
|
||||
typedef base.ID InvoiceID
|
||||
typedef base.ID InvoicePaymentID
|
||||
typedef base.Content InvoiceContext
|
||||
typedef base.Content InvoicePaymentContext
|
||||
typedef string PaymentSession
|
||||
typedef string Fingerprint
|
||||
typedef string IPAddress
|
||||
|
||||
struct Invoice {
|
||||
1: required InvoiceID id
|
||||
2: required PartyID owner_id
|
||||
3: required ShopID shop_id
|
||||
4: required base.Timestamp created_at
|
||||
6: required InvoiceStatus status
|
||||
7: required base.Timestamp due
|
||||
8: required string product
|
||||
9: optional string description
|
||||
10: required Cash cost
|
||||
11: optional InvoiceContext context
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
struct InvoicePayment {
|
||||
1: required InvoicePaymentID id
|
||||
2: required base.Timestamp created_at
|
||||
3: required InvoicePaymentStatus status
|
||||
4: optional TransactionInfo trx
|
||||
5: required Payer payer
|
||||
8: required Cash cost
|
||||
6: optional InvoicePaymentContext context
|
||||
9: optional RiskScore risk_score
|
||||
}
|
||||
|
||||
struct InvoicePaymentPending {}
|
||||
struct InvoicePaymentProcessed {}
|
||||
struct InvoicePaymentCaptured {}
|
||||
struct InvoicePaymentCancelled {}
|
||||
struct InvoicePaymentFailed { 1: required OperationError err }
|
||||
|
||||
/**
|
||||
* Статус платежа.
|
||||
* Согласно https://github.com/rbkmoney/coredocs/blob/589799f/docs/domain/entities/payment.md
|
||||
*/
|
||||
union InvoicePaymentStatus {
|
||||
1: InvoicePaymentPending pending
|
||||
4: InvoicePaymentProcessed processed
|
||||
2: InvoicePaymentCaptured captured
|
||||
5: InvoicePaymentCancelled cancelled
|
||||
3: InvoicePaymentFailed failed
|
||||
}
|
||||
|
||||
struct Payer {
|
||||
1: required PaymentTool payment_tool
|
||||
2: required PaymentSession session
|
||||
3: required ClientInfo client_info
|
||||
4: required ContactInfo contact_info
|
||||
}
|
||||
|
||||
struct ClientInfo {
|
||||
1: optional IPAddress ip_address
|
||||
2: optional Fingerprint fingerprint
|
||||
}
|
||||
|
||||
struct InvoicePaymentRoute {
|
||||
1: required ProviderRef provider
|
||||
2: required TerminalRef terminal
|
||||
}
|
||||
|
||||
struct InvoicePaymentCashFlow {
|
||||
/** Полностью вычисленный граф финансовых потоков с проводками всех участников. */
|
||||
1: required CashFlow final_cash_flow
|
||||
/** Отображение счетов в графе на номера счетов в системе учёта счетов. */
|
||||
2: required map<CashFlowAccount, AccountID> account_map
|
||||
}
|
||||
|
||||
/* Blocking and suspension */
|
||||
|
||||
union Blocking {
|
||||
1: Unblocked unblocked
|
||||
2: Blocked blocked
|
||||
}
|
||||
|
||||
struct Unblocked {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
struct Blocked {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
union Suspension {
|
||||
1: Active active
|
||||
2: Suspended suspended
|
||||
}
|
||||
|
||||
struct Active {}
|
||||
struct Suspended {}
|
||||
|
||||
/* Parties */
|
||||
|
||||
typedef base.ID PartyID
|
||||
|
||||
/** Участник. */
|
||||
struct Party {
|
||||
1: required PartyID id
|
||||
2: required Blocking blocking
|
||||
3: required Suspension suspension
|
||||
4: required map<ContractID, Contract> contracts = []
|
||||
5: required map<ShopID, Shop> shops = []
|
||||
6: required map<PayoutAccountID, PayoutAccount> payout_accounts = []
|
||||
}
|
||||
|
||||
/* Shops */
|
||||
|
||||
typedef i32 ShopID
|
||||
|
||||
/** Магазин мерчанта. */
|
||||
struct Shop {
|
||||
1: required ShopID id
|
||||
2: required Blocking blocking
|
||||
3: required Suspension suspension
|
||||
4: required ShopDetails details
|
||||
5: required CategoryRef category
|
||||
6: optional ShopAccountSet accounts
|
||||
7: required ContractID contract_id
|
||||
8: required PayoutAccountID payout_account_id
|
||||
}
|
||||
|
||||
struct ShopAccountSet {
|
||||
1: required CurrencyRef currency
|
||||
2: required AccountID general
|
||||
3: required AccountID guarantee
|
||||
}
|
||||
|
||||
struct ShopDetails {
|
||||
1: required string name
|
||||
2: optional string description
|
||||
3: optional ShopLocation location
|
||||
}
|
||||
|
||||
union ShopLocation {
|
||||
1: string url
|
||||
}
|
||||
|
||||
/* Инспекция платежа */
|
||||
|
||||
enum RiskScore {
|
||||
low = 1
|
||||
high = 100
|
||||
}
|
||||
|
||||
/* Contracts */
|
||||
|
||||
struct ContractorRef { 1: required ObjectID id }
|
||||
|
||||
/** Лицо, выступающее стороной договора. */
|
||||
struct Contractor {
|
||||
1: required Entity entity
|
||||
2: required BankAccount bank_account
|
||||
}
|
||||
|
||||
union Entity {
|
||||
1: RussianLegalEntity russian_legal_entity
|
||||
}
|
||||
|
||||
/** Юридическое лицо-резидент РФ */
|
||||
struct RussianLegalEntity {
|
||||
1: required string registered_name
|
||||
2: required string registered_number
|
||||
3: required string inn
|
||||
4: required string actual_address
|
||||
5: required string post_address
|
||||
6: required string representative_position
|
||||
7: required string representative_full_name
|
||||
8: required string representative_document
|
||||
}
|
||||
|
||||
/** Банковский счёт. */
|
||||
|
||||
struct BankAccount {
|
||||
1: required string account
|
||||
2: required string bank_name
|
||||
3: required string bank_post_account
|
||||
4: required string bank_bik
|
||||
}
|
||||
|
||||
typedef i32 PayoutAccountID
|
||||
|
||||
struct PayoutAccount {
|
||||
1: required PayoutAccountID id
|
||||
2: required CurrencyRef currency
|
||||
3: required PayoutMethod method
|
||||
}
|
||||
|
||||
union PayoutMethod {
|
||||
1: BankAccount bank_account
|
||||
}
|
||||
|
||||
typedef i32 ContractID
|
||||
|
||||
/** Договор */
|
||||
struct Contract {
|
||||
1: required ContractID id
|
||||
3: optional Contractor contractor
|
||||
4: optional base.Timestamp concluded_at
|
||||
5: optional base.Timestamp terminated_at
|
||||
6: required ContractTemplateRef template
|
||||
7: required list<ContractAdjustment> adjustments = []
|
||||
}
|
||||
|
||||
|
||||
/* Categories */
|
||||
|
||||
struct CategoryRef { 1: required ObjectID id }
|
||||
|
||||
enum CategoryType {
|
||||
test
|
||||
live
|
||||
}
|
||||
|
||||
/** Категория продаваемых товаров или услуг. */
|
||||
struct Category {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: optional CategoryType type = CategoryType.test
|
||||
}
|
||||
|
||||
struct ContractTemplateRef { 1: required ObjectID id }
|
||||
|
||||
/** Шаблон договора или поправки **/
|
||||
struct ContractTemplate {
|
||||
1: optional ContractTemplateRef parent_template
|
||||
2: optional Lifetime valid_since
|
||||
3: optional Lifetime valid_until
|
||||
4: required Terms terms
|
||||
}
|
||||
|
||||
union Lifetime {
|
||||
1: base.Timestamp timestamp
|
||||
2: LifetimePeriod period
|
||||
}
|
||||
|
||||
struct LifetimePeriod {
|
||||
1: optional i16 years
|
||||
2: optional i16 months
|
||||
3: optional i16 days
|
||||
}
|
||||
|
||||
/** Поправки к договору **/
|
||||
struct ContractAdjustment {
|
||||
1: required i32 id
|
||||
2: optional base.Timestamp concluded_at
|
||||
3: required ContractTemplateRef template
|
||||
}
|
||||
|
||||
|
||||
/** Условия **/
|
||||
// Service
|
||||
// Payments
|
||||
// Regular
|
||||
// Held
|
||||
// Recurring
|
||||
// ...
|
||||
// Payouts
|
||||
// ...
|
||||
|
||||
struct Terms {
|
||||
1: optional PaymentsServiceTerms payments
|
||||
}
|
||||
|
||||
/* Service terms */
|
||||
|
||||
struct PaymentsServiceTerms {
|
||||
/* Shop level */
|
||||
1: optional CurrencySelector currencies
|
||||
2: optional CategorySelector categories
|
||||
/* Invoice level*/
|
||||
4: optional PaymentMethodSelector payment_methods
|
||||
5: optional AmountLimitSelector amount_limit
|
||||
/* Payment level */
|
||||
6: optional CashFlowSelector fees
|
||||
/* Undefined level */
|
||||
3: optional GuaranteeFundTerms guarantee_fund
|
||||
}
|
||||
|
||||
struct GuaranteeFundTerms {
|
||||
1: optional AmountLimitSelector limits
|
||||
2: optional CashFlowSelector fees
|
||||
}
|
||||
|
||||
/* Currencies */
|
||||
|
||||
/** Символьный код, уникально идентифицирующий валюту. */
|
||||
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
|
||||
}
|
||||
|
||||
union CurrencySelector {
|
||||
1: set<CurrencyPredicate> predicates
|
||||
2: set<CurrencyRef> value
|
||||
}
|
||||
|
||||
struct CurrencyPredicate {
|
||||
1: required Predicate if_
|
||||
2: required CurrencySelector then_
|
||||
}
|
||||
|
||||
/* Категории */
|
||||
|
||||
union CategorySelector {
|
||||
1: set<CategoryPredicate> predicates
|
||||
2: set<CategoryRef> value
|
||||
}
|
||||
|
||||
struct CategoryPredicate {
|
||||
1: required Predicate if_
|
||||
2: required CategorySelector then_
|
||||
}
|
||||
|
||||
/* Limits */
|
||||
|
||||
struct AmountLimit {
|
||||
1: required AmountBound min
|
||||
2: required AmountBound max
|
||||
}
|
||||
|
||||
union AmountBound {
|
||||
1: Amount inclusive
|
||||
2: Amount exclusive
|
||||
}
|
||||
|
||||
union AmountLimitSelector {
|
||||
1: set<AmountLimitPredicate> predicates
|
||||
2: AmountLimit value
|
||||
}
|
||||
|
||||
struct AmountLimitPredicate {
|
||||
1: required Predicate if_
|
||||
2: required AmountLimitSelector then_
|
||||
}
|
||||
|
||||
/* Payment methods */
|
||||
|
||||
union PaymentMethod {
|
||||
1: BankCardPaymentSystem bank_card
|
||||
}
|
||||
|
||||
enum BankCardPaymentSystem {
|
||||
visa
|
||||
mastercard
|
||||
visaelectron
|
||||
maestro
|
||||
forbrugsforeningen
|
||||
dankort
|
||||
amex
|
||||
dinersclub
|
||||
discover
|
||||
unionpay
|
||||
jcb
|
||||
nspkmir
|
||||
}
|
||||
|
||||
union PaymentTool {
|
||||
1: BankCard bank_card
|
||||
}
|
||||
|
||||
typedef string Token
|
||||
|
||||
struct BankCard {
|
||||
1: required Token token
|
||||
2: required BankCardPaymentSystem payment_system
|
||||
3: required string bin
|
||||
4: required string masked_pan
|
||||
}
|
||||
|
||||
struct BankCardBINRangeRef { 1: required ObjectID id }
|
||||
|
||||
struct BankCardBINRange {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: required set<string> bins
|
||||
}
|
||||
|
||||
struct PaymentMethodRef { 1: required PaymentMethod id }
|
||||
|
||||
/** Способ платежа, категория платёжного средства. */
|
||||
struct PaymentMethodDefinition {
|
||||
1: required string name
|
||||
2: required string description
|
||||
}
|
||||
|
||||
union PaymentMethodSelector {
|
||||
1: set<PaymentMethodPredicate> predicates
|
||||
2: set<PaymentMethodRef> value
|
||||
}
|
||||
|
||||
struct PaymentMethodPredicate {
|
||||
1: required Predicate if_
|
||||
2: required PaymentMethodSelector then_
|
||||
}
|
||||
|
||||
/* Flows */
|
||||
|
||||
// TODO
|
||||
|
||||
/* Cash flows */
|
||||
|
||||
enum CashFlowParty {
|
||||
merchant,
|
||||
provider,
|
||||
system
|
||||
}
|
||||
|
||||
// TODO
|
||||
//
|
||||
// union CashFlowAccount {
|
||||
// 1: MerchantAccount merchant_account
|
||||
// 2: ProviderAccount provider_account
|
||||
// 3: SystemAccount system_account
|
||||
// }
|
||||
// ...
|
||||
|
||||
enum CashFlowConstant {
|
||||
invoice_amount
|
||||
payment_amount
|
||||
// ...
|
||||
// TODO
|
||||
}
|
||||
|
||||
typedef map<CashFlowConstant, Amount> CashFlowContext
|
||||
|
||||
/** Граф финансовых потоков. */
|
||||
typedef list<CashFlowPosting> CashFlow
|
||||
|
||||
/** Счёт в графе финансовых потоков. */
|
||||
struct CashFlowAccount {
|
||||
1: required CashFlowParty party
|
||||
2: required string designation
|
||||
}
|
||||
|
||||
/** Денежный поток между двумя участниками. */
|
||||
struct CashFlowPosting {
|
||||
1: required CashFlowAccount source
|
||||
2: required CashFlowAccount destination
|
||||
3: required CashVolume volume
|
||||
4: optional string details = ""
|
||||
}
|
||||
|
||||
/** Объём финансовой проводки. */
|
||||
union CashVolume {
|
||||
1: CashVolumeFixed fixed
|
||||
2: CashVolumeShare share
|
||||
}
|
||||
|
||||
/** Объём в абсолютных денежных единицах. */
|
||||
struct CashVolumeFixed {
|
||||
1: required Amount amount
|
||||
}
|
||||
|
||||
/** Объём в относительных единицах. */
|
||||
struct CashVolumeShare {
|
||||
1: required base.Rational parts
|
||||
2: required CashFlowConstant of
|
||||
}
|
||||
|
||||
union CashFlowSelector {
|
||||
1: set<CashFlowPredicate> predicates
|
||||
2: CashFlow value
|
||||
}
|
||||
|
||||
struct CashFlowPredicate {
|
||||
1: required Predicate if_
|
||||
2: required CashFlowSelector then_
|
||||
}
|
||||
|
||||
/* Providers */
|
||||
|
||||
struct ProviderRef { 1: required ObjectID id }
|
||||
|
||||
struct Provider {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: required Proxy proxy
|
||||
4: required TerminalSelector terminal
|
||||
}
|
||||
|
||||
union ProviderSelector {
|
||||
1: set<ProviderPredicate> predicates
|
||||
2: set<ProviderRef> value
|
||||
}
|
||||
|
||||
struct ProviderPredicate {
|
||||
1: required Predicate if_
|
||||
2: required ProviderSelector then_
|
||||
}
|
||||
|
||||
struct TerminalRef { 1: required ObjectID id }
|
||||
|
||||
/** Inspectors */
|
||||
|
||||
struct InspectorRef { 1: required ObjectID id }
|
||||
|
||||
struct Inspector {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: required Proxy proxy
|
||||
}
|
||||
|
||||
/**
|
||||
* Обобщённый терминал у провайдера.
|
||||
*
|
||||
* Представляет собой единицу предоставления услуг по процессингу платежей со
|
||||
* стороны провайдера, согласно нашим с ним договорённостям.
|
||||
*/
|
||||
struct Terminal {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: required PaymentMethodRef payment_method
|
||||
4: required CategoryRef category
|
||||
6: required CashFlow cash_flow
|
||||
7: required TerminalAccountSet accounts
|
||||
// TODO
|
||||
// 8: optional TerminalDescriptor descriptor
|
||||
9: optional ProxyOptions options = {}
|
||||
10: required RiskScore risk_coverage
|
||||
}
|
||||
|
||||
struct TerminalAccountSet {
|
||||
3: required CurrencyRef currency
|
||||
1: required AccountID receipt
|
||||
2: required AccountID compensation
|
||||
}
|
||||
|
||||
union TerminalSelector {
|
||||
1: set<TerminalPredicate> predicates
|
||||
2: set<TerminalRef> value
|
||||
}
|
||||
|
||||
struct TerminalPredicate {
|
||||
1: required Predicate if_
|
||||
2: required TerminalSelector then_
|
||||
}
|
||||
|
||||
/* Predicates / conditions */
|
||||
|
||||
union Predicate {
|
||||
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
|
||||
3: PaymentMethodRef payment_method_is
|
||||
4: PaymentToolCondition payment_tool
|
||||
}
|
||||
|
||||
union PaymentToolCondition {
|
||||
1: BankCardBINRangeRef bank_card_bin_in
|
||||
}
|
||||
|
||||
/* Proxies */
|
||||
|
||||
typedef base.StringMap ProxyOptions
|
||||
|
||||
struct ProxyRef { 1: required ObjectID id }
|
||||
|
||||
struct ProxyDefinition {
|
||||
// TODO
|
||||
// 1: required string name
|
||||
// 2: required string description
|
||||
1: required string url
|
||||
2: optional ProxyOptions options = {}
|
||||
}
|
||||
|
||||
struct Proxy {
|
||||
1: required ProxyRef ref
|
||||
2: required ProxyOptions additional
|
||||
}
|
||||
|
||||
/* System accounts */
|
||||
|
||||
struct SystemAccountSetRef { 1: required ObjectID id }
|
||||
|
||||
struct SystemAccountSet {
|
||||
1: required string name
|
||||
2: required string description
|
||||
3: required CurrencyRef currency
|
||||
4: required AccountID compensation
|
||||
}
|
||||
|
||||
union SystemAccountSetSelector {
|
||||
1: set<SystemAccountSetPredicate> predicates
|
||||
2: set<SystemAccountSetRef> value
|
||||
}
|
||||
|
||||
struct SystemAccountSetPredicate {
|
||||
1: required Predicate if_
|
||||
2: required SystemAccountSetSelector then_
|
||||
}
|
||||
|
||||
/* Merchant prototype */
|
||||
|
||||
struct PartyPrototypeRef { 1: required ObjectID id }
|
||||
|
||||
/** Прототип мерчанта по умолчанию. */
|
||||
struct PartyPrototype {
|
||||
1: required ShopPrototype shop
|
||||
2: required ContractTemplateRef test_contract_template
|
||||
}
|
||||
|
||||
struct ShopPrototype {
|
||||
1: required CategoryRef category
|
||||
3: required ShopDetails details
|
||||
2: required CurrencyRef currency
|
||||
}
|
||||
|
||||
/* Root config */
|
||||
|
||||
struct GlobalsRef {}
|
||||
|
||||
struct Globals {
|
||||
1: required PartyPrototypeRef party_prototype
|
||||
2: required ProviderSelector providers
|
||||
3: required SystemAccountSetSelector system_accounts
|
||||
4: required InspectorRef inspector
|
||||
5: required ContractTemplateRef default_contract_template
|
||||
}
|
||||
|
||||
/** 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
|
||||
}
|
||||
|
||||
|
||||
/* Type enumerations */
|
||||
struct ContractTemplateObject {
|
||||
1: required ContractTemplateRef ref
|
||||
2: required ContractTemplate data
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
struct InspectorObject {
|
||||
1: required InspectorRef ref
|
||||
2: required Inspector data
|
||||
}
|
||||
|
||||
struct SystemAccountSetObject {
|
||||
1: required SystemAccountSetRef ref
|
||||
2: required SystemAccountSet data
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
union Reference {
|
||||
|
||||
1 : CategoryRef category
|
||||
2 : CurrencyRef currency
|
||||
3 : PaymentMethodRef payment_method
|
||||
4 : ContractorRef contractor
|
||||
5 : BankCardBINRangeRef bank_card_bin_range
|
||||
6 : ContractTemplateRef template
|
||||
7 : ProviderRef provider
|
||||
8 : TerminalRef terminal
|
||||
15: InspectorRef inspector
|
||||
14: SystemAccountSetRef system_account_set
|
||||
9 : ProxyRef proxy
|
||||
10: PartyPrototypeRef party_prototype
|
||||
11: GlobalsRef globals
|
||||
|
||||
12: DummyRef dummy
|
||||
13: DummyLinkRef dummy_link
|
||||
|
||||
}
|
||||
|
||||
union DomainObject {
|
||||
|
||||
1 : CategoryObject category
|
||||
2 : CurrencyObject currency
|
||||
3 : PaymentMethodObject payment_method
|
||||
4 : ContractorObject contractor
|
||||
5 : BankCardBINRangeObject bank_card_bin_range
|
||||
6 : ContractTemplateObject template
|
||||
7 : ProviderObject provider
|
||||
8 : TerminalObject terminal
|
||||
15: InspectorObject inspector
|
||||
14: SystemAccountSetObject system_account_set
|
||||
9 : ProxyObject proxy
|
||||
10: PartyPrototypeObject party_prototype
|
||||
11: GlobalsObject globals
|
||||
|
||||
12: DummyObject dummy
|
||||
13: DummyLinkObject dummy_link
|
||||
|
||||
}
|
||||
|
||||
/* Domain */
|
||||
|
||||
typedef map<Reference, DomainObject> Domain
|
@ -1,648 +0,0 @@
|
||||
/**
|
||||
* Определения и сервисы процессинга.
|
||||
*/
|
||||
|
||||
include "base.thrift"
|
||||
include "domain.thrift"
|
||||
include "user_interaction.thrift"
|
||||
|
||||
namespace java com.rbkmoney.damsel_v133.payment_processing
|
||||
namespace erlang payproc
|
||||
|
||||
/* Interface clients */
|
||||
|
||||
typedef base.ID UserID
|
||||
|
||||
struct UserInfo {
|
||||
1: required UserID id
|
||||
}
|
||||
|
||||
/* Invoices */
|
||||
|
||||
struct InvoiceState {
|
||||
1: required domain.Invoice invoice
|
||||
2: required list<domain.InvoicePayment> payments = []
|
||||
}
|
||||
|
||||
/* Events */
|
||||
|
||||
/**
|
||||
* Событие, атомарный фрагмент истории бизнес-объекта, например инвойса.
|
||||
*/
|
||||
struct Event {
|
||||
|
||||
/**
|
||||
* Идентификатор события.
|
||||
* Монотонно возрастающее целочисленное значение, таким образом на множестве
|
||||
* событий задаётся отношение полного порядка (total order).
|
||||
*/
|
||||
1: required base.EventID id
|
||||
|
||||
/**
|
||||
* Время создания события.
|
||||
*/
|
||||
2: required base.Timestamp created_at
|
||||
|
||||
/**
|
||||
* Идентификатор бизнес-объекта, источника события.
|
||||
*/
|
||||
3: required EventSource source
|
||||
|
||||
/**
|
||||
* Номер события в последовательности событий от указанного источника.
|
||||
*
|
||||
* Номер первого события от источника всегда равен `1`, то есть `sequence`
|
||||
* принимает значения из диапазона `[1; 2^31)`
|
||||
*/
|
||||
4: required i32 sequence
|
||||
|
||||
/**
|
||||
* Содержание события.
|
||||
*/
|
||||
5: required EventPayload payload
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Источник события, идентификатор бизнес-объекта, который породил его в
|
||||
* процессе выполнения определённого бизнес-процесса.
|
||||
*/
|
||||
union EventSource {
|
||||
/** Идентификатор инвойса, который породил событие. */
|
||||
1: domain.InvoiceID invoice
|
||||
/** Идентификатор участника, который породил событие. */
|
||||
2: domain.PartyID party
|
||||
}
|
||||
|
||||
typedef list<Event> Events
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов содержания события.
|
||||
*/
|
||||
union EventPayload {
|
||||
/** Некоторое событие, порождённое инвойсом. */
|
||||
1: InvoiceEvent invoice_event
|
||||
/** Некоторое событие, порождённое участником. */
|
||||
2: PartyEvent party_event
|
||||
}
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов события, порождённого инвойсом.
|
||||
*/
|
||||
union InvoiceEvent {
|
||||
1: InvoiceCreated invoice_created
|
||||
2: InvoiceStatusChanged invoice_status_changed
|
||||
3: InvoicePaymentEvent invoice_payment_event
|
||||
}
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов события, порождённого платежом по инвойсу.
|
||||
*/
|
||||
union InvoicePaymentEvent {
|
||||
1: InvoicePaymentStarted invoice_payment_started
|
||||
2: InvoicePaymentBound invoice_payment_bound
|
||||
3: InvoicePaymentStatusChanged invoice_payment_status_changed
|
||||
4: InvoicePaymentInteractionRequested invoice_payment_interaction_requested
|
||||
5: InvoicePaymentInspected invoice_payment_inspected
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о создании нового инвойса.
|
||||
*/
|
||||
struct InvoiceCreated {
|
||||
/** Данные созданного инвойса. */
|
||||
1: required domain.Invoice invoice
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об изменении статуса инвойса.
|
||||
*/
|
||||
struct InvoiceStatusChanged {
|
||||
/** Новый статус инвойса. */
|
||||
1: required domain.InvoiceStatus status
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об запуске платежа по инвойсу.
|
||||
*/
|
||||
struct InvoicePaymentStarted {
|
||||
/** Данные запущенного платежа. */
|
||||
1: required domain.InvoicePayment payment
|
||||
/** Выбранный маршрут обработки платежа. */
|
||||
2: optional domain.InvoicePaymentRoute route
|
||||
/** Данные финансового взаимодействия. */
|
||||
// 3: optional domain.InvoicePaymentCashFlow cash_flow
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о том, что появилась связь между платежом по инвойсу и транзакцией
|
||||
* у провайдера.
|
||||
*/
|
||||
struct InvoicePaymentBound {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Данные о связанной транзакции у провайдера. */
|
||||
2: required domain.TransactionInfo trx
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об изменении статуса платежа по инвойсу.
|
||||
*/
|
||||
struct InvoicePaymentStatusChanged {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Статус платежа по инвойсу. */
|
||||
2: required domain.InvoicePaymentStatus status
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об запросе взаимодействия с плательщиком.
|
||||
*/
|
||||
struct InvoicePaymentInteractionRequested {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Необходимое взаимодействие */
|
||||
2: required user_interaction.UserInteraction interaction
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о прохождении инспекции
|
||||
*/
|
||||
struct InvoicePaymentInspected {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Результат инспекции */
|
||||
2: required domain.RiskScore risk_score
|
||||
}
|
||||
|
||||
/**
|
||||
* Диапазон для выборки событий.
|
||||
*/
|
||||
struct EventRange {
|
||||
|
||||
/**
|
||||
* Идентификатор события, за которым должны следовать попадающие в выборку
|
||||
* события.
|
||||
*
|
||||
* Если `after` не указано, в выборку попадут события с начала истории; если
|
||||
* указано, например, `42`, то в выборку попадут события, случившиеся _после_
|
||||
* события `42`.
|
||||
*/
|
||||
1: optional base.EventID after
|
||||
|
||||
/**
|
||||
* Максимальное количество событий в выборке.
|
||||
*
|
||||
* В выборку может попасть количество событий, _не больше_ указанного в
|
||||
* `limit`. Если в выборку попало событий _меньше_, чем значение `limit`,
|
||||
* был достигнут конец текущей истории.
|
||||
*
|
||||
* _Допустимые значения_: неотрицательные числа
|
||||
*/
|
||||
2: required i32 limit
|
||||
|
||||
}
|
||||
|
||||
/* Invoicing service definitions */
|
||||
|
||||
struct InvoiceParams {
|
||||
1: required PartyID party_id
|
||||
2: required ShopID shop_id
|
||||
3: required string product
|
||||
4: optional string description
|
||||
5: required base.Timestamp due
|
||||
6: required domain.Amount amount
|
||||
7: required domain.CurrencyRef currency
|
||||
8: required domain.InvoiceContext context
|
||||
}
|
||||
|
||||
struct InvoicePaymentParams {
|
||||
1: required domain.Payer payer
|
||||
}
|
||||
|
||||
// Exceptions
|
||||
|
||||
// forward-declared
|
||||
exception PartyNotFound {}
|
||||
exception ShopNotFound {}
|
||||
|
||||
exception InvalidUser {}
|
||||
exception UserInvoiceNotFound {}
|
||||
exception InvoicePaymentNotFound {}
|
||||
exception EventNotFound {}
|
||||
|
||||
exception InvoicePaymentPending {
|
||||
1: required domain.InvoicePaymentID id
|
||||
}
|
||||
|
||||
exception InvalidInvoiceStatus {
|
||||
1: required domain.InvoiceStatus status
|
||||
}
|
||||
|
||||
service Invoicing {
|
||||
|
||||
domain.InvoiceID Create (1: UserInfo user, 2: InvoiceParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: base.InvalidRequest ex2,
|
||||
3: PartyNotFound ex3,
|
||||
4: ShopNotFound ex4
|
||||
)
|
||||
|
||||
InvoiceState Get (1: UserInfo user, 2: domain.InvoiceID id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2
|
||||
)
|
||||
|
||||
Events GetEvents (1: UserInfo user, 2: domain.InvoiceID id, 3: EventRange range)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: EventNotFound ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.InvoicePaymentID StartPayment (
|
||||
1: UserInfo user,
|
||||
2: domain.InvoiceID id,
|
||||
3: InvoicePaymentParams params
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3,
|
||||
4: InvoicePaymentPending ex4,
|
||||
5: base.InvalidRequest ex5
|
||||
)
|
||||
|
||||
domain.InvoicePayment GetPayment (
|
||||
1: UserInfo user,
|
||||
2: domain.InvoiceID id,
|
||||
3: domain.InvoicePaymentID payment_id
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvoicePaymentNotFound ex3
|
||||
)
|
||||
|
||||
void Fulfill (1: UserInfo user, 2: domain.InvoiceID id, 3: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3
|
||||
)
|
||||
|
||||
void Rescind (1: UserInfo user, 2: domain.InvoiceID id, 3: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3,
|
||||
4: InvoicePaymentPending ex4
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
/* Party management service definitions */
|
||||
|
||||
// Types
|
||||
|
||||
typedef domain.PartyID PartyID
|
||||
typedef domain.ShopID ShopID
|
||||
|
||||
struct PayoutAccountParams {
|
||||
1: required domain.CurrencyRef currency
|
||||
2: required domain.PayoutMethod method
|
||||
}
|
||||
|
||||
struct ShopParams {
|
||||
1: required domain.CategoryRef category
|
||||
2: required domain.ShopDetails details
|
||||
3: required domain.ContractID contract_id
|
||||
4: required domain.PayoutAccountID payout_account_id
|
||||
}
|
||||
|
||||
struct ContractParams {
|
||||
1: required domain.Contractor contractor
|
||||
2: optional domain.ContractTemplateRef template
|
||||
}
|
||||
|
||||
struct ContractAdjustmentParams {
|
||||
1: required domain.ContractTemplateRef template
|
||||
}
|
||||
|
||||
union PartyModification {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
3: domain.Contract contract_creation
|
||||
4: ContractModificationUnit contract_modification
|
||||
5: domain.Shop shop_creation
|
||||
6: ShopModificationUnit shop_modification
|
||||
7: domain.PayoutAccount payout_account_creation
|
||||
}
|
||||
|
||||
struct ContractModificationUnit {
|
||||
1: required domain.ContractID id
|
||||
2: required ContractModification modification
|
||||
}
|
||||
|
||||
union ContractModification {
|
||||
1: ContractTermination termination
|
||||
2: domain.ContractAdjustment adjustment_creation
|
||||
}
|
||||
|
||||
struct ContractTermination {
|
||||
1: required base.Timestamp terminated_at
|
||||
2: optional string reason
|
||||
}
|
||||
|
||||
typedef list<PartyModification> PartyChangeset
|
||||
|
||||
struct ShopModificationUnit {
|
||||
1: required ShopID id
|
||||
2: required ShopModification modification
|
||||
}
|
||||
|
||||
union ShopModification {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
3: ShopUpdate update
|
||||
4: ShopAccountSetCreated accounts_created
|
||||
}
|
||||
|
||||
struct ShopUpdate {
|
||||
1: optional domain.CategoryRef category
|
||||
2: optional domain.ShopDetails details
|
||||
3: optional domain.ContractID contract_id
|
||||
4: optional domain.PayoutAccountID payout_account_id
|
||||
}
|
||||
|
||||
typedef base.ID ClaimID
|
||||
|
||||
struct Claim {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
3: required PartyChangeset changeset
|
||||
}
|
||||
|
||||
union ClaimStatus {
|
||||
1: ClaimPending pending
|
||||
2: ClaimAccepted accepted
|
||||
3: ClaimDenied denied
|
||||
4: ClaimRevoked revoked
|
||||
}
|
||||
|
||||
struct ClaimPending {}
|
||||
|
||||
struct ClaimAccepted {
|
||||
1: required base.Timestamp accepted_at
|
||||
}
|
||||
|
||||
struct ClaimDenied {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
struct ClaimRevoked {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
struct ClaimResult {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
}
|
||||
|
||||
struct ShopAccountState {
|
||||
1: required domain.AccountID account_id
|
||||
2: required domain.Amount own_amount
|
||||
3: required domain.Amount available_amount
|
||||
4: required domain.Currency currency
|
||||
}
|
||||
|
||||
// Events
|
||||
|
||||
union PartyEvent {
|
||||
1: domain.Party party_created
|
||||
2: Claim claim_created
|
||||
3: ClaimStatusChanged claim_status_changed
|
||||
}
|
||||
|
||||
struct ClaimStatusChanged {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
}
|
||||
|
||||
struct ShopAccountSetCreated {
|
||||
1: required domain.ShopAccountSet accounts
|
||||
}
|
||||
|
||||
// Exceptions
|
||||
|
||||
exception PartyExists {}
|
||||
exception ClaimNotFound {}
|
||||
exception ContractNotFound{}
|
||||
|
||||
exception InvalidClaimStatus {
|
||||
1: required ClaimStatus status
|
||||
}
|
||||
|
||||
union InvalidStatus {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
}
|
||||
|
||||
exception InvalidPartyStatus {
|
||||
1: required InvalidStatus status
|
||||
}
|
||||
|
||||
exception InvalidShopStatus {
|
||||
1: required InvalidStatus status
|
||||
}
|
||||
|
||||
exception AccountNotFound {}
|
||||
|
||||
exception AccountSetNotFound {}
|
||||
|
||||
// Service
|
||||
|
||||
service PartyManagement {
|
||||
|
||||
void Create (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyExists ex2)
|
||||
|
||||
domain.Party Get (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2)
|
||||
|
||||
ClaimResult CreateContract (1: UserInfo user, 2: PartyID party_id, 3: ContractParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.Contract GetContract (1: UserInfo user, 2: PartyID party_id, 3: domain.ContractID contract_id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3
|
||||
)
|
||||
|
||||
ClaimResult TerminateContract (1: UserInfo user, 2: PartyID party_id, 3: domain.ContractID contract_id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
ClaimResult CreateContractAdjustment (
|
||||
1: UserInfo user,
|
||||
2: PartyID party_id,
|
||||
3: domain.ContractID contract_id,
|
||||
4: ContractAdjustmentParams params
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3,
|
||||
4: InvalidPartyStatus ex4,
|
||||
5: base.InvalidRequest ex5
|
||||
)
|
||||
|
||||
ClaimResult CreatePayoutAccount (1: UserInfo user, 2: PartyID party_id, 3: PayoutAccountParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
ClaimResult CreateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.Shop GetShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3)
|
||||
|
||||
ClaimResult UpdateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: ShopUpdate update)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ShopNotFound ex3,
|
||||
4: InvalidPartyStatus ex4,
|
||||
5: InvalidShopStatus ex5,
|
||||
6: base.InvalidRequest ex6
|
||||
)
|
||||
|
||||
/* Claims */
|
||||
|
||||
Claim GetClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ClaimNotFound ex3)
|
||||
|
||||
Claim GetPendingClaim (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ClaimNotFound ex3)
|
||||
|
||||
void AcceptClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ClaimNotFound ex3,
|
||||
4: InvalidClaimStatus ex4
|
||||
)
|
||||
|
||||
void DenyClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ClaimNotFound ex3,
|
||||
4: InvalidClaimStatus ex4
|
||||
)
|
||||
|
||||
void RevokeClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: ClaimNotFound ex4,
|
||||
5: InvalidClaimStatus ex5
|
||||
)
|
||||
|
||||
/* Party blocking / suspension */
|
||||
|
||||
ClaimResult Suspend (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Activate (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Block (1: UserInfo user, 2: PartyID party_id, 3: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Unblock (1: UserInfo user, 2: PartyID party_id, 3: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
/* Shop blocking / suspension */
|
||||
|
||||
ClaimResult SuspendShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult ActivateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult BlockShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult UnblockShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
/* Event polling */
|
||||
|
||||
Events GetEvents (1: UserInfo user, 2: domain.PartyID party_id, 3: EventRange range)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: EventNotFound ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
/* Accounts */
|
||||
|
||||
ShopAccountState GetShopAccountState (1: UserInfo user, 2: PartyID party_id, 3: domain.AccountID account_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: AccountNotFound ex3)
|
||||
|
||||
domain.ShopAccountSet GetShopAccountSet (1: UserInfo user, 2: PartyID party_id, 3: ShopID shop_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: AccountSetNotFound ex4)
|
||||
}
|
||||
|
||||
/* Event sink service definitions */
|
||||
|
||||
/** Исключение, сигнализирующее о том, что последнего события не существует. */
|
||||
exception NoLastEvent {}
|
||||
|
||||
service EventSink {
|
||||
|
||||
/**
|
||||
* Получить последовательный набор событий из истории системы, от более
|
||||
* ранних к более поздним, из диапазона, заданного `range`. Результат
|
||||
* выполнения запроса может содержать от `0` до `range.limit` событий.
|
||||
*
|
||||
* Если в `range.after` указан идентификатор неизвестного события, то есть
|
||||
* события, не наблюдаемого клиентом ранее в известной ему истории,
|
||||
* бросится исключение `EventNotFound`.
|
||||
*/
|
||||
Events GetEvents (1: EventRange range)
|
||||
throws (1: EventNotFound ex1, 2: base.InvalidRequest ex2)
|
||||
|
||||
/**
|
||||
* Получить идентификатор наиболее позднего известного на момент исполнения
|
||||
* запроса события.
|
||||
*/
|
||||
base.EventID GetLastEventID ()
|
||||
throws (1: NoLastEvent ex1)
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
include "base.thrift"
|
||||
|
||||
namespace java com.rbkmoney.damsel_v133.user_interaction
|
||||
|
||||
/**
|
||||
* Строковый шаблон согласно [RFC6570](https://tools.ietf.org/html/rfc6570) Level 4.
|
||||
*/
|
||||
typedef string Template
|
||||
|
||||
/**
|
||||
* Форма, представленная набором полей и их значений в виде строковых шаблонов.
|
||||
*/
|
||||
typedef map<string, Template> Form
|
||||
|
||||
/**
|
||||
* Запрос HTTP, пригодный для отправки средствами браузера.
|
||||
*/
|
||||
union BrowserHTTPRequest {
|
||||
1: BrowserGetRequest get_request
|
||||
2: BrowserPostRequest post_request
|
||||
}
|
||||
|
||||
struct BrowserGetRequest {
|
||||
/** Шаблон URI запроса, набор переменных указан ниже. */
|
||||
1: required Template uri
|
||||
}
|
||||
|
||||
struct BrowserPostRequest {
|
||||
/** Шаблон URI запроса, набор переменных указан ниже. */
|
||||
1: required Template uri
|
||||
2: required Form form
|
||||
}
|
||||
|
||||
union UserInteraction {
|
||||
/**
|
||||
* Требование переадресовать user agent пользователя, в виде HTTP-запроса.
|
||||
*
|
||||
* В шаблонах в структуре HTTP-запроса могут встретиться следующие переменные:
|
||||
* - `termination_uri`
|
||||
* URI, на который следует переадресовать user agent пользователя по завершении
|
||||
* взаимодействия.
|
||||
*/
|
||||
1: BrowserHTTPRequest redirect
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Базовые, наиболее общие определения
|
||||
*/
|
||||
|
||||
namespace java com.rbkmoney.damsel_v136.base
|
||||
|
||||
/** Идентификатор */
|
||||
typedef string ID
|
||||
|
||||
/** Пространство имён */
|
||||
typedef string Namespace
|
||||
|
||||
/** Идентификатор некоторого события */
|
||||
typedef i64 EventID
|
||||
|
||||
/** Непрозрачный для участника общения набор данных */
|
||||
typedef binary Opaque
|
||||
|
||||
/** Набор данных, подлежащий интерпретации согласно типу содержимого. */
|
||||
struct Content {
|
||||
/** Тип содержимого, согласно [RFC2046](https://www.ietf.org/rfc/rfc2046) */
|
||||
1: required string type
|
||||
2: required binary data
|
||||
}
|
||||
|
||||
/**
|
||||
* Отметка во времени согласно RFC 3339.
|
||||
*
|
||||
* Строка должна содержать дату и время в UTC в следующем формате:
|
||||
* `2016-03-22T06:12:27Z`.
|
||||
*/
|
||||
typedef string Timestamp
|
||||
|
||||
/**
|
||||
* Временной интервал
|
||||
* не заданное значение границы считается бесконечностью
|
||||
*/
|
||||
struct TimestampInterval {
|
||||
1: optional TimestampIntervalBound lower_bound
|
||||
2: optional TimestampIntervalBound upper_bound
|
||||
}
|
||||
|
||||
struct TimestampIntervalBound {
|
||||
1: required BoundType bound_type
|
||||
2: required Timestamp bound_time
|
||||
}
|
||||
|
||||
enum BoundType {
|
||||
inclusive
|
||||
exclusive
|
||||
}
|
||||
|
||||
/** Отображение из строки в строку */
|
||||
typedef map<string, string> StringMap
|
||||
|
||||
/** Рациональное число. */
|
||||
struct Rational {
|
||||
1: required i64 p
|
||||
2: required i64 q
|
||||
}
|
||||
|
||||
/** Отрезок времени в секундах */
|
||||
typedef i32 Timeout
|
||||
|
||||
/** Значение ассоциации */
|
||||
typedef string Tag
|
||||
|
||||
/** Критерий остановки таймера */
|
||||
union Timer {
|
||||
/** Отрезок времени, после истечения которого таймер остановится */
|
||||
1: Timeout timeout
|
||||
/** Отметка во времени, при пересечении которой таймер остановится */
|
||||
2: Timestamp deadline
|
||||
}
|
||||
|
||||
/**
|
||||
* Исключение, сигнализирующее о непригодных с точки зрения бизнес-логики входных данных
|
||||
*/
|
||||
exception InvalidRequest {
|
||||
/** Список пригодных для восприятия человеком ошибок во входных данных */
|
||||
1: required list<string> errors
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,704 +0,0 @@
|
||||
/**
|
||||
* Определения и сервисы процессинга.
|
||||
*/
|
||||
|
||||
include "base.thrift"
|
||||
include "domain.thrift"
|
||||
include "user_interaction.thrift"
|
||||
|
||||
namespace java com.rbkmoney.damsel_v136.payment_processing
|
||||
namespace erlang payproc
|
||||
|
||||
/* Interface clients */
|
||||
|
||||
typedef base.ID UserID
|
||||
|
||||
struct UserInfo {
|
||||
1: required UserID id
|
||||
2: required UserType type
|
||||
}
|
||||
|
||||
/* Временная замена ролям пользователей для разграничения доступа в HG */
|
||||
union UserType {
|
||||
1: InternalUser internal_user
|
||||
2: ExternalUser external_user
|
||||
3: ServiceUser service_user
|
||||
}
|
||||
|
||||
struct InternalUser {}
|
||||
|
||||
struct ExternalUser {}
|
||||
|
||||
struct ServiceUser {}
|
||||
|
||||
/* Invoices */
|
||||
|
||||
struct InvoiceState {
|
||||
1: required domain.Invoice invoice
|
||||
2: required list<domain.InvoicePayment> payments = []
|
||||
}
|
||||
|
||||
/* Events */
|
||||
|
||||
/**
|
||||
* Событие, атомарный фрагмент истории бизнес-объекта, например инвойса.
|
||||
*/
|
||||
struct Event {
|
||||
|
||||
/**
|
||||
* Идентификатор события.
|
||||
* Монотонно возрастающее целочисленное значение, таким образом на множестве
|
||||
* событий задаётся отношение полного порядка (total order).
|
||||
*/
|
||||
1: required base.EventID id
|
||||
|
||||
/**
|
||||
* Время создания события.
|
||||
*/
|
||||
2: required base.Timestamp created_at
|
||||
|
||||
/**
|
||||
* Идентификатор бизнес-объекта, источника события.
|
||||
*/
|
||||
3: required EventSource source
|
||||
|
||||
/**
|
||||
* Номер события в последовательности событий от указанного источника.
|
||||
*
|
||||
* Номер первого события от источника всегда равен `1`, то есть `sequence`
|
||||
* принимает значения из диапазона `[1; 2^31)`
|
||||
*/
|
||||
4: required i32 sequence
|
||||
|
||||
/**
|
||||
* Содержание события.
|
||||
*/
|
||||
5: required EventPayload payload
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Источник события, идентификатор бизнес-объекта, который породил его в
|
||||
* процессе выполнения определённого бизнес-процесса.
|
||||
*/
|
||||
union EventSource {
|
||||
/** Идентификатор инвойса, который породил событие. */
|
||||
1: domain.InvoiceID invoice
|
||||
/** Идентификатор участника, который породил событие. */
|
||||
2: domain.PartyID party
|
||||
}
|
||||
|
||||
typedef list<Event> Events
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов содержания события.
|
||||
*/
|
||||
union EventPayload {
|
||||
/** Некоторое событие, порождённое инвойсом. */
|
||||
1: InvoiceEvent invoice_event
|
||||
/** Некоторое событие, порождённое участником. */
|
||||
2: PartyEvent party_event
|
||||
}
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов события, порождённого инвойсом.
|
||||
*/
|
||||
union InvoiceEvent {
|
||||
1: InvoiceCreated invoice_created
|
||||
2: InvoiceStatusChanged invoice_status_changed
|
||||
3: InvoicePaymentEvent invoice_payment_event
|
||||
}
|
||||
|
||||
/**
|
||||
* Один из возможных вариантов события, порождённого платежом по инвойсу.
|
||||
*/
|
||||
union InvoicePaymentEvent {
|
||||
1: InvoicePaymentStarted invoice_payment_started
|
||||
2: InvoicePaymentBound invoice_payment_bound
|
||||
3: InvoicePaymentStatusChanged invoice_payment_status_changed
|
||||
4: InvoicePaymentInteractionRequested invoice_payment_interaction_requested
|
||||
5: InvoicePaymentInspected invoice_payment_inspected
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о создании нового инвойса.
|
||||
*/
|
||||
struct InvoiceCreated {
|
||||
/** Данные созданного инвойса. */
|
||||
1: required domain.Invoice invoice
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об изменении статуса инвойса.
|
||||
*/
|
||||
struct InvoiceStatusChanged {
|
||||
/** Новый статус инвойса. */
|
||||
1: required domain.InvoiceStatus status
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об запуске платежа по инвойсу.
|
||||
*/
|
||||
struct InvoicePaymentStarted {
|
||||
/** Данные запущенного платежа. */
|
||||
1: required domain.InvoicePayment payment
|
||||
/** Выбранный маршрут обработки платежа. */
|
||||
2: optional domain.InvoicePaymentRoute route
|
||||
/** Данные финансового взаимодействия. */
|
||||
// 3: optional domain.FinalCashFlow cash_flow
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о том, что появилась связь между платежом по инвойсу и транзакцией
|
||||
* у провайдера.
|
||||
*/
|
||||
struct InvoicePaymentBound {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Данные о связанной транзакции у провайдера. */
|
||||
2: required domain.TransactionInfo trx
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об изменении статуса платежа по инвойсу.
|
||||
*/
|
||||
struct InvoicePaymentStatusChanged {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Статус платежа по инвойсу. */
|
||||
2: required domain.InvoicePaymentStatus status
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие об запросе взаимодействия с плательщиком.
|
||||
*/
|
||||
struct InvoicePaymentInteractionRequested {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Необходимое взаимодействие */
|
||||
2: required user_interaction.UserInteraction interaction
|
||||
}
|
||||
|
||||
/**
|
||||
* Событие о прохождении инспекции
|
||||
*/
|
||||
struct InvoicePaymentInspected {
|
||||
/** Идентификатор платежа по инвойсу. */
|
||||
1: required domain.InvoicePaymentID payment_id
|
||||
/** Результат инспекции */
|
||||
2: required domain.RiskScore risk_score
|
||||
}
|
||||
|
||||
/**
|
||||
* Диапазон для выборки событий.
|
||||
*/
|
||||
struct EventRange {
|
||||
|
||||
/**
|
||||
* Идентификатор события, за которым должны следовать попадающие в выборку
|
||||
* события.
|
||||
*
|
||||
* Если `after` не указано, в выборку попадут события с начала истории; если
|
||||
* указано, например, `42`, то в выборку попадут события, случившиеся _после_
|
||||
* события `42`.
|
||||
*/
|
||||
1: optional base.EventID after
|
||||
|
||||
/**
|
||||
* Максимальное количество событий в выборке.
|
||||
*
|
||||
* В выборку может попасть количество событий, _не больше_ указанного в
|
||||
* `limit`. Если в выборку попало событий _меньше_, чем значение `limit`,
|
||||
* был достигнут конец текущей истории.
|
||||
*
|
||||
* _Допустимые значения_: неотрицательные числа
|
||||
*/
|
||||
2: required i32 limit
|
||||
|
||||
}
|
||||
|
||||
/* Invoicing service definitions */
|
||||
|
||||
struct InvoiceParams {
|
||||
1: required PartyID party_id
|
||||
2: required ShopID shop_id
|
||||
3: required domain.InvoiceDetails details
|
||||
4: required base.Timestamp due
|
||||
5: required domain.Cash cost
|
||||
6: required domain.InvoiceContext context
|
||||
}
|
||||
|
||||
struct InvoicePaymentParams {
|
||||
1: required domain.Payer payer
|
||||
}
|
||||
|
||||
// Exceptions
|
||||
|
||||
// forward-declared
|
||||
exception PartyNotFound {}
|
||||
exception ShopNotFound {}
|
||||
|
||||
exception InvalidUser {}
|
||||
exception UserInvoiceNotFound {}
|
||||
exception InvoicePaymentNotFound {}
|
||||
exception EventNotFound {}
|
||||
|
||||
exception InvoicePaymentPending {
|
||||
1: required domain.InvoicePaymentID id
|
||||
}
|
||||
|
||||
exception InvalidInvoiceStatus {
|
||||
1: required domain.InvoiceStatus status
|
||||
}
|
||||
|
||||
service Invoicing {
|
||||
|
||||
domain.InvoiceID Create (1: UserInfo user, 2: InvoiceParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: base.InvalidRequest ex2,
|
||||
3: PartyNotFound ex3,
|
||||
4: ShopNotFound ex4
|
||||
)
|
||||
|
||||
InvoiceState Get (1: UserInfo user, 2: domain.InvoiceID id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2
|
||||
)
|
||||
|
||||
Events GetEvents (1: UserInfo user, 2: domain.InvoiceID id, 3: EventRange range)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: EventNotFound ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.InvoicePaymentID StartPayment (
|
||||
1: UserInfo user,
|
||||
2: domain.InvoiceID id,
|
||||
3: InvoicePaymentParams params
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3,
|
||||
4: InvoicePaymentPending ex4,
|
||||
5: base.InvalidRequest ex5
|
||||
)
|
||||
|
||||
domain.InvoicePayment GetPayment (
|
||||
1: UserInfo user,
|
||||
2: domain.InvoiceID id,
|
||||
3: domain.InvoicePaymentID payment_id
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvoicePaymentNotFound ex3
|
||||
)
|
||||
|
||||
void Fulfill (1: UserInfo user, 2: domain.InvoiceID id, 3: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3
|
||||
)
|
||||
|
||||
void Rescind (1: UserInfo user, 2: domain.InvoiceID id, 3: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: UserInvoiceNotFound ex2,
|
||||
3: InvalidInvoiceStatus ex3,
|
||||
4: InvoicePaymentPending ex4
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
/* Party management service definitions */
|
||||
|
||||
// Types
|
||||
|
||||
typedef domain.PartyID PartyID
|
||||
typedef domain.ShopID ShopID
|
||||
|
||||
struct PartyParams {
|
||||
1: required domain.PartyContactInfo contact_info
|
||||
}
|
||||
|
||||
struct PayoutToolParams {
|
||||
1: required domain.CurrencyRef currency
|
||||
2: required domain.PayoutToolInfo tool_info
|
||||
}
|
||||
|
||||
struct ShopParams {
|
||||
1: required domain.CategoryRef category
|
||||
2: required domain.ShopDetails details
|
||||
3: required domain.ContractID contract_id
|
||||
4: required domain.PayoutToolID payout_tool_id
|
||||
5: optional domain.Proxy proxy
|
||||
}
|
||||
|
||||
struct ContractParams {
|
||||
1: required domain.Contractor contractor
|
||||
2: optional domain.ContractTemplateRef template
|
||||
3: required PayoutToolParams payout_tool_params
|
||||
}
|
||||
|
||||
struct ContractAdjustmentParams {
|
||||
1: required domain.ContractTemplateRef template
|
||||
}
|
||||
|
||||
union PartyModification {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
3: domain.Contract contract_creation
|
||||
4: ContractModificationUnit contract_modification
|
||||
5: domain.Shop shop_creation
|
||||
6: ShopModificationUnit shop_modification
|
||||
}
|
||||
|
||||
struct ContractModificationUnit {
|
||||
1: required domain.ContractID id
|
||||
2: required ContractModification modification
|
||||
}
|
||||
|
||||
union ContractModification {
|
||||
1: ContractTermination termination
|
||||
2: domain.ContractAdjustment adjustment_creation
|
||||
3: domain.PayoutTool payout_tool_creation
|
||||
4: domain.LegalAgreement legal_agreement_binding
|
||||
}
|
||||
|
||||
struct ContractTermination {
|
||||
1: required base.Timestamp terminated_at
|
||||
2: optional string reason
|
||||
}
|
||||
|
||||
typedef list<PartyModification> PartyChangeset
|
||||
|
||||
struct ShopModificationUnit {
|
||||
1: required ShopID id
|
||||
2: required ShopModification modification
|
||||
}
|
||||
|
||||
union ShopModification {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
3: ShopUpdate update
|
||||
4: ShopAccountCreated account_created
|
||||
}
|
||||
|
||||
struct ShopUpdate {
|
||||
1: optional domain.CategoryRef category
|
||||
2: optional domain.ShopDetails details
|
||||
3: optional domain.ContractID contract_id
|
||||
4: optional domain.PayoutToolID payout_tool_id
|
||||
5: optional domain.Proxy proxy
|
||||
}
|
||||
|
||||
struct ShopAccountCreated {
|
||||
1: required domain.ShopAccount account
|
||||
}
|
||||
|
||||
// Claims
|
||||
|
||||
typedef i64 ClaimID
|
||||
|
||||
struct Claim {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
3: required PartyChangeset changeset
|
||||
}
|
||||
|
||||
union ClaimStatus {
|
||||
1: ClaimPending pending
|
||||
2: ClaimAccepted accepted
|
||||
3: ClaimDenied denied
|
||||
4: ClaimRevoked revoked
|
||||
}
|
||||
|
||||
struct ClaimPending {}
|
||||
|
||||
struct ClaimAccepted {
|
||||
1: required base.Timestamp accepted_at
|
||||
}
|
||||
|
||||
struct ClaimDenied {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
struct ClaimRevoked {
|
||||
1: required string reason
|
||||
}
|
||||
|
||||
struct ClaimResult {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
}
|
||||
|
||||
struct AccountState {
|
||||
1: required domain.AccountID account_id
|
||||
2: required domain.Amount own_amount
|
||||
3: required domain.Amount available_amount
|
||||
4: required domain.Currency currency
|
||||
}
|
||||
|
||||
// Events
|
||||
|
||||
union PartyEvent {
|
||||
1: domain.Party party_created
|
||||
2: Claim claim_created
|
||||
3: ClaimStatusChanged claim_status_changed
|
||||
}
|
||||
|
||||
struct ClaimStatusChanged {
|
||||
1: required ClaimID id
|
||||
2: required ClaimStatus status
|
||||
}
|
||||
|
||||
// Exceptions
|
||||
|
||||
exception PartyExists {}
|
||||
exception ClaimNotFound {}
|
||||
exception ContractNotFound {}
|
||||
exception InvalidContractStatus { 1: required domain.ContractStatus status }
|
||||
exception PayoutToolNotFound {}
|
||||
|
||||
|
||||
exception InvalidClaimStatus {
|
||||
1: required ClaimStatus status
|
||||
}
|
||||
|
||||
union InvalidStatus {
|
||||
1: domain.Blocking blocking
|
||||
2: domain.Suspension suspension
|
||||
}
|
||||
|
||||
exception InvalidPartyStatus {
|
||||
1: required InvalidStatus status
|
||||
}
|
||||
|
||||
exception InvalidShopStatus {
|
||||
1: required InvalidStatus status
|
||||
}
|
||||
|
||||
exception AccountNotFound {}
|
||||
|
||||
exception ShopAccountNotFound {}
|
||||
|
||||
// Service
|
||||
|
||||
service PartyManagement {
|
||||
|
||||
void Create (1: UserInfo user, 2: PartyID party_id, 3: PartyParams params)
|
||||
throws (1: InvalidUser ex1, 2: PartyExists ex2)
|
||||
|
||||
domain.Party Get (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2)
|
||||
|
||||
ClaimResult CreateContract (1: UserInfo user, 2: PartyID party_id, 3: ContractParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.Contract GetContract (1: UserInfo user, 2: PartyID party_id, 3: domain.ContractID contract_id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3
|
||||
)
|
||||
|
||||
ClaimResult TerminateContract (1: UserInfo user, 2: PartyID party_id, 3: domain.ContractID contract_id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3,
|
||||
4: InvalidContractStatus ex4,
|
||||
5: base.InvalidRequest ex5
|
||||
)
|
||||
|
||||
ClaimResult BindContractLegalAgreemnet (
|
||||
1: UserInfo user,
|
||||
2: PartyID party_id,
|
||||
3: domain.ContractID contract_id,
|
||||
4: domain.LegalAgreement legal_agreement
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3,
|
||||
4: InvalidContractStatus ex4,
|
||||
5: InvalidPartyStatus ex5,
|
||||
6: base.InvalidRequest ex6
|
||||
)
|
||||
|
||||
ClaimResult CreateContractAdjustment (
|
||||
1: UserInfo user,
|
||||
2: PartyID party_id,
|
||||
3: domain.ContractID contract_id,
|
||||
4: ContractAdjustmentParams params
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ContractNotFound ex3,
|
||||
4: InvalidContractStatus ex4,
|
||||
5: InvalidPartyStatus ex5,
|
||||
6: base.InvalidRequest ex6
|
||||
)
|
||||
|
||||
ClaimResult CreatePayoutTool (
|
||||
1: UserInfo user,
|
||||
2: PartyID party_id,
|
||||
3: domain.ContractID contract_id,
|
||||
4: PayoutToolParams params
|
||||
)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: ContractNotFound ex4,
|
||||
5: InvalidContractStatus ex5,
|
||||
6: base.InvalidRequest ex6
|
||||
)
|
||||
|
||||
ClaimResult CreateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopParams params)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
5: ContractNotFound ex5,
|
||||
6: InvalidContractStatus ex6,
|
||||
7: PayoutToolNotFound ex7,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
domain.Shop GetShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3)
|
||||
|
||||
ClaimResult UpdateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: ShopUpdate update)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ShopNotFound ex3,
|
||||
4: InvalidPartyStatus ex4,
|
||||
5: InvalidShopStatus ex5,
|
||||
7: ContractNotFound ex7,
|
||||
8: InvalidContractStatus ex8,
|
||||
9: PayoutToolNotFound ex9,
|
||||
6: base.InvalidRequest ex6
|
||||
)
|
||||
|
||||
/* Claims */
|
||||
|
||||
Claim GetClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ClaimNotFound ex3)
|
||||
|
||||
Claim GetPendingClaim (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ClaimNotFound ex3)
|
||||
|
||||
void AcceptClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ClaimNotFound ex3,
|
||||
4: InvalidClaimStatus ex4
|
||||
)
|
||||
|
||||
void DenyClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: ClaimNotFound ex3,
|
||||
4: InvalidClaimStatus ex4
|
||||
)
|
||||
|
||||
void RevokeClaim (1: UserInfo user, 2: PartyID party_id, 3: ClaimID id, 4: string reason)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: InvalidPartyStatus ex3,
|
||||
4: ClaimNotFound ex4,
|
||||
5: InvalidClaimStatus ex5
|
||||
)
|
||||
|
||||
/* Party blocking / suspension */
|
||||
|
||||
ClaimResult Suspend (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Activate (1: UserInfo user, 2: PartyID party_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Block (1: UserInfo user, 2: PartyID party_id, 3: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
ClaimResult Unblock (1: UserInfo user, 2: PartyID party_id, 3: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: InvalidPartyStatus ex3)
|
||||
|
||||
/* Shop blocking / suspension */
|
||||
|
||||
ClaimResult SuspendShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult ActivateShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult BlockShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
ClaimResult UnblockShop (1: UserInfo user, 2: PartyID party_id, 3: ShopID id, 4: string reason)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: InvalidShopStatus ex4)
|
||||
|
||||
/* Event polling */
|
||||
|
||||
Events GetEvents (1: UserInfo user, 2: domain.PartyID party_id, 3: EventRange range)
|
||||
throws (
|
||||
1: InvalidUser ex1,
|
||||
2: PartyNotFound ex2,
|
||||
3: EventNotFound ex3,
|
||||
4: base.InvalidRequest ex4
|
||||
)
|
||||
|
||||
/* Accounts */
|
||||
|
||||
domain.ShopAccount GetShopAccount (1: UserInfo user, 2: PartyID party_id, 3: ShopID shop_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: ShopNotFound ex3, 4: ShopAccountNotFound ex4)
|
||||
|
||||
AccountState GetAccountState (1: UserInfo user, 2: PartyID party_id, 3: domain.AccountID account_id)
|
||||
throws (1: InvalidUser ex1, 2: PartyNotFound ex2, 3: AccountNotFound ex3)
|
||||
|
||||
}
|
||||
|
||||
/* Event sink service definitions */
|
||||
|
||||
/** Исключение, сигнализирующее о том, что последнего события не существует. */
|
||||
exception NoLastEvent {}
|
||||
|
||||
service EventSink {
|
||||
|
||||
/**
|
||||
* Получить последовательный набор событий из истории системы, от более
|
||||
* ранних к более поздним, из диапазона, заданного `range`. Результат
|
||||
* выполнения запроса может содержать от `0` до `range.limit` событий.
|
||||
*
|
||||
* Если в `range.after` указан идентификатор неизвестного события, то есть
|
||||
* события, не наблюдаемого клиентом ранее в известной ему истории,
|
||||
* бросится исключение `EventNotFound`.
|
||||
*/
|
||||
Events GetEvents (1: EventRange range)
|
||||
throws (1: EventNotFound ex1, 2: base.InvalidRequest ex2)
|
||||
|
||||
/**
|
||||
* Получить идентификатор наиболее позднего известного на момент исполнения
|
||||
* запроса события.
|
||||
*/
|
||||
base.EventID GetLastEventID ()
|
||||
throws (1: NoLastEvent ex1)
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
namespace java com.rbkmoney.damsel_v136.user_interaction
|
||||
|
||||
/**
|
||||
* Строковый шаблон согласно [RFC6570](https://tools.ietf.org/html/rfc6570) Level 4.
|
||||
*/
|
||||
typedef string Template
|
||||
|
||||
/**
|
||||
* Форма, представленная набором полей и их значений в виде строковых шаблонов.
|
||||
*/
|
||||
typedef map<string, Template> Form
|
||||
|
||||
/**
|
||||
* Запрос HTTP, пригодный для отправки средствами браузера.
|
||||
*/
|
||||
union BrowserHTTPRequest {
|
||||
1: BrowserGetRequest get_request
|
||||
2: BrowserPostRequest post_request
|
||||
}
|
||||
|
||||
struct BrowserGetRequest {
|
||||
/** Шаблон URI запроса, набор переменных указан ниже. */
|
||||
1: required Template uri
|
||||
}
|
||||
|
||||
struct BrowserPostRequest {
|
||||
/** Шаблон URI запроса, набор переменных указан ниже. */
|
||||
1: required Template uri
|
||||
2: required Form form
|
||||
}
|
||||
|
||||
union UserInteraction {
|
||||
/**
|
||||
* Требование переадресовать user agent пользователя, в виде HTTP-запроса.
|
||||
*
|
||||
* В шаблонах в структуре HTTP-запроса могут встретиться следующие переменные:
|
||||
* - `termination_uri`
|
||||
* URI, на который следует переадресовать user agent пользователя по завершении
|
||||
* взаимодействия.
|
||||
*/
|
||||
1: BrowserHTTPRequest redirect
|
||||
}
|
Loading…
Reference in New Issue
Block a user