mirror of
https://github.com/valitydev/fistful-server.git
synced 2024-11-06 10:45:21 +00:00
FF-102: FIX - payment system convert (#116)
* fixed * refixed * micro * removed comments
This commit is contained in:
parent
f849b9d4b0
commit
fcca901e20
@ -98,8 +98,19 @@ decode_msgpack({arr, V}) when is_list(V) -> [decode_msgpack(ListItem) || List
|
||||
decode_msgpack({obj, V}) when is_map(V) ->
|
||||
maps:fold(fun(Key, Value, Map) -> Map#{decode_msgpack(Key) => decode_msgpack(Value)} end, #{}, V).
|
||||
|
||||
decode_payment_system(PaymentSystem) ->
|
||||
binary_to_existing_atom(PaymentSystem, utf8).
|
||||
decode_payment_system(<<"VISA">>) -> visa;
|
||||
decode_payment_system(<<"VISA/DANKORT">>) -> visa;
|
||||
decode_payment_system(<<"MASTERCARD">>) -> mastercard;
|
||||
decode_payment_system(<<"MAESTRO">>) -> maestro;
|
||||
decode_payment_system(<<"DANKORT">>) -> dankort;
|
||||
decode_payment_system(<<"AMERICAN EXPRESS">>) -> amex;
|
||||
decode_payment_system(<<"DINERS CLUB INTERNATIONAL">>) -> dinersclub;
|
||||
decode_payment_system(<<"DISCOVER">>) -> discover;
|
||||
decode_payment_system(<<"UNIONPAY">>) -> unionpay;
|
||||
decode_payment_system(<<"JCB">>) -> jcb;
|
||||
decode_payment_system(<<"NSPK MIR">>) -> nspkmir;
|
||||
decode_payment_system(_) ->
|
||||
erlang:error({decode_payment_system, invalid_payment_system}).
|
||||
|
||||
decode_card_type(undefined) ->
|
||||
undefined;
|
||||
@ -113,7 +124,7 @@ decode_residence(Residence) when is_binary(Residence) ->
|
||||
list_to_existing_atom(string:to_lower(binary_to_list(Residence)))
|
||||
catch
|
||||
error:badarg ->
|
||||
throw({decode_residence, invalid_residence})
|
||||
erlang:error({decode_residence, invalid_residence})
|
||||
end.
|
||||
|
||||
call_binbase(Function, Args) ->
|
||||
|
@ -15,7 +15,7 @@
|
||||
handle_function('GetByCardToken', [_Token], _Context, _Opts) ->
|
||||
{ok, #binbase_ResponseData{
|
||||
bin_data = #binbase_BinData{
|
||||
payment_system = <<"visa">>,
|
||||
payment_system = <<"VISA">>,
|
||||
bank_name = <<"sber">>,
|
||||
iso_country_code = <<"RUS">>,
|
||||
bin_data_id = {i, 123}
|
||||
@ -25,7 +25,7 @@ handle_function('GetByCardToken', [_Token], _Context, _Opts) ->
|
||||
handle_function('GetByBinDataId', [ID], _Context, _Opts) ->
|
||||
{ok, #binbase_ResponseData{
|
||||
bin_data = #binbase_BinData{
|
||||
payment_system = <<"visa">>,
|
||||
payment_system = <<"VISA">>,
|
||||
bank_name = <<"sber">>,
|
||||
iso_country_code = <<"RUS">>,
|
||||
bin_data_id = ID
|
||||
|
Loading…
Reference in New Issue
Block a user