ED-117: damsel upgrade (#387)

This commit is contained in:
dinama 2021-04-13 10:39:57 +03:00 committed by GitHub
parent 41f6f1eddd
commit 1cf7486d09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 37 deletions

View File

@ -609,7 +609,7 @@ domain_config(Options, C) ->
{condition,
{payment_tool,
{crypto_currency, #domain_CryptoCurrencyCondition{
definition = {crypto_currency_is, litecoin}
definition = {crypto_currency_is_deprecated, litecoin}
}}}},
then_ = {value, [?prv(3)]}
},
@ -791,7 +791,7 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}}}}
])},
@ -824,7 +824,7 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}}}}
])},
@ -857,7 +857,7 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}}}}
])},
@ -920,14 +920,14 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}},
receiver_is =
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}}
}}}
@ -1012,14 +1012,14 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}},
receiver_is =
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}}
}}},
@ -1074,14 +1074,14 @@ default_termset(Options) ->
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = visa
payment_system_is_deprecated = visa
}}
}},
receiver_is =
{bank_card, #domain_BankCardCondition{
definition =
{payment_system, #domain_PaymentSystemCondition{
payment_system_is = nspkmir
payment_system_is_deprecated = nspkmir
}}
}}
}}},

View File

@ -171,7 +171,7 @@ marshal(
ExpDate = genlib_map:get(exp_date, BankCard),
{bank_card, #domain_BankCard{
token = Token,
payment_system = PaymentSystem,
payment_system_deprecated = PaymentSystem,
bin = BIN,
last_digits = LastDigits,
cardholder_name = CardHolderName,
@ -188,7 +188,7 @@ marshal(
) ->
{crypto_wallet, #domain_CryptoWallet{
id = CryptoWalletID,
crypto_currency = Currency,
crypto_currency_deprecated = Currency,
destination_tag = maps:get(tag, Data, undefined)
}};
marshal(

View File

@ -1097,20 +1097,16 @@ construct_payment_tool({bank_card, #{bank_card := ResourceBankCard}}) ->
token = maps:get(token, ResourceBankCard),
bin = maps:get(bin, ResourceBankCard),
last_digits = maps:get(masked_pan, ResourceBankCard),
payment_system = maps:get(payment_system, ResourceBankCard),
payment_system_deprecated = maps:get(payment_system, ResourceBankCard),
issuer_country = maps:get(iso_country_code, ResourceBankCard, undefined),
bank_name = maps:get(bank_name, ResourceBankCard, undefined)
}};
construct_payment_tool({crypto_wallet, #{crypto_wallet := #{currency := {Currency, _}}}}) ->
{crypto_currency, Currency}.
{crypto_currency_deprecated, Currency}.
%% Quote helpers
-spec get_quote(quote_params()) ->
{ok, quote()}
| {error,
create_error()
| {route, route_not_found}}.
-spec get_quote(quote_params()) -> {ok, quote()} | {error, create_error() | {route, route_not_found}}.
get_quote(Params = #{destination_id := DestinationID, body := Body, wallet_id := WalletID}) ->
do(fun() ->
Destination = unwrap(destination, get_destination(DestinationID)),

View File

@ -134,7 +134,7 @@ unmarshal(
payment_tool =
{bank_card, #domain_BankCard{
token = Token,
payment_system = PaymentSystem,
payment_system_deprecated = PaymentSystem,
bin = Bin,
last_digits = LastDigits,
exp_date = ExpDate,
@ -231,7 +231,7 @@ marshal(bank_card, BankCard) ->
token = ff_resource:token(BankCard),
bin = ff_resource:bin(BankCard),
last_digits = ff_resource:masked_pan(BankCard),
payment_system = ff_resource:payment_system(BankCard),
payment_system_deprecated = ff_resource:payment_system(BankCard),
issuer_country = ff_resource:country_code(BankCard),
bank_name = ff_resource:bank_name(BankCard),
exp_date = maybe_marshal(exp_date, ExpDate),

View File

@ -898,11 +898,11 @@ encode_varset(Varset) ->
dmsl_domain_thrift:'PaymentMethodRef'() | undefined.
encode_payment_method(undefined) ->
undefined;
encode_payment_method({bank_card, #domain_BankCard{payment_system = PaymentSystem}}) ->
encode_payment_method({bank_card, #domain_BankCard{payment_system_deprecated = PaymentSystem}}) ->
#domain_PaymentMethodRef{
id = {bank_card_deprecated, PaymentSystem}
};
encode_payment_method({crypto_currency, CryptoCurrency}) ->
encode_payment_method({crypto_currency_deprecated, CryptoCurrency}) ->
#domain_PaymentMethodRef{
id = {crypto_currency, CryptoCurrency}
id = {crypto_currency_deprecated, CryptoCurrency}
}.

View File

@ -21,7 +21,7 @@ test_condition({payment_terminal, C}, {payment_terminal, V = #domain_PaymentTerm
test_payment_terminal_condition(C, V);
test_condition({digital_wallet, C}, {digital_wallet, V = #domain_DigitalWallet{}}) ->
test_digital_wallet_condition(C, V);
test_condition({crypto_currency, C}, {crypto_currency, V}) ->
test_condition({crypto_currency, C}, {crypto_currency_deprecated, V}) ->
test_crypto_currency_condition(C, V);
test_condition(_PaymentTool, _Condition) ->
false.
@ -34,7 +34,7 @@ test_bank_card_condition(#domain_BankCardCondition{}, _) ->
% legacy
test_bank_card_condition_def(
{payment_system_is, Ps},
#domain_BankCard{payment_system = Ps, token_provider = undefined}
#domain_BankCard{payment_system_deprecated = Ps, token_provider_deprecated = undefined}
) ->
true;
test_bank_card_condition_def({payment_system_is, _Ps}, #domain_BankCard{}) ->
@ -47,8 +47,8 @@ test_bank_card_condition_def({issuer_bank_is, BankRef}, V) ->
test_issuer_bank_condition(BankRef, V).
test_payment_system_condition(
#domain_PaymentSystemCondition{payment_system_is = Ps, token_provider_is = Tp},
#domain_BankCard{payment_system = Ps, token_provider = Tp}
#domain_PaymentSystemCondition{payment_system_is_deprecated = Ps, token_provider_is_deprecated = Tp},
#domain_BankCard{payment_system_deprecated = Ps, token_provider_deprecated = Tp}
) ->
true;
test_payment_system_condition(#domain_PaymentSystemCondition{}, #domain_BankCard{}) ->
@ -82,17 +82,20 @@ test_bank_card_patterns(Patterns, BankName) ->
test_payment_terminal_condition(#domain_PaymentTerminalCondition{definition = Def}, V) ->
Def =:= undefined orelse test_payment_terminal_condition_def(Def, V).
test_payment_terminal_condition_def({provider_is, V1}, #domain_PaymentTerminal{terminal_type = V2}) ->
test_payment_terminal_condition_def(
{provider_is_deprecated, V1},
#domain_PaymentTerminal{terminal_type_deprecated = V2}
) ->
V1 =:= V2.
test_digital_wallet_condition(#domain_DigitalWalletCondition{definition = Def}, V) ->
Def =:= undefined orelse test_digital_wallet_condition_def(Def, V).
test_digital_wallet_condition_def({provider_is, V1}, #domain_DigitalWallet{provider = V2}) ->
test_digital_wallet_condition_def({provider_is_deprecated, V1}, #domain_DigitalWallet{provider_deprecated = V2}) ->
V1 =:= V2.
test_crypto_currency_condition(#domain_CryptoCurrencyCondition{definition = Def}, V) ->
Def =:= undefined orelse test_crypto_currency_condition_def(Def, V).
test_crypto_currency_condition_def({crypto_currency_is, C1}, C2) ->
test_crypto_currency_condition_def({crypto_currency_is_deprecated, C1}, C2) ->
C1 =:= C2.

View File

@ -248,7 +248,7 @@ make_varset(Cash, PartyID) ->
cost => Cash,
payment_tool =>
{bank_card, #domain_BankCard{
payment_system = visa
payment_system_deprecated = visa
}},
party_id => PartyID
}.

View File

@ -505,15 +505,15 @@
#domain_PaymentMethodRef{
id =
{tokenized_bank_card_deprecated, #domain_TokenizedBankCard{
payment_system = mastercard,
token_provider = applepay
payment_system_deprecated = mastercard,
token_provider_deprecated = applepay
}}
},
#domain_PaymentMethodRef{
id =
{tokenized_bank_card_deprecated, #domain_TokenizedBankCard{
payment_system = visa,
token_provider = applepay
payment_system_deprecated = visa,
token_provider_deprecated = applepay
}}
}
])}

View File

@ -39,7 +39,7 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.8.0">>},1},
{<<"damsel">>,
{git,"https://github.com/rbkmoney/damsel.git",
{ref,"7a9d7a67d0194ecdb1cc0f9b390015352ac42271"}},
{ref,"90dcee85d6dc72779d3fcde62d464b6321ff21e9"}},
0},
{<<"dmt_client">>,
{git,"https://github.com/rbkmoney/dmt_client.git",