mirror of
https://github.com/valitydev/fistful-server.git
synced 2024-11-06 02:35:18 +00:00
This reverts commit 527f9a56c4
.
This commit is contained in:
parent
527f9a56c4
commit
3594a85f68
@ -1,27 +1,31 @@
|
||||
-module(ct_cardstore).
|
||||
|
||||
-export([bank_card/2]).
|
||||
-export([bank_card/3]).
|
||||
|
||||
%%
|
||||
|
||||
-include_lib("cds_proto/include/cds_proto_storage_thrift.hrl").
|
||||
|
||||
-spec bank_card(binary(), ct_helper:config()) ->
|
||||
-spec bank_card(binary(), {1..12, 2000..9999}, ct_helper:config()) ->
|
||||
#{
|
||||
token := binary(),
|
||||
bin => binary(),
|
||||
masked_pan => binary()
|
||||
}.
|
||||
|
||||
bank_card(PAN, C) ->
|
||||
CardData = #cds_CardData{
|
||||
pan = PAN
|
||||
bank_card(PAN, {MM, YYYY}, C) ->
|
||||
CardData = #cds_PutCardData{
|
||||
pan = PAN,
|
||||
exp_date = #cds_ExpDate{month = MM, year = YYYY}
|
||||
},
|
||||
SessionData = #cds_SessionData{
|
||||
auth_data = {card_security_code, #cds_CardSecurityCode{value = <<>>}}
|
||||
},
|
||||
Client = ff_woody_client:new(maps:get('cds', ct_helper:cfg(services, C))),
|
||||
WoodyCtx = ct_helper:get_woody_ctx(C),
|
||||
Request = {{cds_proto_storage_thrift, 'Storage'}, 'PutCard', [CardData]},
|
||||
Request = {{cds_proto_storage_thrift, 'Storage'}, 'PutCardData', [CardData, SessionData]},
|
||||
case woody_client:call(Request, Client, WoodyCtx) of
|
||||
{ok, #cds_PutCardResult{bank_card = #cds_BankCard{
|
||||
{ok, #cds_PutCardDataResult{bank_card = #cds_BankCard{
|
||||
token = Token,
|
||||
bin = BIN,
|
||||
last_digits = Masked
|
||||
|
@ -411,7 +411,7 @@ process_deposit(SrcID, WalID) ->
|
||||
DepID.
|
||||
|
||||
create_destination(IID, C) ->
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, C)},
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C)},
|
||||
DestID = create_instrument(destination, IID, <<"XDesination">>, <<"RUB">>, DestResource, C),
|
||||
authorized = ct_helper:await(
|
||||
authorized,
|
||||
|
@ -530,7 +530,7 @@ create_destination(IID, Token, C) ->
|
||||
|
||||
create_destination(IID, Currency, Token, C) ->
|
||||
ID = generate_id(),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
NewStoreResource = case Token of
|
||||
undefined ->
|
||||
StoreSource;
|
||||
|
@ -139,7 +139,7 @@ create_identity(Party, ProviderID, ClassID, _C) ->
|
||||
ID.
|
||||
|
||||
create_destination(IID, C) ->
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, C)},
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C)},
|
||||
DestID = create_instrument(destination, IID, <<"XDesination">>, <<"RUB">>, DestResource, C),
|
||||
authorized = ct_helper:await(
|
||||
authorized,
|
||||
|
@ -460,7 +460,7 @@ process_deposit(SrcID, WalID) ->
|
||||
ok = await_wallet_balance({10000, <<"RUB">>}, WalID).
|
||||
|
||||
create_destination(IID, C) ->
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, C)},
|
||||
DestResource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C)},
|
||||
DestID = create_instrument(destination, IID, <<"XDesination">>, <<"RUB">>, DestResource, C),
|
||||
authorized = ct_helper:await(
|
||||
authorized,
|
||||
|
@ -592,7 +592,7 @@ create_destination(IID, Token, C) ->
|
||||
|
||||
create_destination(IID, Currency, Token, C) ->
|
||||
ID = generate_id(),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
NewStoreResource = case Token of
|
||||
undefined ->
|
||||
StoreSource;
|
||||
|
@ -440,7 +440,7 @@ generate_id() ->
|
||||
|
||||
create_destination(IID, C) ->
|
||||
ID = generate_id(),
|
||||
Resource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, C)},
|
||||
Resource = {bank_card, ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C)},
|
||||
Params = #{id => ID, identity => IID, name => <<"XDesination">>, currency => <<"RUB">>, resource => Resource},
|
||||
ok = ff_destination:create(Params, ff_entity_context:new()),
|
||||
authorized = ct_helper:await(
|
||||
|
@ -83,7 +83,7 @@ get_fee_ok_test(C) ->
|
||||
-spec visa_to_nspkmir_not_allow_test(config()) -> test_return().
|
||||
visa_to_nspkmir_not_allow_test(C) ->
|
||||
Cash = {22500, <<"RUB">>},
|
||||
#{bin := Bin, masked_pan := Pan} = ct_cardstore:bank_card(<<"2204399999000900">>, C),
|
||||
#{bin := Bin, masked_pan := Pan} = ct_cardstore:bank_card(<<"2204399999000900">>, {12, 2025}, C),
|
||||
#{
|
||||
identity_id := Identity,
|
||||
sender := CardSender
|
||||
@ -102,7 +102,7 @@ visa_to_nspkmir_not_allow_test(C) ->
|
||||
prepare_standard_environment(C) ->
|
||||
Party = create_party(C),
|
||||
IdentityID = create_person_identity(Party, C),
|
||||
CardSender = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
CardSender = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
#{
|
||||
identity_id => IdentityID,
|
||||
party_id => Party,
|
||||
|
@ -279,7 +279,7 @@ generate_id() ->
|
||||
ff_id:generate_snowflake_id().
|
||||
|
||||
create_resource_raw(Token, C) ->
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
case Token of
|
||||
undefined ->
|
||||
StoreSource;
|
||||
|
@ -55,7 +55,7 @@ prepare_standard_environment(_P2PTransferCash, Token, C) ->
|
||||
}.
|
||||
|
||||
create_resource_raw(Token, C) ->
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
NewStoreResource =
|
||||
case Token of
|
||||
undefined ->
|
||||
|
@ -386,7 +386,7 @@ generate_id() ->
|
||||
ff_id:generate_snowflake_id().
|
||||
|
||||
create_resource_raw(C) ->
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
StoreSource = ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
p2p_participant:create(raw, {bank_card, StoreSource}).
|
||||
|
||||
await_final_adjustment_status(P2PTransferID, AdjustmentID) ->
|
||||
|
@ -165,7 +165,7 @@ idempotency_wallet_conflict(C) ->
|
||||
|
||||
idempotency_destination_ok(C) ->
|
||||
BankCard = #{masked_pan := MP} =
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
PS = <<"visa">>,
|
||||
Party = create_party(C),
|
||||
ExternalID = genlib:unique(),
|
||||
@ -195,7 +195,7 @@ idempotency_destination_ok(C) ->
|
||||
|
||||
idempotency_destination_conflict(C) ->
|
||||
BankCard = #{masked_pan := MP} =
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
PS = <<"visa">>,
|
||||
Party = create_party(C),
|
||||
ExternalID = genlib:unique(),
|
||||
@ -286,7 +286,7 @@ wait_for_destination_authorized(DestID) ->
|
||||
|
||||
create_destination_legacy(IdentityID, Party, C) ->
|
||||
BankCard = #{masked_pan := MP} =
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, C),
|
||||
ct_cardstore:bank_card(<<"4150399999000900">>, {12, 2025}, C),
|
||||
PaymentSystem = <<"visa">>,
|
||||
Params = #{
|
||||
<<"identity">> => IdentityID,
|
||||
|
@ -137,7 +137,7 @@ services:
|
||||
retries: 10
|
||||
|
||||
cds:
|
||||
image: dr2.rbkmoney.com/rbkmoney/cds:c56f518ad5869e97187e3ca7390166a997369f96
|
||||
image: dr2.rbkmoney.com/rbkmoney/cds:7aeee60277aab0e6ebb6e6b1334752d3091082f4
|
||||
command: /opt/cds/bin/cds foreground
|
||||
volumes:
|
||||
- ./test/cds/sys.config:/opt/cds/releases/0.1.0/sys.config
|
||||
|
@ -16,7 +16,7 @@
|
||||
{<<"cache">>,{pkg,<<"cache">>,<<"2.2.0">>},1},
|
||||
{<<"cds_proto">>,
|
||||
{git,"git@github.com:rbkmoney/cds-proto.git",
|
||||
{ref,"f6ac99237530a570b1f4d1025499e6ea9aaf848b"}},
|
||||
{ref,"dfa135410d6e186a067acc9afda5ebbf4b454fb7"}},
|
||||
0},
|
||||
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.1">>},1},
|
||||
{<<"cg_mon">>,
|
||||
|
Loading…
Reference in New Issue
Block a user