commit f811e37f7dcd93137b8c96323a0f48c0536a2d19
parent cc61d5087ef79bfec8bc1ec0e8352f17cec2806a
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Wed, 17 Apr 2024 11:01:55 +0200
[donaudb] small changes
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/donaudb/0002-donau_receipts_issued.sql b/src/donaudb/0002-donau_receipts_issued.sql
@@ -32,7 +32,7 @@ COMMENT ON COLUMN receipts_issued.receipt_hash
CREATE OR REPLACE FUNCTION transaction_save_issue_receipts_request(
IN charity_id BIGINT -- charity id which made the issue receitps request
--,IN blinded_sig BYTEA[] -- blinded signatures
- ,IN receipt_hash BYTEA -- hash over all budi key pairs (primary key)
+ ,IN receipt_h 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
,OUT out_receipt_id BIGINT
@@ -43,9 +43,9 @@ 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');
+INSERT INTO receipts_issued (/*blinded_sig,*/ charity_id, receipt_h, amount) VALUES (/*'blinded_sig',*/ 'charity_id', 'receipts_hash', 'amount');
-- Get the receipts id
-SELECT receipt_id into out_receipt_id FROM receipts_issued;
+SELECT receipt_id into out_receipt_id FROM receipts_issued WHERE receipt_hash=receipt_h;
-- Commit the transaction if everything is successful
END $$;
COMMIT;