donau

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

commit 165cfdb3dabd97ed7f395d0bef275d3accc2e6bd
parent 9db536dfebb10ebd8993a5fdaca8a8c116931e91
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date:   Wed, 27 Mar 2024 12:43:19 +0100

Merge remote-tracking branch 'refs/remotes/origin/master'

Diffstat:
Msrc/donaudb/0002-donau_receipts_issued.sql | 18++++++++----------
1 file changed, 8 insertions(+), 10 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 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';