CAPI-339: Ignore empty cvv in google pay plain card (#322)

This commit is contained in:
Артем 2019-03-05 17:29:17 +03:00 committed by GitHub
parent 4ff024e65c
commit b92b8ba9a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 1 deletions

View File

@ -250,7 +250,9 @@ process_put_card_data_result(
{bank_card, BankCard#domain_BankCard{
payment_system = PaymentSystem,
masked_pan = capi_utils:define(Last4, BankCard#domain_BankCard.masked_pan),
token_provider = get_payment_token_provider(PaymentDetails, PaymentData)
token_provider = get_payment_token_provider(PaymentDetails, PaymentData),
%% Не учитываем наличие cvv для токенизированных карт, даже если проводим их как обычные.
is_cvv_empty = undefined
}},
SessionID
}.

View File

@ -36,6 +36,7 @@
get_invoice_payment_methods_ok_test/1,
create_payment_ok_test/1,
create_payment_with_empty_cvv_ok_test/1,
create_payment_with_googlepay_plain_ok_test/1,
get_payments_ok_test/1,
get_payment_by_id_ok_test/1,
get_client_payment_status_test/1,
@ -81,6 +82,7 @@ invoice_access_token_tests() ->
get_invoice_payment_methods_ok_test,
create_payment_ok_test,
create_payment_with_empty_cvv_ok_test,
create_payment_with_googlepay_plain_ok_test,
get_payments_ok_test,
get_client_payment_status_test,
get_payment_by_id_ok_test,
@ -589,6 +591,74 @@ create_payment_with_empty_cvv_ok_test(Config) ->
},
{ok, _} = capi_client_payments:create_payment(?config(context, Config), Req2, ?STRING).
-spec create_payment_with_googlepay_plain_ok_test(_) ->
_.
create_payment_with_googlepay_plain_ok_test(Config) ->
capi_ct_helper:mock_services([
{payment_tool_provider_google_pay,
fun('Unwrap', _) ->
{ok, ?UNWRAPPED_PAYMENT_TOOL(
?GOOGLE_PAY_DETAILS,
{card, #paytoolprv_Card{
pan = <<"1234567890123456">>,
exp_date = #paytoolprv_ExpDate{month = 10, year = 2018}
}}
)}
end
},
{cds_storage,
fun('PutCardData', _) -> {ok, ?PUT_CARD_DATA_RESULT} end
},
{invoicing,fun
('StartPayment', [_UserInfo, _InvoiceID,
#payproc_InvoicePaymentParams{
payer = {payment_resource, #payproc_PaymentResourcePayerParams{
resource = #domain_DisposablePaymentResource{
payment_tool = {
bank_card,
#domain_BankCard{
is_cvv_empty = undefined,
token_provider = undefined,
payment_system = mastercard
}
}
}
}}
}
]) -> {ok, ?PAYPROC_PAYMENT}
end},
{binbase,
fun('Lookup', _) -> {ok, ?BINBASE_LOOKUP_RESULT} end
}
], Config),
ClientInfo = #{<<"fingerprint">> => <<"test fingerprint">>},
{ok, #{
<<"paymentToolDetails">> := Details = #{<<"paymentSystem">> := <<"mastercard">>},
<<"paymentToolToken">> := Token,
<<"paymentSession">> := Session
}
} = capi_client_tokens:create_payment_resource(?config(context, Config), #{
<<"paymentTool">> => #{
<<"paymentToolType">> => <<"TokenizedCardData">>,
<<"provider">> => <<"GooglePay">>,
<<"gatewayMerchantID">> => <<"SomeMerchantID">>,
<<"paymentToken">> => #{}
},
<<"clientInfo">> => ClientInfo
}),
false = maps:is_key(<<"tokenProvider">>, Details),
Req2 = #{
<<"flow">> => #{<<"type">> => <<"PaymentFlowInstant">>},
<<"payer">> => #{
<<"payerType">> => <<"PaymentResourcePayer">>,
<<"paymentSession">> => Session,
<<"paymentToolToken">> => Token,
<<"contactInfo">> => #{
<<"email">> => <<"bla@bla.ru">>
}
}
},
{ok, _} = capi_client_payments:create_payment(?config(context, Config), Req2, ?STRING).
-spec get_payments_ok_test(config()) ->
_.