donau

Donation authority for GNU Taler (experimental)
Log | Files | Refs | Submodules | README | LICENSE

commit 102ebdfbc8ecccd738a7fefef1354e13567c6e8c
parent b68d11520c89300cb8f78242b007fabadf26a15d
Author: Casaburi Johannes <johannes.casaburi@students.bfh.ch>
Date:   Wed, 27 Mar 2024 12:40:41 +0100

fix sql

Diffstat:
Msrc/donaudb/0002-donau_receipts_issued.sql | 20+++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/donaudb/0002-donau_receipts_issued.sql b/src/donaudb/0002-donau_receipts_issued.sql @@ -29,26 +29,24 @@ COMMENT ON COLUMN receipts_issued.receipt_hash IS 'Hash value over all the blinded donation receipt received plus the hash of the donation units public key.'; -CREATE FUNCTION transaction_update_current_amount_receipts_save_issue_receipts_request( - IN blinded_sig BYTEA[] NOT NULL -- blinded signatures - ,IN charity_id BIGINT NOT NULL -- charity id which made the issue receitps request - ,IN receipt_hash BYTEA NOT NULL-- hash over all budi key pairs (primary key) - ,IN amount taler_amount NOT NULL -- total amount of the requested receipts - ,IN new_total_amount NOT NULL -- new total amount of a charity +CREATE FUNCTION transaction_save_issue_receipts_request( + IN blinded_sig BYTEA[] -- blinded signatures + ,IN charity_id BIGINT -- charity id which made the issue receitps request + ,IN receipt_hash BYTEA -- hash over all budi key pairs (primary key) + ,IN amount taler_amount -- total amount of the requested receipts + ,IN new_total_amount taler_amount -- new total amount of a charity ) RETURNS VOID ---LANGUAGE plpgsql +LANGUAGE plpgsql AS $$ -BEGIN; - +BEGIN -- Update table charity UPDATE charity SET receipts_to_date = new_total_amount; -- Insert into the table receipts_issued INSERT INTO receipts_issued (blinded_sig, charity_id, receipt_hash, amount) VALUES ('blinded_sig', 'charity_id', 'receipts_hash', 'amount'); - -- Commit the transaction if everything is successful -COMMIT; END $$; +COMMIT; COMMENT ON FUNCTION transaction_save_issue_receipts_request IS 'This is a transaction for updating the current amount of receipts of a year of a charity and saves the receipts request what makes it idempotent';