also inform about AML-triggered KYC requirement in GET deposits endpoint

This commit is contained in:
Christian Grothoff 2023-02-19 10:26:06 +01:00
parent 06e2e8022c
commit 2fd87736b4
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -134,6 +134,7 @@ TEH_PG_lookup_transfer_by_deposit (
do not have a WTID yet. In that case, return without wtid do not have a WTID yet. In that case, return without wtid
(by setting 'pending' true). */ (by setting 'pending' true). */
uint32_t status32 = TALER_AML_NORMAL; uint32_t status32 = TALER_AML_NORMAL;
uint64_t aml_kyc_row = 0;
struct GNUNET_PQ_ResultSpec rs2[] = { struct GNUNET_PQ_ResultSpec rs2[] = {
GNUNET_PQ_result_spec_auto_from_type ("wire_salt", GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
&wire_salt), &wire_salt),
@ -143,6 +144,10 @@ TEH_PG_lookup_transfer_by_deposit (
GNUNET_PQ_result_spec_uint64 ("legitimization_requirement_serial_id", GNUNET_PQ_result_spec_uint64 ("legitimization_requirement_serial_id",
&kyc->requirement_row), &kyc->requirement_row),
NULL), NULL),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_uint64 ("kyc_requirement",
&aml_kyc_row),
NULL),
TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee", TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
amount_with_fee), amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit", TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
@ -168,6 +173,7 @@ TEH_PG_lookup_transfer_by_deposit (
",denom.fee_deposit_frac" ",denom.fee_deposit_frac"
",dep.wire_deadline" ",dep.wire_deadline"
",aml.status" ",aml.status"
",aml.kyc_requirement"
" FROM deposits dep" " FROM deposits dep"
" JOIN wire_targets wt" " JOIN wire_targets wt"
" USING (wire_target_h_payto)" " USING (wire_target_h_payto)"
@ -195,6 +201,14 @@ TEH_PG_lookup_transfer_by_deposit (
*aml_decision = (enum TALER_AmlDecisionState) status32; *aml_decision = (enum TALER_AmlDecisionState) status32;
if (0 == kyc->requirement_row) if (0 == kyc->requirement_row)
kyc->ok = true; /* technically: unknown */ kyc->ok = true; /* technically: unknown */
if ( (kyc->ok) &&
(TALER_AML_FROZEN == *aml_decision) &&
(0 != aml_kyc_row) )
{
/* KYC required via AML */
kyc->ok = false;
kyc->requirement_row = aml_kyc_row;
}
TALER_merchant_wire_signature_hash (payto_uri, TALER_merchant_wire_signature_hash (payto_uri,
&wire_salt, &wire_salt,
&wh); &wh);