MST-106: Payouts (#188)

* MST-106: Payouts

* Add proto to erlang release

* MST-106: Fix field sequence

* MST-106: Rename payout type fields

* MST-106: Payout proto improvements (#201)

* MST-106: Add bank card data

* PayoutType -> PayoutTool (#204)

* Align fields nameing between merch_stat and domain (#214)

* SHT-89: get payout info for PAPI (#215)

* SHT-89: get payout info for PAPI
* SHT-89: removed pay2card interface
This commit is contained in:
Pavel Popov 2017-09-04 18:40:55 +03:00 committed by GitHub
parent 44afec3edc
commit 427459a2aa
4 changed files with 106 additions and 39 deletions

View File

@ -18,7 +18,8 @@ SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
BUILD_IMAGE_TAG := fbef66759ab9c7b620fc73785ba1840d2f48bd68
FILES = $(wildcard proto/*.thrift)
PROTODIR = proto
FILES = $(wildcard $(PROTODIR)/*.thrift)
DESTDIR = _gen
RELDIR = _release
@ -101,7 +102,7 @@ $(TARGETS):: $(DESTDIR)/$(LANGUAGE)/%: %
$(ERLC) -v -I$@ -o$@ $(shell find $@ -name "*.erl")
build-release:
@make THRIFT="$(THRIFT)" FILES="$(abspath $(FILES))" -C build/erlang release
@make THRIFT="$(THRIFT)" FILES="$(abspath $(FILES))" PROTO="$(abspath $(PROTODIR))" -C build/erlang release
endif
endif

View File

@ -35,6 +35,7 @@ ARTIFACTS := \
publish: $(DESTDIR) $(ARTIFACTS)
@cp -r $(ARTIFACTS) $(DESTDIR)
@cp -r $(PROTO) $(DESTDIR)/
$(DESTDIR):
@mkdir -p $@

View File

@ -87,6 +87,13 @@ struct BankCard {
4: required string masked_pan
}
struct BankAccount {
1: required string account
2: required string bank_name
3: required string bank_post_account
4: required string bank_bik
}
/**
* Информация об инвойсе.
*/
@ -125,6 +132,49 @@ struct StatCustomer {
2: required base.Timestamp created_at
}
typedef base.ID PayoutID
/**
* Информация о выплате
*/
struct StatPayout {
1 : required PayoutID id
2 : required domain.PartyID party_id
3 : required domain.ShopID shop_id
4 : required base.Timestamp created_at
5 : required PayoutStatus status
6 : required domain.Amount amount
7 : required domain.Amount fee
8 : required string currency_symbolic_code
9 : required PayoutType type
}
union PayoutType {
1: PayoutCard bank_card
2: PayoutAccount bank_account
}
struct PayoutCard {
1: required BankCard card
}
struct PayoutAccount {
1: required BankAccount account
4: required string inn
5: required string purpose
}
union PayoutStatus {
1: PayoutUnpaid unpaid
2: PayoutPaid paid
3: PayoutCancelled cancelled
4: PayoutConfirmed confirmed
}
struct PayoutUnpaid {}
struct PayoutPaid {}
struct PayoutCancelled { 1: required string details }
struct PayoutConfirmed {}
typedef map<string, string> StatInfo
typedef base.InvalidRequest InvalidRequest
@ -155,6 +205,7 @@ union StatResponseData {
2: list<StatInvoice> invoices
3: list<StatCustomer> customers
4: list<StatInfo> records
5: list<StatPayout> payouts
}
/**
@ -181,6 +232,11 @@ service MerchantStatistics {
*/
StatResponse GetCustomers(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
/**
* Возвращает набор данных о выплатах
*/
StatResponse GetPayouts(1: StatRequest req) throws (1: InvalidRequest ex1, 2: DatasetTooBig ex2)
/**
* Возвращает аггрегированные данные в виде набора записей, формат возвращаемых данных зависит от целевой функции, указанной в DSL.
*/

View File

@ -98,7 +98,7 @@ struct Payout {
4: required base.Timestamp created_at
5: required PayoutStatus status
6: required domain.FinalCashFlow payout_flow
7: required PayoutType payout_type
7: required PayoutType type
}
/**
@ -135,8 +135,7 @@ union PaidDetails {
}
struct CardPaidDetails {
1: required string mask_pan
2: required ProviderDetails provider_details
1: required ProviderDetails provider_details
}
struct ProviderDetails {
@ -166,30 +165,20 @@ struct PayoutConfirmed {
/* Типы выплаты */
union PayoutType {
1: CardPayout card_payout
2: AccountPayout account_payout
1: PayoutCard card
2: PayoutAccount account
}
/* Выплата на карту */
struct CardPayout {
/* Идентификатор запроса на выплату */
1: required string request_id
/* Токен карты для cds */
2: optional domain.Token card_token
struct PayoutCard {
1: required domain.BankCard card
}
/* Вывод на расчетный счет */
struct AccountPayout {
/* Расчетный счет */
1: required string account
/* Корреспондентский счет */
2: required string bank_corr_account
/* БИК */
3: required string bank_bik
/* ИНН организации */
4: required string inn
/* Назначение платежа */
5: required string purpose
struct PayoutAccount {
1: required domain.BankAccount account
2: required string inn
3: required string purpose
}
/**
@ -286,23 +275,38 @@ struct GeneratePayoutParams {
3: required domain.ShopID shop_id
}
/**
* Атрибуты поиска выплат
**/
struct PayoutSearchCriteria {
1: optional PayoutSearchStatus status
/* Диапазон времени создания выплат */
2: optional TimeRange time_range
3: optional list<PayoutID> payout_ids
}
enum PayoutSearchStatus {
unpaid,
paid,
cancelled,
confirmed
}
/**
* Info по выплате для отображения в админке
**/
struct PayoutInfo {
1: required PayoutID id
2: required domain.PartyID party_id
3: required domain.ShopID shop_id
4: required PayoutType type
5: required PayoutStatus status
6: required base.Timestamp from_time
7: required base.Timestamp to_time
8: required base.Timestamp created_at
}
service PayoutManagement {
/********************* Выплаты на карту *********************/
/**
* Получить сумму комиссии за вывод запрашиваемой суммы
*/
domain.Cash GetFee(1: Pay2CardParams params)
throws (1: base.InvalidRequest ex1)
/**
* Перевести сумму на карту
*/
PayoutID Pay2Card(1: required string request_id, 2: Pay2CardParams params)
throws (1: base.InvalidRequest ex1,
2: InsufficientFunds ex2,
3: LimitExceeded ex3)
/********************* Вывод на счет ************************/
/**
* Сгенерировать и отправить по почте выводы за указанный промежуток времени
@ -318,4 +322,9 @@ service PayoutManagement {
* Отменить движения по выплатам. Вернуть список отмененных выплат
*/
list<PayoutID> CancelPayouts (1: list<PayoutID> payout_ids) throws (1: base.InvalidRequest ex1)
/**
* Возвращает список Payout-ов согласно запросу поиска
**/
list<PayoutInfo> GetPayoutsInfo (1: PayoutSearchCriteria search_criteria) throws (1: base.InvalidRequest ex1)
}