IMP-76: Add new fields in contact info (#38)

* added new fields in contact info

* fixed test

* bumped damsel, swag server/client

* fixed
This commit is contained in:
Артем 2023-09-11 16:08:40 +03:00 committed by GitHub
parent d5ed8b20f2
commit d3f6860085
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 106 additions and 19 deletions

View File

@ -68,6 +68,13 @@
-define(vat, 62).
-define(unlimited, 63).
-define(shop, 64).
-define(first_name, 65).
-define(last_name, 66).
-define(country, 67).
-define(state, 68).
-define(city, 69).
-define(address, 70).
-define(postal_code, 71).
-export([payment/0]).
-export([invoice/0]).
@ -326,7 +333,14 @@ lifetime_schema() ->
contact_info_schema() ->
#{
?email => <<"email">>,
?phone_number => <<"phoneNumber">>
?phone_number => <<"phoneNumber">>,
?first_name => <<"firstName">>,
?last_name => <<"lastName">>,
?country => <<"country">>,
?state => <<"state">>,
?city => <<"city">>,
?address => <<"address">>,
?postal_code => <<"postalCode">>
}.
-ifdef(TEST).
@ -602,7 +616,14 @@ read_customer_features_test() ->
?shop_id => hash(?STRING),
?contact_info => #{
?email => hash(<<"bla@bla.ru">>),
?phone_number => undefined
?phone_number => undefined,
?first_name => undefined,
?last_name => undefined,
?country => undefined,
?state => undefined,
?city => undefined,
?address => undefined,
?postal_code => undefined
}
},
?assertEqual(
@ -622,7 +643,14 @@ compare_customer_features_test() ->
<<"shopID">> => hash(<<"Another shop">>),
<<"contactInfo">> => #{
<<"email">> => hash(<<"bla@example.com">>),
<<"phoneNumber">> => <<"8-800-555-35-35">>
<<"phoneNumber">> => <<"8-800-555-35-35">>,
<<"firstName">> => <<"firstName">>,
<<"lastName">> => <<"lastName">>,
<<"country">> => <<"country">>,
<<"state">> => <<"state">>,
<<"city">> => <<"city">>,
<<"address">> => <<"address">>,
<<"postalCode">> => <<"postalCode">>
}
},
common_compare_tests(

View File

@ -32,10 +32,27 @@ decode_shop_details(#domain_ShopDetails{name = Name, description = Description})
}).
-spec decode_contact_info(capi_handler_encoder:encode_data()) -> capi_handler_decoder_utils:decode_data().
decode_contact_info(#domain_ContactInfo{phone_number = PhoneNumber, email = Email}) ->
decode_contact_info(#domain_ContactInfo{
phone_number = PhoneNumber,
email = Email,
first_name = FirstName,
last_name = LastName,
country = Country,
state = State,
city = City,
address = Address,
postal_code = PostalCode
}) ->
genlib_map:compact(#{
<<"phoneNumber">> => PhoneNumber,
<<"email">> => Email
<<"email">> => Email,
<<"firstName">> => FirstName,
<<"lastName">> => LastName,
<<"country">> => Country,
<<"state">> => State,
<<"city">> => City,
<<"address">> => Address,
<<"postalCode">> => PostalCode
}).
-spec decode_party(capi_handler_encoder:encode_data()) -> capi_handler_decoder_utils:decode_data().

View File

@ -26,7 +26,14 @@
encode_contact_info(ContactInfo) ->
#domain_ContactInfo{
phone_number = genlib_map:get(<<"phoneNumber">>, ContactInfo),
email = genlib_map:get(<<"email">>, ContactInfo)
email = genlib_map:get(<<"email">>, ContactInfo),
first_name = genlib_map:get(<<"firstName">>, ContactInfo),
last_name = genlib_map:get(<<"lastName">>, ContactInfo),
country = genlib_map:get(<<"country">>, ContactInfo),
state = genlib_map:get(<<"state">>, ContactInfo),
city = genlib_map:get(<<"city">>, ContactInfo),
address = genlib_map:get(<<"address">>, ContactInfo),
postal_code = genlib_map:get(<<"postalCode">>, ContactInfo)
}.
-spec encode_client_info(request_data()) -> encode_data().

View File

@ -288,7 +288,14 @@ decode_stat_payer(
recurrent_parent = RecurrentParent,
contact_info = #domain_ContactInfo{
phone_number = PhoneNumber,
email = Email
email = Email,
first_name = FirstName,
last_name = LastName,
country = Country,
state = State,
city = City,
address = Address,
postal_code = PostalCode
}
}}
) ->
@ -297,7 +304,14 @@ decode_stat_payer(
<<"paymentToolDetails">> => decode_stat_payment_tool_details(PaymentTool),
<<"contactInfo">> => genlib_map:compact(#{
<<"phoneNumber">> => PhoneNumber,
<<"email">> => Email
<<"email">> => Email,
<<"firstName">> => FirstName,
<<"lastName">> => LastName,
<<"country">> => Country,
<<"state">> => State,
<<"city">> => City,
<<"address">> => Address,
<<"postalCode">> => PostalCode
}),
<<"recurrentParentPayment">> => capi_handler_decoder_invoicing:decode_recurrent_parent(RecurrentParent)
};
@ -313,7 +327,14 @@ decode_stat_payer(
},
contact_info = #domain_ContactInfo{
phone_number = PhoneNumber,
email = Email
email = Email,
first_name = FirstName,
last_name = LastName,
country = Country,
state = State,
city = City,
address = Address,
postal_code = PostalCode
}
}}
) ->
@ -327,7 +348,14 @@ decode_stat_payer(
}),
<<"contactInfo">> => genlib_map:compact(#{
<<"phoneNumber">> => PhoneNumber,
<<"email">> => Email
<<"email">> => Email,
<<"firstName">> => FirstName,
<<"lastName">> => LastName,
<<"country">> => Country,
<<"state">> => State,
<<"city">> => City,
<<"address">> => Address,
<<"postalCode">> => PostalCode
})
}).

View File

@ -244,7 +244,14 @@
-define(CONTACT_INFO, #domain_ContactInfo{
phone_number = ?STRING,
email = ?EMAIL
email = ?EMAIL,
first_name = <<"FirstName">>,
last_name = <<"LastName">>,
country = <<"RUS">>,
state = <<"State">>,
city = <<"City">>,
address = <<"Address">>,
postal_code = <<"PostalCode">>
}).
-define(EXP_DATE(Month, Year), #domain_BankCardExpDate{
@ -493,7 +500,7 @@
first_name = ?STRING,
second_name = ?STRING,
middle_name = ?STRING,
contact_info = #domain_ContactInfo{}
contact_info = ?CONTACT_INFO
}}},
status = none,
identity_documents = []

View File

@ -76,7 +76,7 @@
% mandatory
unmatched_returns,
error_handling,
race_conditions,
% race_conditions,
unknown
]},
{plt_apps, all_deps}

View File

@ -37,7 +37,7 @@
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
{<<"damsel">>,
{git,"https://github.com/valitydev/damsel.git",
{ref,"bfedcb9dbb0bfdbd7a06a86417b49be6e807b98d"}},
{ref,"2374f52326fb9b10e79e0ec0a769af35529938e9"}},
0},
{<<"dmt_client">>,
{git,"https://github.com/valitydev/dmt_client.git",
@ -116,14 +116,14 @@
{git,"https://github.com/valitydev/snowflake.git",
{ref,"de159486ef40cec67074afe71882bdc7f7deab72"}},
1},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.6">>},2},
{<<"ssl_verify_fun">>,{pkg,<<"ssl_verify_fun">>,<<"1.1.7">>},2},
{<<"swag_client">>,
{git,"https://github.com/valitydev/swag-payments",
{ref,"1f1327d6a09af117f45fae21165153654bc218bf"}},
{ref,"1a962517ecd9fd210dafe121383e6b53a8d0d3f0"}},
0},
{<<"swag_server">>,
{git,"https://github.com/valitydev/swag-payments",
{ref,"5e355455f1a2cb0735d1ceead4e981712ebe4a92"}},
{ref,"6d047cc73fce898258351586fb72afae0e116728"}},
0},
{<<"thrift">>,
{git,"https://github.com/valitydev/thrift_erlang.git",
@ -161,7 +161,7 @@
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"6E6AA8167CB44CC8F39441D05193BE6E6F4E7C2946CB2759F015F8C56B76E5FF">>},
{<<"ranch">>, <<"8C7A100A139FD57F17327B6413E4167AC559FBC04CA7448E9BE9057311597A1D">>},
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"ssl_verify_fun">>, <<"354C321CF377240C7B8716899E182CE4890C5938111A1296ADD3EC74CF1715DF">>},
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[
{<<"cache">>, <<"44516CE6FA03594D3A2AF025DD3A87BFE711000EB730219E1DDEFC816E0AA2F4">>},
@ -177,6 +177,6 @@
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
{<<"parse_trans">>, <<"620A406CE75DADA827B82E453C19CF06776BE266F5A67CFF34E1EF2CBB60E49A">>},
{<<"ranch">>, <<"49FBCFD3682FAB1F5D109351B61257676DA1A2FDBE295904176D5E521A2DDFE5">>},
{<<"ssl_verify_fun">>, <<"BDB0D2471F453C88FF3908E7686F86F9BE327D065CC1EC16FA4540197EA04680">>},
{<<"ssl_verify_fun">>, <<"FE4C190E8F37401D30167C8C405EDA19469F34577987C76DDE613E838BBC67F8">>},
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
].