From e8c5cc5556c959c45b566878b2284ce1283c3346 Mon Sep 17 00:00:00 2001 From: Pavel Popov Date: Tue, 23 May 2017 18:14:41 +0400 Subject: [PATCH] MST-87: own invoice and payment models (#146) * MST-87: Switch domain invoice and payment models to own model * MST-87: Copy and paste domain models * MST-87: PaymentSession -> PaymentSessionID * MST-87: More linear invoice, Context -> base.Content --- proto/cds.thrift | 4 +-- proto/domain.thrift | 4 +-- proto/merch_stat.thrift | 78 +++++++++++++++++++++++++++++++++++++---- 3 files changed, 76 insertions(+), 10 deletions(-) diff --git a/proto/cds.thrift b/proto/cds.thrift index 1df4e42..c609b5f 100644 --- a/proto/cds.thrift +++ b/proto/cds.thrift @@ -29,7 +29,7 @@ struct CardData { struct PutCardDataResult { 1: required domain.BankCard bank_card - 2: required domain.PaymentSession session + 2: required domain.PaymentSessionID session_id } struct Unlocked {} @@ -82,7 +82,7 @@ service Storage { throws (1: CardDataNotFound not_found, 2: KeyringLocked locked) /** Получить карточные данные c CVV */ - CardData GetSessionCardData (1: domain.Token token, 2: domain.PaymentSession session) + CardData GetSessionCardData (1: domain.Token token, 2: domain.PaymentSessionID session_id) throws (1: CardDataNotFound not_found, 2: KeyringLocked locked) /** Сохранить карточные данные */ diff --git a/proto/domain.thrift b/proto/domain.thrift index faa2273..fd814fb 100644 --- a/proto/domain.thrift +++ b/proto/domain.thrift @@ -51,7 +51,7 @@ typedef base.ID InvoiceID typedef base.ID InvoicePaymentID typedef base.Content InvoiceContext typedef base.Content InvoicePaymentContext -typedef string PaymentSession +typedef string PaymentSessionID typedef string Fingerprint typedef string IPAddress @@ -116,7 +116,7 @@ union InvoicePaymentStatus { struct Payer { 1: required PaymentTool payment_tool - 2: required PaymentSession session + 2: required PaymentSessionID session_id 3: required ClientInfo client_info 4: required ContactInfo contact_info } diff --git a/proto/merch_stat.thrift b/proto/merch_stat.thrift index c7044f9..348e1c5 100644 --- a/proto/merch_stat.thrift +++ b/proto/merch_stat.thrift @@ -10,19 +10,85 @@ namespace java com.rbkmoney.damsel.merch_stat namespace erlang merchstat /** - * Информация о платеже. Состоит из id инвойса платежа, доменной модели платежа и гео-данных. + * Информация о платеже. * **/ struct StatPayment { - 1: required domain.InvoiceID invoice_id - 2: required domain.InvoicePayment payment - 3: optional geo_ip.LocationInfo location_info + 1 : required domain.InvoicePaymentID id + 2 : required domain.InvoiceID invoice_id + 3 : required domain.PartyID owner_id + 4 : required domain.ShopID shop_id + 5 : required base.Timestamp created_at + 6 : required InvoicePaymentStatus status + 7 : required domain.Amount amount + 8 : required domain.Amount fee + 9 : required string currency_symbolic_code + 10: required PaymentTool payment_tool + 11: optional domain.IPAddress ip_address + 12: optional domain.Fingerprint fingerprint + 13: optional string phone_number + 14: optional string email + 15: required domain.PaymentSessionID session_id + 16: optional base.Content context + 17: optional geo_ip.LocationInfo location_info +} + +struct OperationFailure { + 1: required string code + 2: optional string description +} + +struct InvoicePaymentPending {} +struct InvoicePaymentProcessed {} +struct InvoicePaymentCaptured {} +struct InvoicePaymentCancelled {} +struct InvoicePaymentFailed { 1: required OperationFailure failure } + +union InvoicePaymentStatus { + 1: InvoicePaymentPending pending + 4: InvoicePaymentProcessed processed + 2: InvoicePaymentCaptured captured + 5: InvoicePaymentCancelled cancelled + 3: InvoicePaymentFailed failed +} + +union PaymentTool { + 1: BankCard bank_card +} + +struct BankCard { + 1: required domain.Token token + 2: required domain.BankCardPaymentSystem payment_system + 3: required string bin + 4: required string masked_pan } /** -* Информация об инвойсе. Состоит из доменной модели инвойса. +* Информация об инвойсе. */ struct StatInvoice { - 1: required domain.Invoice invoice; + 1 : required domain.InvoiceID id + 2 : required domain.PartyID owner_id + 3 : required domain.ShopID shop_id + 4 : required base.Timestamp created_at + 5 : required InvoiceStatus status + 6 : required string product + 7 : optional string description + 8 : required base.Timestamp due + 9 : required domain.Amount amount + 10: required string currency_symbolic_code + 11: optional base.Content 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 } /**