a first step towards normalizing the DB a bit and not storing data redundantly
This commit is contained in:
parent
2f5e58f3c7
commit
172e8494b9
@ -376,9 +376,6 @@ postgres_create_tables (void *cls)
|
|||||||
",amount_with_fee_val INT8 NOT NULL"
|
",amount_with_fee_val INT8 NOT NULL"
|
||||||
",amount_with_fee_frac INT4 NOT NULL"
|
",amount_with_fee_frac INT4 NOT NULL"
|
||||||
",amount_with_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
",amount_with_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
||||||
",refund_fee_val INT8 NOT NULL"
|
|
||||||
",refund_fee_frac INT4 NOT NULL"
|
|
||||||
",refund_fee_curr VARCHAR("TALER_CURRENCY_LEN_STR") NOT NULL"
|
|
||||||
",PRIMARY KEY (coin_pub, merchant_pub, transaction_id, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */
|
",PRIMARY KEY (coin_pub, merchant_pub, transaction_id, rtransaction_id)" /* this combo must be unique, and we usually select by coin_pub */
|
||||||
") ");
|
") ");
|
||||||
|
|
||||||
@ -814,10 +811,12 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
",amount_with_fee_val"
|
",amount_with_fee_val"
|
||||||
",amount_with_fee_frac"
|
",amount_with_fee_frac"
|
||||||
",amount_with_fee_curr"
|
",amount_with_fee_curr"
|
||||||
",refund_fee_val "
|
",denom.fee_refund_val "
|
||||||
",refund_fee_frac "
|
",denom.fee_refund_frac "
|
||||||
",refund_fee_curr "
|
",denom.fee_refund_curr "
|
||||||
" FROM refunds"
|
" FROM refunds"
|
||||||
|
" JOIN known_coins USING (coin_pub)"
|
||||||
|
" JOIN denominations denom USING (denom_pub)"
|
||||||
" WHERE coin_pub=$1",
|
" WHERE coin_pub=$1",
|
||||||
1, NULL);
|
1, NULL);
|
||||||
|
|
||||||
@ -902,13 +901,9 @@ postgres_prepare (PGconn *db_conn)
|
|||||||
",amount_with_fee_val "
|
",amount_with_fee_val "
|
||||||
",amount_with_fee_frac "
|
",amount_with_fee_frac "
|
||||||
",amount_with_fee_curr "
|
",amount_with_fee_curr "
|
||||||
",refund_fee_val "
|
|
||||||
",refund_fee_frac "
|
|
||||||
",refund_fee_curr "
|
|
||||||
") VALUES "
|
") VALUES "
|
||||||
"($1, $2, $3, $4, $5, $6, $7, $8, $9, $10,"
|
"($1, $2, $3, $4, $5, $6, $7, $8, $9);",
|
||||||
" $11, $12);",
|
9, NULL);
|
||||||
12, NULL);
|
|
||||||
|
|
||||||
/* Fetch an existing deposit request, used to ensure idempotency
|
/* Fetch an existing deposit request, used to ensure idempotency
|
||||||
during /deposit processing. Used in #postgres_have_deposit(). */
|
during /deposit processing. Used in #postgres_have_deposit(). */
|
||||||
@ -2717,7 +2712,6 @@ postgres_insert_refund (void *cls,
|
|||||||
GNUNET_PQ_query_param_uint64 (&refund->transaction_id),
|
GNUNET_PQ_query_param_uint64 (&refund->transaction_id),
|
||||||
GNUNET_PQ_query_param_uint64 (&refund->rtransaction_id),
|
GNUNET_PQ_query_param_uint64 (&refund->rtransaction_id),
|
||||||
TALER_PQ_query_param_amount (&refund->refund_amount),
|
TALER_PQ_query_param_amount (&refund->refund_amount),
|
||||||
TALER_PQ_query_param_amount (&refund->refund_fee),
|
|
||||||
GNUNET_PQ_query_param_end
|
GNUNET_PQ_query_param_end
|
||||||
};
|
};
|
||||||
GNUNET_assert (GNUNET_YES ==
|
GNUNET_assert (GNUNET_YES ==
|
||||||
@ -3791,7 +3785,7 @@ postgres_get_coin_transactions (void *cls,
|
|||||||
&refund->rtransaction_id),
|
&refund->rtransaction_id),
|
||||||
TALER_PQ_result_spec_amount ("amount_with_fee",
|
TALER_PQ_result_spec_amount ("amount_with_fee",
|
||||||
&refund->refund_amount),
|
&refund->refund_amount),
|
||||||
TALER_PQ_result_spec_amount ("refund_fee",
|
TALER_PQ_result_spec_amount ("fee_refund",
|
||||||
&refund->refund_fee),
|
&refund->refund_fee),
|
||||||
GNUNET_PQ_result_spec_end
|
GNUNET_PQ_result_spec_end
|
||||||
};
|
};
|
||||||
|
@ -1276,8 +1276,7 @@ run (void *cls)
|
|||||||
refund.transaction_id = deposit.transaction_id;
|
refund.transaction_id = deposit.transaction_id;
|
||||||
refund.rtransaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
|
refund.rtransaction_id = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
|
||||||
refund.refund_amount = deposit.amount_with_fee;
|
refund.refund_amount = deposit.amount_with_fee;
|
||||||
GNUNET_assert (GNUNET_OK ==
|
refund.refund_fee = fee_refund;
|
||||||
TALER_amount_get_zero (CURRENCY, &refund.refund_fee));
|
|
||||||
FAILIF (GNUNET_OK !=
|
FAILIF (GNUNET_OK !=
|
||||||
plugin->insert_refund (plugin->cls,
|
plugin->insert_refund (plugin->cls,
|
||||||
session,
|
session,
|
||||||
|
Loading…
Reference in New Issue
Block a user