From e2ede9ff4f5df733fc89e10d5b61f3867b0479ae Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 11 Sep 2024 12:18:02 -0300 Subject: fix #9156 --- .../aml-backoffice-ui/src/pages/CaseDetails.tsx | 438 +++++++++++---------- 1 file changed, 225 insertions(+), 213 deletions(-) (limited to 'packages/aml-backoffice-ui/src/pages/CaseDetails.tsx') diff --git a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx index 54f979846..88366c1d0 100644 --- a/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx +++ b/packages/aml-backoffice-ui/src/pages/CaseDetails.tsx @@ -22,6 +22,7 @@ import { HttpStatusCode, OperationFail, OperationOk, + PaytoString, TalerError, TalerErrorDetail, TalerExchangeApi, @@ -171,7 +172,7 @@ export function getEventsFromAmlHistory( return ke.sort(selectSooner); } -export function CaseDetails({ account }: { account: string }) { +export function CaseDetails({ account, paytoString }: { account: string, paytoString?: PaytoString }) { const [selected, setSelected] = useState(AbsoluteTime.now()); const [showForm, setShowForm] = useState<{ justification: Justification; @@ -273,6 +274,7 @@ export function CaseDetails({ account }: { account: string }) { onClick={async () => { if (!session) return; lib.exchange.makeAmlDesicion(session, { + payto_uri: paytoString, decision_time: AbsoluteTime.toProtocolTimestamp( AbsoluteTime.now(), ), @@ -298,6 +300,7 @@ export function CaseDetails({ account }: { account: string }) { onClick={async () => { if (!session) return; lib.exchange.makeAmlDesicion(session, { + payto_uri: paytoString, decision_time: AbsoluteTime.toProtocolTimestamp( AbsoluteTime.now(), ), @@ -323,6 +326,7 @@ export function CaseDetails({ account }: { account: string }) { onClick={async () => { if (!session) return; lib.exchange.makeAmlDesicion(session, { + payto_uri: paytoString, decision_time: AbsoluteTime.toProtocolTimestamp( AbsoluteTime.now(), ), @@ -348,6 +352,7 @@ export function CaseDetails({ account }: { account: string }) { onClick={async () => { if (!session) return; lib.exchange.makeAmlDesicion(session, { + payto_uri: paytoString, decision_time: AbsoluteTime.toProtocolTimestamp( AbsoluteTime.now(), ), @@ -385,24 +390,28 @@ export function CaseDetails({ account }: { account: string }) {

KYC collection events

- { - switch (e.type) { - case "aml-form": { - // const { justification, metadata } = e; - // setShowForm({ justification, metadata }); - break; + {events.length === 0 ? + + : + { + switch (e.type) { + case "aml-form": { + // const { justification, metadata } = e; + // setShowForm({ justification, metadata }); + break; + } + case "kyc-collection": + case "kyc-expiration": { + setSelected(e.when); + break; + } + case "aml-form-error": } - case "kyc-collection": - case "kyc-expiration": { - setSelected(e.when); - break; - } - case "aml-form-error": - } - }} - /> + }} + /> + } {/* {selected && } */} {selected && } {restDecisions.length > 0 ? ( @@ -415,7 +424,10 @@ export function CaseDetails({ account }: { account: string }) { })} ) : ( -
+ !activeDecision ? +
+ +
: undefined )}
); @@ -569,11 +581,11 @@ function ShowDecisionInfo({ {r.timeframe.d_us === "forever" ? "" : formatDuration( - intervalToDuration({ - start: 0, - end: r.timeframe.d_us / 1000, - }), - )} + intervalToDuration({ + start: 0, + end: r.timeframe.d_us / 1000, + }), + )} - config.currency_specification.num_fractional_input_digits + config.currency_specification.num_fractional_input_digits ) { e.currentTarget.value = e.currentTarget.value.substring( 0, sep_pos + - config.currency_specification.num_fractional_input_digits + - 1, + config.currency_specification.num_fractional_input_digits + + 1, ); } onChange(e.currentTarget.value); @@ -852,9 +864,9 @@ function parseJustification( listOfAllKnownForms: FormMetadata[], ): | OperationOk<{ - justification: Justification; - metadata: FormMetadata; - }> + justification: Justification; + metadata: FormMetadata; + }> | OperationFail { try { const justification = JSON.parse(s); @@ -902,212 +914,212 @@ function parseJustification( const THRESHOLD_2000_WEEK: (currency: string) => TalerExchangeApi.KycRule[] = ( currency, ) => [ - { - operation_type: "WITHDRAW", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "WITHDRAW", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "DEPOSIT", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "DEPOSIT", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "AGGREGATE", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "AGGREGATE", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "MERGE", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "MERGE", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "BALANCE", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "BALANCE", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "CLOSE", - threshold: `${currency}:2000`, - timeframe: { - d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + { + operation_type: "CLOSE", + threshold: `${currency}:2000`, + timeframe: { + d_us: 7 * 24 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, -]; + ]; const THRESHOLD_100_HOUR: (currency: string) => TalerExchangeApi.KycRule[] = ( currency, ) => [ - { - operation_type: "WITHDRAW", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "WITHDRAW", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "DEPOSIT", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "DEPOSIT", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "AGGREGATE", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "AGGREGATE", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "MERGE", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "MERGE", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "BALANCE", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "BALANCE", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "CLOSE", - threshold: `${currency}:100`, - timeframe: { - d_us: 1 * 60 * 60 * 1000 * 1000, + { + operation_type: "CLOSE", + threshold: `${currency}:100`, + timeframe: { + d_us: 1 * 60 * 60 * 1000 * 1000, + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, -]; + ]; const FREEZE_RULES: (currency: string) => TalerExchangeApi.KycRule[] = ( currency, ) => [ - { - operation_type: "WITHDRAW", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "WITHDRAW", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "DEPOSIT", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "DEPOSIT", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "AGGREGATE", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "AGGREGATE", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "MERGE", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "MERGE", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "BALANCE", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "BALANCE", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, - { - operation_type: "CLOSE", - threshold: `${currency}:0`, - timeframe: { - d_us: "forever", + { + operation_type: "CLOSE", + threshold: `${currency}:0`, + timeframe: { + d_us: "forever", + }, + measures: ["verboten"], + display_priority: 1, + exposed: true, + is_and_combinator: true, }, - measures: ["verboten"], - display_priority: 1, - exposed: true, - is_and_combinator: true, - }, -]; + ]; -- cgit v1.2.3