MSPF-534: Initial commit (#1)

This commit is contained in:
Alexey 2020-02-25 14:06:05 +03:00 committed by GitHub
parent 1c668c23aa
commit e2d8371eb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 926 additions and 1 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.DS_Store
.rebar3
_build
ebin
include
src/*.erl

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "build_utils"]
path = build_utils
url = git@github.com:rbkmoney/build_utils.git

33
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,33 @@
#!groovy
// -*- mode: groovy -*-
build('pathfinder_proto', 'docker-host') {
checkoutRepo()
loadBuildUtils()
def pipeDefault
def gitUtils
runStage('load pipeline') {
env.JENKINS_LIB = "build_utils/jenkins_lib"
pipeDefault = load("${env.JENKINS_LIB}/pipeDefault.groovy")
gitUtils = load("${env.JENKINS_LIB}/gitUtils.groovy")
}
pipeDefault() {
runStage('compile') {
sh "make wc_compile"
}
// Java
runStage('Execute build container') {
withCredentials([[$class: 'FileBinding', credentialsId: 'java-maven-settings.xml', variable: 'SETTINGS_XML']]) {
if (env.BRANCH_NAME == 'master' || env.BRANCH_NAME.startsWith('epic/')) {
sh 'make SETTINGS_XML=${SETTINGS_XML} BRANCH_NAME=${BRANCH_NAME} wc_java.deploy'
} else {
sh 'make SETTINGS_XML=${SETTINGS_XML} wc_java.compile'
}
}
}
}
}

176
LICENSE Normal file
View File

@ -0,0 +1,176 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS

80
Makefile Normal file
View File

@ -0,0 +1,80 @@
THRIFT = $(or $(shell which thrift), $(error "`thrift' executable missing"))
REBAR = $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := build_utils
TEMPLATES_PATH := .
# Name of the service
SERVICE_NAME := pathfinder_proto
# Build image tag to be used
BUILD_IMAGE_TAG := fcf116dd775cc2e91bffb6a36835754e3f2d5321
CALL_ANYWHERE := \
all submodules compile clean distclean \
java.compile java.deploy
CALL_W_CONTAINER := $(CALL_ANYWHERE)
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
.PHONY: $(CALL_W_CONTAINER)
# CALL_ANYWHERE
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
compile:
$(REBAR) compile
clean:
$(REBAR) clean
distclean:
$(REBAR) clean -a
rm -rfv _build
# Java
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
COMMIT_HASH := $(shell git --no-pager log -1 --pretty=format:"%h")
NUMBER_COMMITS := $(shell git rev-list --count HEAD)
JAVA_PKG_VERSION := 1.$(NUMBER_COMMITS)-$(COMMIT_HASH)
ifdef BRANCH_NAME
ifeq "$(findstring epic,$(BRANCH_NAME))" "epic"
JAVA_PKG_VERSION := $(JAVA_PKG_VERSION)-epic
endif
endif
MVN = mvn -s $(SETTINGS_XML) -Dpath_to_thrift="$(THRIFT)" -Dcommit.number="$(NUMBER_COMMITS)"
java.compile: java.settings
$(MVN) compile
java.deploy: java.settings
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) deploy
java.install: java.settings
$(MVN) clean && \
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
$(MVN) install
java.settings:
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)

View File

@ -1 +1,2 @@
# pathfinder_proto
# pathfinder-proto
thrift protocol for Pathfinder service

1
build_utils Submodule

@ -0,0 +1 @@
Subproject commit 8ad24ac7dc831a280cf8622086d73867d0a04b93

5
package-lock.json generated Normal file
View File

@ -0,0 +1,5 @@
{
"name": "pathfinder-proto",
"version": "1.0.0",
"lockfileVersion": 1
}

9
package.json Normal file
View File

@ -0,0 +1,9 @@
{
"name": "pathfinder-proto",
"version": "1.0.0",
"description": "Pathfinder service thrift protocol.",
"author": "rbk.money",
"private": true,
"license": "Apache 2.0",
"homepage": "https://github.com/rbkmoney/pathfinder_proto#readme"
}

82
pom.xml Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.rbkmoney</groupId>
<artifactId>parent</artifactId>
<version>1.0.0</version>
</parent>
<groupId>com.rbkmoney</groupId>
<artifactId>pathfinder-proto</artifactId>
<version>SNAPSHOT</version>
<packaging>jar</packaging>
<name>CDS</name>
<description>Generates jar artifact containing compiled thrift classes based on generated thrift IDL files</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.rbkmoney.woody</groupId>
<artifactId>woody-thrift</artifactId>
<version>LATEST</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<!-- THRIFT -->
<plugin>
<groupId>org.apache.thrift</groupId>
<artifactId>thrift-maven-plugin</artifactId>
<version>0.9.3-1</version>
<configuration>
<generator>java:fullcamel</generator>
<thriftSourceRoot>${project.basedir}/proto</thriftSourceRoot>
<thriftExecutable>${path_to_thrift}</thriftExecutable>
</configuration>
<executions>
<execution>
<id>thrift-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<relocations>
<relocation>
<pattern>com.rbkmoney.damsel</pattern>
<shadedPattern>com.rbkmoney.damsel.v${commit.number}</shadedPattern>
</relocation>
</relocations>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>v${commit.number}</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

451
proto/lookup.thrift Normal file
View File

@ -0,0 +1,451 @@
namespace java com.rbkmoney.pathfinder.lookup
namespace erlang pf
typedef string LookupID;
typedef list<LookupID> LookupIDs;
typedef i64 ID;
typedef string EntityID;
typedef string Timestamp;
typedef i64 DomainRevision;
typedef i64 PartyRevision;
typedef i64 Amount;
typedef string CurrencyCode;
enum AdjustmentStatus {
pending
captured
cancelled
processed
}
struct Adjustment {
1: required ID id
2: required Timestamp event_created_at
3: required DomainRevision domain_revision
4: required EntityID adjustment_id
5: required EntityID payment_id
6: required EntityID invoice_id
7: required EntityID party_id
8: required EntityID shop_id
9: required Timestamp created_at
10: required AdjustmentStatus status
11: optional Timestamp status_captured_at
12: optional Timestamp status_cancelled_at
13: required string reason
14: required Timestamp wtime
15: required bool current
16: optional Amount fee
17: optional Amount provider_fee
18: optional Amount external_fee
19: optional PartyRevision party_revision
20: optional ID sequence_id
21: optional ID change_id
}
enum DestinationStatus {
authorized
unauthorized
}
enum DestinationResourceType {
bank_card
crypto_wallet
}
struct Destination {
1: required ID id
2: required ID event_id
3: required Timestamp event_created_at
4: required Timestamp event_occured_at
5: required ID sequence_id
6: required EntityID destination_id
7: required string destination_name
8: required DestinationStatus destination_status
9: optional string resource_bank_card_token
10: optional string resource_bank_card_payment_system
11: optional string resource_bank_card_bin
12: optional string resource_bank_card_masked_pan
13: optional EntityID account_id
14: optional EntityID identity_id
15: optional EntityID party_id
16: optional ID accounter_account_id
17: optional CurrencyCode currency_code
18: required Timestamp wtime
19: required bool current
20: optional EntityID external_id
21: optional Timestamp created_at
22: optional string context_json
23: optional EntityID resource_crypto_wallet_id
24: optional string resource_crypto_wallet_type
25: required DestinationResourceType resource_type
26: optional string resource_crypto_wallet_data
27: optional string resource_bank_card_type
28: optional string resource_bank_card_issuer_country
29: optional string resource_bank_card_bank_name
}
enum InvoiceStatus {
unpaid
paid
cancelled
fulfilled
}
struct Invoice {
1: required ID id
2: required Timestamp event_created_at
3: required EntityID invoice_id
4: required EntityID party_id
5: required EntityID shop_id
6: optional PartyRevision party_revision
7: required Timestamp created_at
8: required InvoiceStatus status
9: optional string status_cancelled_details
10: optional string status_fulfilled_details
11: required string details_product
12: optional string details_description
13: required Timestamp due
14: required Amount amount
15: required CurrencyCode currency_code
16: optional string context
17: optional EntityID template_id
18: required Timestamp wtime
19: required bool current
20: optional ID sequence_id
21: optional ID change_id
22: optional EntityID external_id
}
enum PaymentStatus {
pending
processed
captured
cancelled
refunded
failed
}
enum PayerType {
payment_resource
customer
recurrent
}
enum PaymentToolType {
bank_card
payment_terminal
digital_wallet
crypto_currency
mobile_commerce
}
enum PaymentFlowType {
instant
hold
}
enum RiskScore {
low
high
fatal
}
struct Payment {
1: required ID id
2: required Timestamp event_created_at
3: required EntityID payment_id
4: required Timestamp created_at
5: required EntityID invoice_id
6: required EntityID party_id
7: required EntityID shop_id
8: required DomainRevision domain_revision
9: optional PartyRevision party_revision
10: required PaymentStatus status
11: optional string status_cancelled_reason
12: optional string status_captured_reason
13: optional string status_failed_failure
14: required Amount amount
15: required CurrencyCode currency_code
16: required PayerType payer_type
17: required PaymentToolType payer_payment_tool_type
18: optional string payer_bank_card_token
19: optional string payer_bank_card_payment_system
20: optional string payer_bank_card_bin
21: optional string payer_bank_card_masked_pan
22: optional string payer_bank_card_token_provider
23: optional string payer_payment_terminal_type
24: optional string payer_digital_wallet_provider
25: optional EntityID payer_digital_wallet_id
26: optional string payer_payment_session_id
27: optional string payer_ip_address
28: optional string payer_fingerprint
29: optional string payer_phone_number
30: optional string payer_email
31: optional EntityID payer_customer_id
32: optional EntityID payer_customer_binding_id
33: optional EntityID payer_customer_rec_payment_tool_id
34: optional binary context
35: required PaymentFlowType payment_flow_type
36: optional string payment_flow_on_hold_expiration
37: optional Timestamp payment_flow_held_until
38: optional RiskScore risk_score
39: optional ID route_provider_id
40: optional ID route_terminal_id
41: required Timestamp wtime
42: required bool current
43: optional string session_payload_transaction_bound_trx_id
44: optional string session_payload_transaction_bound_trx_extra_json
45: optional Amount fee
46: optional Amount provider_fee
47: optional Amount external_fee
48: optional Amount guarantee_deposit
49: optional bool make_recurrent
50: optional string payer_recurrent_parent_invoice_id
51: optional string payer_recurrent_parent_payment_id
52: optional string recurrent_intention_token
53: optional ID sequence_id
54: optional ID change_id
55: optional string trx_additional_info_rrn
56: optional string trx_additional_info_approval_code
57: optional string trx_additional_info_acs_url
58: optional string trx_additional_info_pareq
59: optional string trx_additional_info_md
60: optional string trx_additional_info_term_url
61: optional string trx_additional_info_pares
62: optional string trx_additional_info_eci
63: optional string trx_additional_info_cavv
64: optional string trx_additional_info_xid
65: optional string trx_additional_info_cavv_algorithm
66: optional string trx_additional_info_three_ds_verification
67: optional string payer_crypto_currency_type
68: optional string status_captured_started_reason
69: optional string payer_mobile_phone_cc
70: optional string payer_mobile_phone_ctn
71: optional string capture_started_params_cart_json
72: optional EntityID external_id
73: optional string payer_issuer_country
74: optional string payer_bank_name
}
enum PayoutStatus {
unpaid
paid
cancelled
confirmed
}
enum PayoutStatusDetails {
card_details
account_details
}
enum UserType {
internal_user
external_user
service_user
}
enum PayoutType {
bank_card
bank_account
wallet
}
enum PayoutAccountType {
russian_payout_account
international_payout_account
}
struct Payout {
1: required ID id
2: required ID event_id
3: required Timestamp event_created_at
4: required EntityID payout_id
5: required EntityID party_id
6: required EntityID shop_id
7: required EntityID contract_id
8: required Timestamp created_at
9: required PayoutStatus status
10: optional PayoutStatusDetails status_paid_details
11: optional string status_paid_details_card_provider_name
12: optional string status_paid_details_card_provider_transaction_id
13: optional string status_cancelled_user_info_id
14: optional UserType status_cancelled_user_info_type
15: optional string status_cancelled_details
16: optional string status_confirmed_user_info_id
17: optional UserType status_confirmed_user_info_type
18: required PayoutType type
19: optional string type_card_token
20: optional string type_card_payment_system
21: optional string type_card_bin
22: optional string type_card_masked_pan
23: optional string type_card_token_provider
24: optional PayoutAccountType type_account_type
25: optional string type_account_russian_account
26: optional string type_account_russian_bank_name
27: optional string type_account_russian_bank_post_account
28: optional string type_account_russian_bank_bik
29: optional string type_account_russian_inn
30: optional string type_account_international_account_holder
31: optional string type_account_international_bank_name
32: optional string type_account_international_bank_address
33: optional string type_account_international_iban
34: optional string type_account_international_bic
35: optional string type_account_international_local_bank_code
36: optional string type_account_international_legal_entity_legal_name
37: optional string type_account_international_legal_entity_trading_name
38: optional string type_account_international_legal_entity_registered_address
39: optional string type_account_international_legal_entity_actual_address
40: optional string type_account_international_legal_entity_registered_number
41: optional string type_account_purpose
42: optional Timestamp type_account_legal_agreement_signed_at
43: optional string type_account_legal_agreement_id
44: optional Timestamp type_account_legal_agreement_valid_until
45: required Timestamp wtime
46: required bool current
47: optional string type_account_international_bank_number
48: optional string type_account_international_bank_aba_rtn
49: optional string type_account_international_bank_country_code
50: optional string type_account_international_correspondent_bank_number
51: optional string type_account_international_correspondent_bank_account
52: optional string type_account_international_correspondent_bank_name
53: optional string type_account_international_correspondent_bank_address
54: optional string type_account_international_correspondent_bank_bic
55: optional string type_account_international_correspondent_bank_iban
56: optional string type_account_international_correspondent_bank_aba_rtn
57: optional string type_account_international_correspondent_bank_country_code
58: optional Amount amount
59: optional Amount fee
60: optional CurrencyCode currency_code
61: optional EntityID wallet_id
}
enum RefundStatus {
pending
succeeded
failed
}
struct Refund {
1: required ID id
2: required Timestamp event_created_at
3: required DomainRevision domain_revision
4: required EntityID refund_id
5: required EntityID payment_id
6: required EntityID invoice_id
7: required EntityID party_id
8: required EntityID shop_id
9: required Timestamp created_at
10: required RefundStatus status
11: optional string status_failed_failure
12: optional Amount amount
13: optional CurrencyCode currency_code
14: optional string reason
15: required Timestamp wtime
16: required bool current
17: optional string session_payload_transaction_bound_trx_id
18: optional string session_payload_transaction_bound_trx_extra_json
19: optional Amount fee
20: optional Amount provider_fee
21: optional Amount external_fee
22: optional PartyRevision party_revision
23: optional ID sequence_id
24: optional ID change_id
25: optional EntityID external_id
}
struct Wallet {
1: required ID id
2: required ID event_id
3: required Timestamp event_created_at
4: required Timestamp event_occured_at
5: required ID sequence_id
6: required EntityID wallet_id
7: required string wallet_name
8: optional EntityID identity_id
9: optional EntityID party_id
10: optional CurrencyCode currency_code
11: required Timestamp wtime
12: required bool current
13: optional EntityID account_id
14: optional i64 accounter_account_id
15: optional EntityID external_id
}
enum WithdrawalStatus {
pending
succeeded
failed
}
enum WithdrawalTransferStatus {
created
prepared
committed
cancelled
}
struct Withdrawal {
1: required ID id
2: required ID event_id
3: required Timestamp event_created_at
4: required Timestamp event_occured_at
5: required ID sequence_id
6: required EntityID wallet_id
7: required EntityID destination_id
8: required EntityID withdrawal_id
9: optional EntityID provider_id
10: required Amount amount
11: required CurrencyCode currency_code
12: required WithdrawalStatus withdrawal_status
13: optional WithdrawalTransferStatus withdrawal_transfer_status
14: required Timestamp wtime
15: required bool current
16: optional Amount fee
17: optional Amount provider_fee
18: optional EntityID external_id
19: optional string context_json
20: optional string withdrawal_status_failed_failure_json
}
enum LookupNamespace {
adjustments
destinations
invoices
payments
payouts
refunds
wallets
withdrawals
}
struct LookupRequest {
1: required list<LookupID> ids
2: optional list<LookupNamespace> namespaces
}
struct LookupResult {
1: required list<ResultData> data
}
union ResultData {
1: list<Adjustment> adjustments
2: list<Destination> destinations
3: list<Invoice> invoices
4: list<Payment> payments
5: list<Payout> payouts
6: list<Refund> refunds
7: list<Wallet> wallets
8: list<Withdrawal> withdrawals
}
exception InvalidArguments {
1: optional string reason
}
service Lookup {
LookupResult Lookup (1: LookupRequest request)
throws(1: InvalidArguments invalid_args)
}

68
rebar.config Normal file
View File

@ -0,0 +1,68 @@
%% Common project erlang options.
{erl_opts, [
% mandatory
debug_info,
warnings_as_errors,
warn_export_all,
warn_missing_spec,
warn_untyped_record,
warn_export_vars,
% by default
warn_unused_record,
warn_bif_clash,
warn_obsolete_guard,
warn_unused_vars,
warn_shadow_vars,
warn_unused_import,
warn_unused_function,
warn_deprecated_function,
% at will
% bin_opt_info
% no_auto_import,
warn_missing_spec_all
]}.
%% XRef checks
{xref_checks, [
undefined_function_calls,
undefined_functions,
deprecated_functions_calls,
deprecated_functions
]}.
%% Tests
{cover_enabled, true}.
%% Dialyzer static analyzing
{dialyzer, [
{warnings, [
% mandatory
unmatched_returns,
error_handling,
race_conditions,
unknown
]},
{plt_apps, all_deps}
]}.
{deps, []}.
{plugins, [
{rebar3_thrift_compiler,
{git, "https://github.com/rbkmoney/rebar3_thrift_compiler.git", {tag, "0.3.1"}}}
]}.
{provider_hooks, [
{pre, [
{compile, {thrift, compile}},
{clean , {thrift, clean }}
]}
]}.
{thrift_compiler_opts, [
{in_dir, "proto"},
{gen, "erlang:app_prefix=pathfinder_proto,scoped_typenames"}
]}.

1
rebar.lock Normal file
View File

@ -0,0 +1 @@
[].

View File

@ -0,0 +1,9 @@
{application, pathfinder_proto, [
{description, "Thrift proto for Pathfinder"},
{vsn, "0.1.0"},
{applications, [
kernel,
stdlib
]},
{maintainers, []}
]}.