2019-08-22 09:46:57 +00:00
|
|
|
namespace java com.rbkmoney.damsel.claim_management
|
|
|
|
namespace erlang claim_management
|
|
|
|
|
|
|
|
include "base.thrift"
|
|
|
|
include "domain.thrift"
|
|
|
|
include "msgpack.thrift"
|
|
|
|
|
|
|
|
typedef i64 ClaimID
|
|
|
|
typedef i64 ModificationID
|
|
|
|
typedef i32 ClaimRevision
|
|
|
|
typedef string ContinuationToken
|
2020-01-21 15:54:17 +00:00
|
|
|
typedef base.ID FileID
|
|
|
|
typedef base.ID DocumentID
|
|
|
|
typedef base.ID CommentID
|
|
|
|
typedef base.ID UserID
|
2020-03-26 11:15:07 +00:00
|
|
|
typedef base.ID CashRegisterID
|
2020-03-27 09:10:39 +00:00
|
|
|
typedef i32 CashRegisterProviderID
|
2020-01-21 15:54:17 +00:00
|
|
|
|
|
|
|
typedef string MetadataKey
|
|
|
|
typedef msgpack.Value MetadataValue
|
|
|
|
typedef map<MetadataKey, MetadataValue> Metadata
|
|
|
|
|
|
|
|
typedef list<ModificationUnit> ClaimChangeset
|
|
|
|
typedef list<Modification> ModificationChangeset
|
2019-08-22 09:46:57 +00:00
|
|
|
|
|
|
|
exception ClaimNotFound {}
|
|
|
|
exception PartyNotFound {}
|
|
|
|
exception InvalidClaimRevision {}
|
|
|
|
exception BadContinuationToken { 1: string reason }
|
2020-01-21 15:54:17 +00:00
|
|
|
exception LimitExceeded { 1: string reason }
|
|
|
|
exception ChangesetConflict { 1: required ClaimID conflicted_id }
|
2019-08-22 09:46:57 +00:00
|
|
|
exception InvalidChangeset {
|
|
|
|
1: required string reason
|
2020-01-21 15:54:17 +00:00
|
|
|
2: required ModificationChangeset invalid_changeset
|
2019-08-22 09:46:57 +00:00
|
|
|
}
|
|
|
|
exception InvalidClaimStatus {
|
|
|
|
1: required ClaimStatus status
|
|
|
|
}
|
|
|
|
exception MetadataKeyNotFound {}
|
|
|
|
|
2019-09-19 13:43:59 +00:00
|
|
|
struct UserInfo {
|
|
|
|
1: required UserID id
|
|
|
|
2: required string email
|
|
|
|
3: required string username
|
|
|
|
4: required UserType type
|
|
|
|
}
|
|
|
|
|
|
|
|
union UserType {
|
|
|
|
1: InternalUser internal_user
|
|
|
|
2: ExternalUser external_user
|
|
|
|
}
|
|
|
|
|
|
|
|
struct InternalUser {}
|
|
|
|
|
|
|
|
struct ExternalUser {}
|
|
|
|
|
2019-08-22 09:46:57 +00:00
|
|
|
struct ScheduleChanged {
|
|
|
|
1: optional domain.BusinessScheduleRef schedule
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PayoutToolInfoChanged {
|
|
|
|
1: required domain.PayoutToolID payout_tool_id
|
|
|
|
2: required domain.PayoutToolInfo info
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ShopContractChanged {
|
|
|
|
1: required domain.ContractID contract_id
|
|
|
|
2: required domain.PayoutToolID payout_tool_id
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PayoutToolParams {
|
|
|
|
1: required domain.CurrencyRef currency
|
|
|
|
2: required domain.PayoutToolInfo tool_info
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContractParams {
|
|
|
|
1: optional domain.ContractorID contractor_id
|
|
|
|
2: optional domain.ContractTemplateRef template
|
|
|
|
3: optional domain.PaymentInstitutionRef payment_institution
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ShopModificationUnit {
|
|
|
|
1: required domain.ShopID id
|
|
|
|
2: required ShopModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ShopContractModification {
|
|
|
|
1: required domain.ContractID contract_id
|
|
|
|
2: required domain.PayoutToolID payout_tool_id
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ScheduleModification {
|
|
|
|
1: optional domain.BusinessScheduleRef schedule
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ShopAccountParams {
|
|
|
|
1: required domain.CurrencyRef currency
|
|
|
|
}
|
|
|
|
|
|
|
|
union ShopModification {
|
|
|
|
1: ShopParams creation
|
|
|
|
2: domain.CategoryRef category_modification
|
|
|
|
3: domain.ShopDetails details_modification
|
|
|
|
4: ShopContractModification contract_modification
|
|
|
|
5: domain.PayoutToolID payout_tool_modification
|
|
|
|
6: domain.ShopLocation location_modification
|
|
|
|
7: ShopAccountParams shop_account_creation
|
|
|
|
8: ScheduleModification payout_schedule_modification
|
2020-03-26 11:15:07 +00:00
|
|
|
9: CashRegisterModificationUnit cash_register_modification_unit
|
2019-08-22 09:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ShopParams {
|
|
|
|
1: required domain.CategoryRef category
|
|
|
|
2: required domain.ShopLocation location
|
|
|
|
3: required domain.ShopDetails details
|
|
|
|
4: required domain.ContractID contract_id
|
|
|
|
5: required domain.PayoutToolID payout_tool_id
|
|
|
|
}
|
|
|
|
|
2020-03-26 11:15:07 +00:00
|
|
|
struct CashRegisterModificationUnit {
|
|
|
|
1: required CashRegisterID id
|
|
|
|
2: required CashRegisterModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union CashRegisterModification {
|
|
|
|
1: CashRegisterParams creation
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CashRegisterParams {
|
2020-03-27 09:10:39 +00:00
|
|
|
1: required CashRegisterProviderID cash_register_provider_id
|
|
|
|
2: required base.StringMap cash_register_provider_params
|
2020-03-26 11:15:07 +00:00
|
|
|
}
|
|
|
|
|
2019-08-22 09:46:57 +00:00
|
|
|
struct ContractorModificationUnit {
|
|
|
|
1: required domain.ContractorID id
|
|
|
|
2: required ContractorModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union ContractorModification {
|
|
|
|
1: domain.Contractor creation
|
|
|
|
2: domain.ContractorIdentificationLevel identification_level_modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContractModificationUnit {
|
|
|
|
1: required domain.ContractID id
|
|
|
|
2: required ContractModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union ContractModification {
|
|
|
|
1: ContractParams creation
|
|
|
|
2: ContractTermination termination
|
|
|
|
3: ContractAdjustmentModificationUnit adjustment_modification
|
|
|
|
4: PayoutToolModificationUnit payout_tool_modification
|
|
|
|
5: domain.LegalAgreement legal_agreement_binding
|
|
|
|
6: domain.ReportPreferences report_preferences_modification
|
|
|
|
7: domain.ContractorID contractor_modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContractTermination {
|
|
|
|
1: optional string reason
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContractAdjustmentModificationUnit {
|
|
|
|
1: required domain.ContractAdjustmentID adjustment_id
|
|
|
|
2: required ContractAdjustmentModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ContractAdjustmentParams {
|
|
|
|
1: required domain.ContractTemplateRef template
|
|
|
|
}
|
|
|
|
|
|
|
|
union ContractAdjustmentModification {
|
|
|
|
1: ContractAdjustmentParams creation
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PayoutToolModificationUnit {
|
|
|
|
1: required domain.PayoutToolID payout_tool_id
|
|
|
|
2: required PayoutToolModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union PayoutToolModification {
|
|
|
|
1: PayoutToolParams creation
|
|
|
|
2: domain.PayoutToolInfo info_modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union DocumentModification {
|
|
|
|
1: DocumentCreated creation
|
|
|
|
}
|
|
|
|
|
|
|
|
struct DocumentCreated {}
|
|
|
|
|
|
|
|
struct DocumentModificationUnit {
|
|
|
|
1: required DocumentID id
|
|
|
|
2: required DocumentModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union FileModification {
|
|
|
|
1: FileCreated creation
|
|
|
|
}
|
|
|
|
|
|
|
|
struct FileCreated {}
|
|
|
|
|
|
|
|
struct FileModificationUnit {
|
|
|
|
1: required FileID id
|
|
|
|
2: required FileModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union CommentModification {
|
|
|
|
1: CommentCreated creation
|
|
|
|
}
|
|
|
|
|
|
|
|
struct CommentCreated {}
|
|
|
|
|
|
|
|
struct CommentModificationUnit {
|
|
|
|
1: required CommentID id
|
|
|
|
2: required CommentModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StatusChanged {}
|
|
|
|
|
|
|
|
union StatusModification {
|
|
|
|
1: StatusChanged change
|
|
|
|
}
|
|
|
|
|
|
|
|
struct StatusModificationUnit {
|
|
|
|
1: required ClaimStatus status
|
|
|
|
2: required StatusModification modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union ClaimModification {
|
|
|
|
1: DocumentModificationUnit document_modification
|
|
|
|
2: FileModificationUnit file_modification
|
|
|
|
3: CommentModificationUnit comment_modification
|
|
|
|
4: StatusModificationUnit status_modification
|
|
|
|
}
|
|
|
|
|
|
|
|
union PartyModification {
|
|
|
|
1: ContractorModificationUnit contractor_modification
|
|
|
|
2: ContractModificationUnit contract_modification
|
|
|
|
3: ShopModificationUnit shop_modification
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ModificationUnit {
|
|
|
|
1: required ModificationID modification_id
|
|
|
|
2: required base.Timestamp created_at
|
|
|
|
3: required Modification modification
|
2019-09-19 13:43:59 +00:00
|
|
|
4: required UserInfo user_info
|
2019-08-22 09:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
union Modification {
|
|
|
|
1: PartyModification party_modification
|
2019-11-29 15:16:23 +00:00
|
|
|
2: ClaimModification claim_modification
|
2019-08-22 09:46:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Claim {
|
|
|
|
1: required ClaimID id
|
2019-12-04 16:36:27 +00:00
|
|
|
8: required domain.PartyID party_id
|
2019-08-22 09:46:57 +00:00
|
|
|
2: required ClaimStatus status
|
|
|
|
3: required ClaimChangeset changeset
|
|
|
|
4: required ClaimRevision revision
|
|
|
|
5: required base.Timestamp created_at
|
|
|
|
6: optional base.Timestamp updated_at
|
|
|
|
7: optional Metadata metadata
|
|
|
|
}
|
|
|
|
|
|
|
|
union ClaimStatus {
|
|
|
|
1: ClaimPending pending
|
|
|
|
2: ClaimReview review
|
|
|
|
3: ClaimPendingAcceptance pending_acceptance
|
|
|
|
4: ClaimAccepted accepted
|
|
|
|
5: ClaimDenied denied
|
|
|
|
6: ClaimRevoked revoked
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimPending {}
|
|
|
|
|
|
|
|
struct ClaimReview {}
|
|
|
|
|
|
|
|
struct ClaimPendingAcceptance {}
|
|
|
|
|
|
|
|
struct ClaimAccepted {}
|
|
|
|
|
|
|
|
struct ClaimDenied {
|
|
|
|
1: optional string reason
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimRevoked {
|
|
|
|
1: optional string reason
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimSearchQuery {
|
2019-11-29 15:16:23 +00:00
|
|
|
1: optional domain.PartyID party_id
|
2019-12-13 13:08:00 +00:00
|
|
|
5: optional ClaimID claim_id
|
2019-08-22 09:46:57 +00:00
|
|
|
2: optional list<ClaimStatus> statuses
|
2019-11-29 15:16:23 +00:00
|
|
|
3: optional ContinuationToken continuation_token
|
2019-08-22 09:46:57 +00:00
|
|
|
4: required i32 limit
|
|
|
|
}
|
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
struct ClaimSearchResponse {
|
|
|
|
1: required list<Claim> result
|
|
|
|
2: optional ContinuationToken continuation_token
|
|
|
|
}
|
|
|
|
|
2020-01-16 10:04:56 +00:00
|
|
|
struct Event {
|
|
|
|
1: required base.Timestamp occured_at
|
|
|
|
2: required Change change
|
2020-02-26 11:26:35 +00:00
|
|
|
3: optional UserInfo user_info
|
2020-01-16 10:04:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
union Change {
|
|
|
|
1: ClaimCreated created
|
|
|
|
2: ClaimUpdated updated
|
|
|
|
3: ClaimStatusChanged status_changed
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimCreated {
|
|
|
|
1: required domain.PartyID party_id
|
|
|
|
2: required ClaimID id
|
2020-01-21 15:54:17 +00:00
|
|
|
3: required ModificationChangeset changeset
|
2020-01-16 10:04:56 +00:00
|
|
|
4: required ClaimRevision revision
|
|
|
|
5: required base.Timestamp created_at
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimUpdated {
|
|
|
|
1: required domain.PartyID party_id
|
|
|
|
2: required ClaimID id
|
2020-01-21 15:54:17 +00:00
|
|
|
3: required ModificationChangeset changeset
|
2020-01-16 10:04:56 +00:00
|
|
|
4: required ClaimRevision revision
|
|
|
|
5: required base.Timestamp updated_at
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ClaimStatusChanged {
|
|
|
|
1: required domain.PartyID party_id
|
|
|
|
2: required ClaimID id
|
|
|
|
3: required ClaimStatus status
|
|
|
|
4: required ClaimRevision revision
|
|
|
|
5: required base.Timestamp updated_at
|
|
|
|
}
|
|
|
|
|
2019-08-22 09:46:57 +00:00
|
|
|
service ClaimManagement {
|
|
|
|
|
2020-01-21 15:54:17 +00:00
|
|
|
Claim CreateClaim (1: domain.PartyID party_id, 2: ModificationChangeset changeset)
|
|
|
|
throws (1: InvalidChangeset ex1)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
|
|
|
Claim GetClaim (1: domain.PartyID party_id, 2: ClaimID id)
|
2019-12-26 11:46:36 +00:00
|
|
|
throws (1: ClaimNotFound ex1)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
ClaimSearchResponse SearchClaims (1: ClaimSearchQuery claim_request)
|
2019-12-26 11:46:36 +00:00
|
|
|
throws (1: LimitExceeded ex1, 2: BadContinuationToken ex2)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
|
|
|
void AcceptClaim (1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision)
|
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
2020-01-21 15:54:17 +00:00
|
|
|
3: InvalidClaimRevision ex3
|
2019-08-22 09:46:57 +00:00
|
|
|
)
|
|
|
|
|
2020-01-21 15:54:17 +00:00
|
|
|
void UpdateClaim (1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision, 4: ModificationChangeset changeset)
|
2019-08-22 09:46:57 +00:00
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
|
|
|
3: InvalidClaimRevision ex3,
|
|
|
|
4: ChangesetConflict ex4,
|
|
|
|
5: InvalidChangeset ex5
|
2019-08-22 09:46:57 +00:00
|
|
|
)
|
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
void RequestClaimReview(1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision)
|
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
|
|
|
3: InvalidClaimRevision ex3
|
2019-11-29 15:16:23 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
void RequestClaimChanges(1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision)
|
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
|
|
|
3: InvalidClaimRevision ex3
|
2019-11-29 15:16:23 +00:00
|
|
|
)
|
|
|
|
|
2019-08-22 09:46:57 +00:00
|
|
|
void DenyClaim (1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision, 4: string reason)
|
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
|
|
|
3: InvalidClaimRevision ex3
|
2019-08-22 09:46:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
void RevokeClaim (1: domain.PartyID party_id, 2: ClaimID id, 3: ClaimRevision revision, 4: string reason)
|
|
|
|
throws (
|
2019-12-26 11:46:36 +00:00
|
|
|
1: ClaimNotFound ex1,
|
|
|
|
2: InvalidClaimStatus ex2,
|
|
|
|
3: InvalidClaimRevision ex3
|
2019-08-22 09:46:57 +00:00
|
|
|
)
|
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
MetadataValue GetMetadata (1: domain.PartyID party_id, 2: ClaimID id, 3: MetadataKey key)
|
2019-12-26 11:46:36 +00:00
|
|
|
throws (1: ClaimNotFound ex1, 2: MetadataKeyNotFound ex2)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
void SetMetadata (1: domain.PartyID party_id, 2: ClaimID id, 3: MetadataKey key, 4: MetadataValue value)
|
2019-12-26 11:46:36 +00:00
|
|
|
throws (1: ClaimNotFound ex1)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
2019-11-29 15:16:23 +00:00
|
|
|
void RemoveMetadata (1: domain.PartyID party_id, 2: ClaimID id, 3: MetadataKey key)
|
2020-01-21 15:54:17 +00:00
|
|
|
throws (1: ClaimNotFound ex1)
|
2019-08-22 09:46:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
service ClaimCommitter {
|
|
|
|
|
|
|
|
void Accept (1: domain.PartyID party_id, 2: Claim claim)
|
|
|
|
throws (
|
|
|
|
1: PartyNotFound ex1,
|
|
|
|
2: InvalidChangeset ex2
|
|
|
|
)
|
|
|
|
|
|
|
|
void Commit (1: domain.PartyID party_id, 2: Claim claim)
|
|
|
|
}
|