summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-12 15:21:32 -0400
committerJonathan Buchanan <jonathan.russ.buchanan@gmail.com>2020-06-12 15:21:32 -0400
commit3f2b7316255c1a583c7720b3e7624ab16d4378b2 (patch)
tree492b8a3f25d7d717a6bdd41cea88855d948f05f7 /src/backenddb
parent853a2c3d113a36972c63b1b83c22c8292e9740b9 (diff)
downloadmerchant-3f2b7316255c1a583c7720b3e7624ab16d4378b2.tar.gz
merchant-3f2b7316255c1a583c7720b3e7624ab16d4378b2.tar.bz2
merchant-3f2b7316255c1a583c7720b3e7624ab16d4378b2.zip
moved yna to exchange
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c52
-rw-r--r--src/backenddb/test_merchantdb.c60
2 files changed, 56 insertions, 56 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 827874d4..ac180443 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1224,9 +1224,9 @@ postgres_lookup_orders (void *cls,
enum GNUNET_DB_QueryStatus qs;
char stmt[128];
- paid = (TALER_MERCHANTDB_YNA_YES == of->paid);
- refunded = (TALER_MERCHANTDB_YNA_YES == of->refunded);
- wired = (TALER_MERCHANTDB_YNA_YES == of->wired);
+ paid = (TALER_EXCHANGE_YNA_YES == of->paid);
+ refunded = (TALER_EXCHANGE_YNA_YES == of->refunded);
+ wired = (TALER_EXCHANGE_YNA_YES == of->wired);
/* painfully many cases..., note that "_xxx" being present in 'stmt' merely
means that we filter by that variable, the value we filter for is
computed above */
@@ -1234,10 +1234,10 @@ postgres_lookup_orders (void *cls,
sizeof (stmt),
"lookup_orders_%s%s%s%s",
(of->delta > 0) ? "inc" : "dec",
- (TALER_MERCHANTDB_YNA_ALL == of->paid) ? "" : "_paid",
- (TALER_MERCHANTDB_YNA_ALL == of->refunded) ? "" :
+ (TALER_EXCHANGE_YNA_ALL == of->paid) ? "" : "_paid",
+ (TALER_EXCHANGE_YNA_ALL == of->refunded) ? "" :
"_refunded",
- (TALER_MERCHANTDB_YNA_ALL == of->wired) ? "" : "_wired");
+ (TALER_EXCHANGE_YNA_ALL == of->wired) ? "" : "_wired");
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
stmt,
params,
@@ -3858,7 +3858,7 @@ struct LookupTransfersContext
/**
* Filter to apply by verification status.
*/
- enum TALER_MERCHANTDB_YesNoAll verified;
+ enum TALER_EXCHANGE_YesNoAll verified;
};
@@ -3886,7 +3886,7 @@ lookup_transfers_cb (void *cls,
char *exchange_url;
uint64_t transfer_serial_id;
struct GNUNET_TIME_Absolute execution_time;
- enum TALER_MERCHANTDB_YesNoAll verified;
+ enum TALER_EXCHANGE_YesNoAll verified;
uint8_t verified8;
uint8_t confirmed8;
struct GNUNET_PQ_ResultSpec rs[] = {
@@ -3919,10 +3919,10 @@ lookup_transfers_cb (void *cls,
return;
}
if (0 == verified8)
- verified = TALER_MERCHANTDB_YNA_NO;
+ verified = TALER_EXCHANGE_YNA_NO;
else
- verified = TALER_MERCHANTDB_YNA_YES;
- if ( (ltc->verified == TALER_MERCHANTDB_YNA_ALL) ||
+ verified = TALER_EXCHANGE_YNA_YES;
+ if ( (ltc->verified == TALER_EXCHANGE_YNA_ALL) ||
(ltc->verified == verified) )
{
ltc->qs = i + 1;
@@ -3933,7 +3933,7 @@ lookup_transfers_cb (void *cls,
exchange_url,
transfer_serial_id,
execution_time,
- TALER_MERCHANTDB_YNA_YES == verified,
+ TALER_EXCHANGE_YNA_YES == verified,
0 != confirmed8);
}
GNUNET_PQ_cleanup_result (rs);
@@ -3969,7 +3969,7 @@ postgres_lookup_transfers (void *cls,
struct GNUNET_TIME_Absolute after,
int64_t limit,
uint64_t offset,
- enum TALER_MERCHANTDB_YesNoAll verified,
+ enum TALER_EXCHANGE_YesNoAll verified,
TALER_MERCHANTDB_TransferCallback cb,
void *cb_cls)
{
@@ -4246,13 +4246,13 @@ struct LookupReservesContext
/**
* Filter by active reserves.
*/
- enum TALER_MERCHANTDB_YesNoAll active;
+ enum TALER_EXCHANGE_YesNoAll active;
/**
* Filter by failures (missmatch in exchange claimed and
* merchant claimed initial amounts).
*/
- enum TALER_MERCHANTDB_YesNoAll failures;
+ enum TALER_EXCHANGE_YesNoAll failures;
/**
* Set in case of errors.
@@ -4319,28 +4319,28 @@ lookup_reserves_cb (void *cls,
}
switch (lrc->active)
{
- case TALER_MERCHANTDB_YNA_YES:
+ case TALER_EXCHANGE_YNA_YES:
if (! active)
continue;
- case TALER_MERCHANTDB_YNA_NO:
+ case TALER_EXCHANGE_YNA_NO:
if (active)
continue;
- case TALER_MERCHANTDB_YNA_ALL:
+ case TALER_EXCHANGE_YNA_ALL:
break;
}
switch (lrc->failures)
{
- case TALER_MERCHANTDB_YNA_YES:
+ case TALER_EXCHANGE_YNA_YES:
if (0 ==
TALER_amount_cmp (&merchant_initial_balance,
&exchange_initial_balance))
continue;
- case TALER_MERCHANTDB_YNA_NO:
+ case TALER_EXCHANGE_YNA_NO:
if (0 !=
TALER_amount_cmp (&merchant_initial_balance,
&exchange_initial_balance))
continue;
- case TALER_MERCHANTDB_YNA_ALL:
+ case TALER_EXCHANGE_YNA_ALL:
break;
}
lrc->cb (lrc->cb_cls,
@@ -4372,8 +4372,8 @@ static enum GNUNET_DB_QueryStatus
postgres_lookup_reserves (void *cls,
const char *instance_id,
struct GNUNET_TIME_Absolute created_after,
- enum TALER_MERCHANTDB_YesNoAll active,
- enum TALER_MERCHANTDB_YesNoAll failures,
+ enum TALER_EXCHANGE_YesNoAll active,
+ enum TALER_EXCHANGE_YesNoAll failures,
TALER_MERCHANTDB_ReservesCallback cb,
void *cb_cls)
{
@@ -5246,7 +5246,7 @@ lookup_tips_cb (void *cls,
static enum GNUNET_DB_QueryStatus
postgres_lookup_tips (void *cls,
const char *instance_id,
- enum TALER_MERCHANTDB_YesNoAll expired,
+ enum TALER_EXCHANGE_YesNoAll expired,
int64_t limit,
uint64_t offset,
TALER_MERCHANTDB_TipsCallback cb,
@@ -5272,12 +5272,12 @@ postgres_lookup_tips (void *cls,
enum GNUNET_DB_QueryStatus qs;
char stmt[128];
- bexpired = (TALER_MERCHANTDB_YNA_YES == expired);
+ bexpired = (TALER_EXCHANGE_YNA_YES == expired);
GNUNET_snprintf (stmt,
sizeof (stmt),
"lookup_tips_%s%s",
(limit > 0) ? "inc" : "dec",
- (TALER_MERCHANTDB_YNA_ALL == expired) ? "" : "_expired");
+ (TALER_EXCHANGE_YNA_ALL == expired) ? "" : "_expired");
qs = GNUNET_PQ_eval_prepared_multi_select (pg->conn,
stmt,
params,
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 658c4c62..43208e89 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -1320,9 +1320,9 @@ static int
run_test_orders (struct TestOrders_Closure *cls)
{
struct TALER_MERCHANTDB_OrderFilter filter = {
- .paid = TALER_MERCHANTDB_YNA_ALL,
- .refunded = TALER_MERCHANTDB_YNA_ALL,
- .wired = TALER_MERCHANTDB_YNA_ALL,
+ .paid = TALER_EXCHANGE_YNA_ALL,
+ .refunded = TALER_EXCHANGE_YNA_ALL,
+ .wired = TALER_EXCHANGE_YNA_ALL,
.date = GNUNET_TIME_absolute_get_zero_ (),
.start_row = 0,
.delta = 8
@@ -1434,7 +1434,7 @@ run_test_orders (struct TestOrders_Closure *cls)
TEST_RET_ON_FAIL (test_lookup_order_status (&cls->instance,
&cls->orders[0],
true));
- filter.paid = TALER_MERCHANTDB_YNA_YES;
+ filter.paid = TALER_EXCHANGE_YNA_YES;
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,
&filter,
1,
@@ -2381,7 +2381,7 @@ test_lookup_transfers (const char *instance_id,
struct GNUNET_TIME_Absolute after,
int64_t limit,
uint64_t offset,
- enum TALER_MERCHANTDB_YesNoAll filter_verified,
+ enum TALER_EXCHANGE_YesNoAll filter_verified,
unsigned int transfers_length,
const struct TransferWithDetails *transfers)
{
@@ -2649,7 +2649,7 @@ run_test_transfers (struct TestTransfers_Closure *cls)
GNUNET_TIME_UNIT_ZERO_ABS,
1,
0,
- TALER_MERCHANTDB_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
1,
&full_transfer_data));
@@ -2876,8 +2876,8 @@ test_lookup_reserves (const char *instance_id,
if (1 != plugin->lookup_reserves (plugin->cls,
instance_id,
GNUNET_TIME_absolute_get_zero_ (),
- TALER_MERCHANTDB_YNA_ALL,
- TALER_MERCHANTDB_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
&lookup_reserves_cb,
&cmp))
{
@@ -3221,7 +3221,7 @@ lookup_tips_cb (void *cls,
static int
test_lookup_tips (const struct InstanceData *instance,
- enum TALER_MERCHANTDB_YesNoAll expired,
+ enum TALER_EXCHANGE_YesNoAll expired,
int64_t limit,
uint64_t offset,
unsigned int tips_length,
@@ -3449,7 +3449,7 @@ run_test_tips (struct TestTips_Closure *cls)
"Authorize tip failed\n");
/* Test lookup tips */
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
1,
0,
1,
@@ -3493,7 +3493,7 @@ run_test_tips (struct TestTips_Closure *cls)
sizeof (struct TipData) * 5);
/* Test lookup tips inc */
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
6,
0,
6,
@@ -3502,7 +3502,7 @@ run_test_tips (struct TestTips_Closure *cls)
expected_tips);
/* Test lookup tips dec */
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_ALL,
+ TALER_EXCHANGE_YNA_ALL,
-6,
10,
6,
@@ -3512,7 +3512,7 @@ run_test_tips (struct TestTips_Closure *cls)
expected_tips[1] = cls->tips[2];
expected_tips[2] = cls->tips[4];
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_YES,
+ TALER_EXCHANGE_YNA_YES,
6,
0,
3,
@@ -3521,7 +3521,7 @@ run_test_tips (struct TestTips_Closure *cls)
reverse_tip_data_array (3,
expected_tips);
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_YES,
+ TALER_EXCHANGE_YNA_YES,
-6,
10,
3,
@@ -3531,7 +3531,7 @@ run_test_tips (struct TestTips_Closure *cls)
expected_tips[1] = cls->tips[1];
expected_tips[2] = cls->tips[3];
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_NO,
+ TALER_EXCHANGE_YNA_NO,
6,
0,
3,
@@ -3540,7 +3540,7 @@ run_test_tips (struct TestTips_Closure *cls)
reverse_tip_data_array (3,
expected_tips);
TEST_RET_ON_FAIL (test_lookup_tips (&cls->instance,
- TALER_MERCHANTDB_YNA_NO,
+ TALER_EXCHANGE_YNA_NO,
-6,
10,
3,
@@ -4134,17 +4134,17 @@ run_test_lookup_orders_all_filters (struct
/* Order filter extravaganza */
struct OrderData expected_orders[16];
struct TALER_MERCHANTDB_OrderFilter filter_inc = {
- .paid = TALER_MERCHANTDB_YNA_ALL,
- .refunded = TALER_MERCHANTDB_YNA_ALL,
- .wired = TALER_MERCHANTDB_YNA_ALL,
+ .paid = TALER_EXCHANGE_YNA_ALL,
+ .refunded = TALER_EXCHANGE_YNA_ALL,
+ .wired = TALER_EXCHANGE_YNA_ALL,
.date = GNUNET_TIME_absolute_get_zero_ (),
.start_row = 0,
.delta = 16
};
struct TALER_MERCHANTDB_OrderFilter filter_dec = {
- .paid = TALER_MERCHANTDB_YNA_ALL,
- .refunded = TALER_MERCHANTDB_YNA_ALL,
- .wired = TALER_MERCHANTDB_YNA_ALL,
+ .paid = TALER_EXCHANGE_YNA_ALL,
+ .refunded = TALER_EXCHANGE_YNA_ALL,
+ .wired = TALER_EXCHANGE_YNA_ALL,
.date = GNUNET_TIME_UNIT_FOREVER_ABS,
.start_row = 23, /* Why does this need to be 20 and not 18? */
.delta = -16
@@ -4205,7 +4205,7 @@ run_test_lookup_orders_all_filters (struct
16,
expected_orders));
/* lookup_orders_inc_paid */
- filter_inc.paid = TALER_MERCHANTDB_YNA_YES;
+ filter_inc.paid = TALER_EXCHANGE_YNA_YES;
for (unsigned int i = 0; i < 8; ++i)
expected_orders[i] = cls->orders[2 * i];
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,
@@ -4213,7 +4213,7 @@ run_test_lookup_orders_all_filters (struct
8,
expected_orders));
/* lookup_orders_dec_paid */
- filter_dec.paid = TALER_MERCHANTDB_YNA_YES;
+ filter_dec.paid = TALER_EXCHANGE_YNA_YES;
reverse_order_data_array (8,
expected_orders);
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,
@@ -4221,8 +4221,8 @@ run_test_lookup_orders_all_filters (struct
8,
expected_orders));
/* lookup_orders_inc_refunded */
- filter_inc.paid = TALER_MERCHANTDB_YNA_ALL;
- filter_inc.refunded = TALER_MERCHANTDB_YNA_YES;
+ filter_inc.paid = TALER_EXCHANGE_YNA_ALL;
+ filter_inc.refunded = TALER_EXCHANGE_YNA_YES;
unsigned int indices[] = {
0, 1, 4, 8, 12
};
@@ -4235,8 +4235,8 @@ run_test_lookup_orders_all_filters (struct
5,
expected_orders));
/* lookup_orders_dec_refunded */
- filter_dec.paid = TALER_MERCHANTDB_YNA_ALL;
- filter_dec.refunded = TALER_MERCHANTDB_YNA_YES;
+ filter_dec.paid = TALER_EXCHANGE_YNA_ALL;
+ filter_dec.refunded = TALER_EXCHANGE_YNA_YES;
reverse_order_data_array (5,
expected_orders);
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,
@@ -4246,7 +4246,7 @@ run_test_lookup_orders_all_filters (struct
/* lookup_orders_inc_wired */
/* lookup_orders_dec_wired */
/* lookup_orders_inc_paid_refunded */
- filter_inc.paid = TALER_MERCHANTDB_YNA_YES;
+ filter_inc.paid = TALER_EXCHANGE_YNA_YES;
for (unsigned int i = 0; i < 4; ++i)
expected_orders[i] = cls->orders[4 * i];
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,
@@ -4254,7 +4254,7 @@ run_test_lookup_orders_all_filters (struct
4,
expected_orders));
/* lookup_orders_dec_paid_refunded */
- filter_dec.paid = TALER_MERCHANTDB_YNA_YES;
+ filter_dec.paid = TALER_EXCHANGE_YNA_YES;
reverse_order_data_array (4,
expected_orders);
TEST_RET_ON_FAIL (test_lookup_orders (&cls->instance,