From ffff1b6c8e12e60a2fa4900815d46f9c09a6043f Mon Sep 17 00:00:00 2001 From: ggmaleva Date: Thu, 22 Jul 2021 16:24:58 +0300 Subject: [PATCH 1/3] JD-461 add historical service for refunds, chargebacks, fraud results --- proto/fraudbusters.thrift | 83 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 2 deletions(-) diff --git a/proto/fraudbusters.thrift b/proto/fraudbusters.thrift index e53aa54..b9a7223 100644 --- a/proto/fraudbusters.thrift +++ b/proto/fraudbusters.thrift @@ -275,10 +275,10 @@ struct PaymentInfo { 3: required MerchantInfo merchant_info 4: required i64 amount 5: required string currency - 6: optional string card_token + 6: required string card_token 7: optional ClientInfo client_info 8: required PaymentStatus status - 9: required Error error + 9: optional Error error 10: required string payment_system 11: required string payment_country 12: required string payment_tool @@ -301,6 +301,8 @@ struct Filter { 8: optional string fingerprint 9: optional string terminal 10: optional base.TimestampInterval interval + 11: optional string invoice_id + 12: optional string masked_pan } struct Page { @@ -318,6 +320,68 @@ enum SortOrder { DESC } +struct FraudResult { + 1: required ID payment_id + 2: required base.Timestamp event_time + 3: required MerchantInfo merchant_info + 4: required i64 amount + 5: required string currency + 6: required string card_token + 7: required string card + 8: optional ClientInfo client_info + 11: required string bank_country + 12: required PayerType payer_type + 13: required string bank_name + 14: required string country + 15: required ResultStatus result_status + 16: optional string checked_rule + 17: required string checked_template + 18: optional string token_provider +} + +struct FraudResultResult { + 1: required list fraud_results + 2: optional ID continuation_id +} + +struct RefundInfo { + 1: required ID id + 2: required base.Timestamp event_time + 3: required MerchantInfo merchant_info + 4: required i64 amount + 5: required string currency + 6: required ProviderInfo provider_info + 7: required RefundStatus status + 8: optional Error error + 9: required ClientInfo client_info + 10: required string payment_system + 11: required string card_token +} + +struct RefundInfoResult { + 1: required list refunds + 2: optional ID continuation_id +} + +struct ChargebackInfo { + 1: required ID id + 2: required ID payment_id + 3: required base.Timestamp event_time + 4: required MerchantInfo merchant_info + 5: required i64 amount + 6: required string currency + 7: required ProviderInfo provider_info + 8: required ChargebackStatus status + 9: required ClientInfo client_info + 10: required string payment_system + 11: required string card_token +} + +struct ChargebackInfoResult { + 1: required list chargebacks + 2: optional ID continuation_id +} + /** * Дополнительное правило для проверке на наборе данных **/ @@ -458,6 +522,21 @@ service HistoricalDataService { **/ PaymentInfoResult getPayments(1: Filter filter, 2: Page page, 3: Sort sort) + /** + * Получение исторических данных по результатам работы антифрода + **/ + FraudResultResult getFraudResult(1: Filter filter, 2: Page page, 3: Sort sort) + + /** + * Получение исторических данных по возвратам + **/ + RefundInfoResult getRefunds(1: Filter filter, 2: Page page, 3: Sort sort) + + /** + * Получение исторических данных по возвратным платежам + **/ + ChargebackInfoResult getChargebacks(1: Filter filter, 2: Page page, 3: Sort sort) + /** * Применение нового правила к историческим данным From 9ffebe76d247d43b3f31a3c7ea9473e1467d4f19 Mon Sep 17 00:00:00 2001 From: ggmaleva Date: Thu, 22 Jul 2021 16:31:40 +0300 Subject: [PATCH 2/3] JD-461 method name fix --- proto/fraudbusters.thrift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/proto/fraudbusters.thrift b/proto/fraudbusters.thrift index b9a7223..5b8a9e5 100644 --- a/proto/fraudbusters.thrift +++ b/proto/fraudbusters.thrift @@ -525,7 +525,7 @@ service HistoricalDataService { /** * Получение исторических данных по результатам работы антифрода **/ - FraudResultResult getFraudResult(1: Filter filter, 2: Page page, 3: Sort sort) + FraudResultResult getFraudResults(1: Filter filter, 2: Page page, 3: Sort sort) /** * Получение исторических данных по возвратам @@ -537,7 +537,6 @@ service HistoricalDataService { **/ ChargebackInfoResult getChargebacks(1: Filter filter, 2: Page page, 3: Sort sort) - /** * Применение нового правила к историческим данным **/ From 7c84fdc6f468643f3ab3894b6e45a152912b09d4 Mon Sep 17 00:00:00 2001 From: ggmaleva Date: Fri, 23 Jul 2021 14:52:42 +0300 Subject: [PATCH 3/3] JD-461 add historical service for refunds, chargebacks, fraud results --- proto/fraudbusters.thrift | 113 +++++++++----------------------------- 1 file changed, 26 insertions(+), 87 deletions(-) diff --git a/proto/fraudbusters.thrift b/proto/fraudbusters.thrift index 5b8a9e5..541c657 100644 --- a/proto/fraudbusters.thrift +++ b/proto/fraudbusters.thrift @@ -269,27 +269,6 @@ enum WithdrawalStatus { failed } -struct PaymentInfo { - 1: required ID id - 2: required base.Timestamp event_time - 3: required MerchantInfo merchant_info - 4: required i64 amount - 5: required string currency - 6: required string card_token - 7: optional ClientInfo client_info - 8: required PaymentStatus status - 9: optional Error error - 10: required string payment_system - 11: required string payment_country - 12: required string payment_tool - 13: required ProviderInfo provider -} - -struct PaymentInfoResult { - 1: required list payments - 2: optional ID continuation_id -} - struct Filter { 1: optional string party_id 2: optional string shop_id @@ -320,66 +299,10 @@ enum SortOrder { DESC } -struct FraudResult { - 1: required ID payment_id - 2: required base.Timestamp event_time - 3: required MerchantInfo merchant_info - 4: required i64 amount - 5: required string currency - 6: required string card_token - 7: required string card - 8: optional ClientInfo client_info - 11: required string bank_country - 12: required PayerType payer_type - 13: required string bank_name - 14: required string country - 15: required ResultStatus result_status - 16: optional string checked_rule - 17: required string checked_template - 18: optional string token_provider -} - -struct FraudResultResult { - 1: required list fraud_results - 2: optional ID continuation_id -} - -struct RefundInfo { - 1: required ID id - 2: required base.Timestamp event_time - 3: required MerchantInfo merchant_info - 4: required i64 amount - 5: required string currency - 6: required ProviderInfo provider_info - 7: required RefundStatus status - 8: optional Error error - 9: required ClientInfo client_info - 10: required string payment_system - 11: required string card_token -} - -struct RefundInfoResult { - 1: required list refunds - 2: optional ID continuation_id -} - -struct ChargebackInfo { - 1: required ID id - 2: required ID payment_id - 3: required base.Timestamp event_time - 4: required MerchantInfo merchant_info - 5: required i64 amount - 6: required string currency - 7: required ProviderInfo provider_info - 8: required ChargebackStatus status - 9: required ClientInfo client_info - 10: required string payment_system - 11: required string card_token -} - -struct ChargebackInfoResult { - 1: required list chargebacks - 2: optional ID continuation_id +struct Transaction { + 1: required Payment payment + 2: required string country + 3: required string bank_name } /** @@ -414,7 +337,7 @@ struct CascasdingTemplateEmulation { **/ struct EmulationRuleApplyRequest { 1: required EmulationRule emulation_rule - 2: required set transactions + 2: required set transactions } union ResultStatus { @@ -449,7 +372,7 @@ struct CheckResult { } struct HistoricalTransactionCheck { - 1: required PaymentInfo transaction + 1: required Transaction transaction 2: required CheckResult check_result } @@ -457,6 +380,22 @@ struct HistoricalDataSetCheckResult { 1: required set historical_transaction_check } +union HistoricalData { + 1: list payments + 2: list refunds + 3: list chargebacks + 4: list fraud_results +} + +/** +* Общий ответ для получения исторических данных +*/ +struct HistoricalDataResponse { + 1: required HistoricalData data + 2: optional ID continuation_id +} + + /** * Исключение при вставке, в id приходит идентификатор записи из батча, начиная с которой записи не вставились * во избежания дубликатов записей необходимо повторять только записи начиная с вернувшегося ID @@ -520,22 +459,22 @@ service HistoricalDataService { /** * Получение исторических данных по платежам **/ - PaymentInfoResult getPayments(1: Filter filter, 2: Page page, 3: Sort sort) + HistoricalDataResponse getPayments(1: Filter filter, 2: Page page, 3: Sort sort) /** * Получение исторических данных по результатам работы антифрода **/ - FraudResultResult getFraudResults(1: Filter filter, 2: Page page, 3: Sort sort) + HistoricalDataResponse getFraudResults(1: Filter filter, 2: Page page, 3: Sort sort) /** * Получение исторических данных по возвратам **/ - RefundInfoResult getRefunds(1: Filter filter, 2: Page page, 3: Sort sort) + HistoricalDataResponse getRefunds(1: Filter filter, 2: Page page, 3: Sort sort) /** * Получение исторических данных по возвратным платежам **/ - ChargebackInfoResult getChargebacks(1: Filter filter, 2: Page page, 3: Sort sort) + HistoricalDataResponse getChargebacks(1: Filter filter, 2: Page page, 3: Sort sort) /** * Применение нового правила к историческим данным