aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-19 10:26:06 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-19 10:26:06 +0100
commit2fd87736b435fbc7426c9fe80c3c5961a3892e1b (patch)
tree54081ad21ed43c884d2bb7679a0b23a208776c42
parent06e2e8022c01f2a2866eb79ed38552ef5ac2a6b2 (diff)
also inform about AML-triggered KYC requirement in GET deposits endpoint
-rw-r--r--src/exchangedb/pg_lookup_transfer_by_deposit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/exchangedb/pg_lookup_transfer_by_deposit.c b/src/exchangedb/pg_lookup_transfer_by_deposit.c
index 63b132f0a..a9de0dd6d 100644
--- a/src/exchangedb/pg_lookup_transfer_by_deposit.c
+++ b/src/exchangedb/pg_lookup_transfer_by_deposit.c
@@ -134,6 +134,7 @@ TEH_PG_lookup_transfer_by_deposit (
do not have a WTID yet. In that case, return without wtid
(by setting 'pending' true). */
uint32_t status32 = TALER_AML_NORMAL;
+ uint64_t aml_kyc_row = 0;
struct GNUNET_PQ_ResultSpec rs2[] = {
GNUNET_PQ_result_spec_auto_from_type ("wire_salt",
&wire_salt),
@@ -143,6 +144,10 @@ TEH_PG_lookup_transfer_by_deposit (
GNUNET_PQ_result_spec_uint64 ("legitimization_requirement_serial_id",
&kyc->requirement_row),
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",
amount_with_fee),
TALER_PQ_RESULT_SPEC_AMOUNT ("fee_deposit",
@@ -168,6 +173,7 @@ TEH_PG_lookup_transfer_by_deposit (
",denom.fee_deposit_frac"
",dep.wire_deadline"
",aml.status"
+ ",aml.kyc_requirement"
" FROM deposits dep"
" JOIN wire_targets wt"
" USING (wire_target_h_payto)"
@@ -195,6 +201,14 @@ TEH_PG_lookup_transfer_by_deposit (
*aml_decision = (enum TALER_AmlDecisionState) status32;
if (0 == kyc->requirement_row)
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,
&wire_salt,
&wh);