gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-exchange] branch master updated: -on conflict update


From: gnunet
Subject: [taler-exchange] branch master updated: -on conflict update
Date: Fri, 17 Nov 2023 08:53:10 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new fcd34935 -on conflict update
fcd34935 is described below

commit fcd3493558dafd0bd667c3918e4a4d583bdc2e08
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Nov 17 08:53:04 2023 +0100

    -on conflict update
---
 src/exchangedb/exchange_do_insert_aml_decision.sql | 16 ++--
 src/include/taler_crypto_lib.h                     | 96 +++++++++++-----------
 2 files changed, 58 insertions(+), 54 deletions(-)

diff --git a/src/exchangedb/exchange_do_insert_aml_decision.sql 
b/src/exchangedb/exchange_do_insert_aml_decision.sql
index 1598a407..f46a73d0 100644
--- a/src/exchangedb/exchange_do_insert_aml_decision.sql
+++ b/src/exchangedb/exchange_do_insert_aml_decision.sql
@@ -32,7 +32,7 @@ AS $$
 BEGIN
 -- Check officer is eligible to make decisions.
 PERFORM
-  FROM exchange.aml_staff
+  FROM aml_staff
   WHERE decider_pub=in_decider_pub
     AND is_active
     AND NOT read_only;
@@ -47,7 +47,7 @@ out_invalid_officer=FALSE;
 -- Check no more recent decision exists.
 SELECT decision_time
   INTO out_last_date
-  FROM exchange.aml_history
+  FROM aml_history
   WHERE h_payto=in_h_payto
   ORDER BY decision_time DESC;
 IF FOUND
@@ -57,7 +57,7 @@ THEN
     -- Refuse to insert older decision.
     RETURN;
   END IF;
-  UPDATE exchange.aml_status
+  UPDATE aml_status
     SET threshold=in_new_threshold
        ,status=in_new_status
        ,kyc_requirement=in_requirement_row
@@ -65,7 +65,7 @@ THEN
   ASSERT FOUND, 'cannot have AML decision history but no AML status';
 ELSE
   out_last_date = 0;
-  INSERT INTO exchange.aml_status
+  INSERT INTO aml_status
     (h_payto
     ,threshold
     ,status
@@ -74,11 +74,15 @@ ELSE
     (in_h_payto
     ,in_new_threshold
     ,in_new_status
-    ,in_requirement_row);
+    ,in_requirement_row)
+    ON CONFLICT (h_payto) DO
+    UPDATE SET
+       threshold=in_new_threshod
+      ,status=in_new_status;
 END IF;
 
 
-INSERT INTO exchange.aml_history
+INSERT INTO aml_history
   (h_payto
   ,new_threshold
   ,new_status
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 7ea44189..2089d77a 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -50,6 +50,54 @@
 #define TALER_CNC_KAPPA_MINUS_ONE_STR "2"
 
 
+/**
+ * Possible AML decision states.
+ */
+enum TALER_AmlDecisionState
+{
+
+  /**
+   * All AML requirements are currently satisfied.
+   */
+  TALER_AML_NORMAL = 0,
+
+  /**
+   * An AML investigation is pending.
+   */
+  TALER_AML_PENDING = 1,
+
+  /**
+   * An AML decision has concluded that the funds must be frozen.
+   */
+  TALER_AML_FROZEN = 2
+
+};
+
+
+/**
+ * Possible algorithms for confirmation code generation.
+ */
+enum TALER_MerchantConfirmationAlgorithm
+{
+
+  /**
+   * No purchase confirmation.
+   */
+  TALER_MCA_NONE = 0,
+
+  /**
+   * Purchase confirmation without payment
+   */
+  TALER_MCA_WITHOUT_PRICE = 1,
+
+  /**
+   * Purchase confirmation with payment
+   */
+  TALER_MCA_WITH_PRICE = 2
+
+};
+
+
 /* ****************** Coin crypto primitives ************* */
 
 GNUNET_NETWORK_STRUCT_BEGIN
@@ -561,54 +609,6 @@ struct TALER_AmlOfficerSignatureP
 };
 
 
-/**
- * Possible AML decision states.
- */
-enum TALER_AmlDecisionState
-{
-
-  /**
-   * All AML requirements are currently satisfied.
-   */
-  TALER_AML_NORMAL = 0,
-
-  /**
-   * An AML investigation is pending.
-   */
-  TALER_AML_PENDING = 1,
-
-  /**
-   * An AML decision has concluded that the funds must be frozen.
-   */
-  TALER_AML_FROZEN = 2
-
-};
-
-
-/**
- * Possible algorithms for confirmation code generation.
- */
-enum TALER_MerchantConfirmationAlgorithm
-{
-
-  /**
-   * No purchase confirmation.
-   */
-  TALER_MCA_NONE = 0,
-
-  /**
-   * Purchase confirmation without payment
-   */
-  TALER_MCA_WITHOUT_PRICE = 1,
-
-  /**
-   * Purchase confirmation with payment
-   */
-  TALER_MCA_WITH_PRICE = 2
-
-};
-
-
 /**
  * Commitment value for the refresh protocol.
  * See #TALER_refresh_get_commitment().

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]