[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] 01/07: daily pull
From: |
gnunet |
Subject: |
[taler-merchant] 01/07: daily pull |
Date: |
Wed, 29 Mar 2023 16:39:48 +0200 |
This is an automated email from the git hooks/post-receive script.
priscilla-huang pushed a commit to branch master
in repository merchant.
commit 702d2fc2346ea7d1829eac70928d6362235eea20
Author: priscilla <priscilla.huang@efrei.net>
AuthorDate: Fri Mar 3 05:26:52 2023 -0500
daily pull
---
src/testing/test_merchant_api.c | 33 ++++++++++++++++++++--
src/testing/testing_api_cmd_get_template.c | 21 ++++++++++++++
src/testing/testing_api_cmd_patch_template.c | 10 ++++++-
src/testing/testing_api_cmd_pay_order.c | 2 ++
src/testing/testing_api_cmd_post_templates.c | 11 +++++++-
src/testing/testing_api_cmd_post_using_templates.c | 3 +-
6 files changed, 75 insertions(+), 5 deletions(-)
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 8509f6aa..c4853fd4 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -110,6 +110,13 @@ static char *merchant_url_i1a;
*/
static struct GNUNET_OS_Process *merchantd;
+/**
+ * total for totp
+ */
+static struct TALER_Amount *total;
+enum GNUNET_Generic_ReturnValue TALER_string_to_amount ("EUR:10.0",
+ total);
+
/**
* Account number of the exchange at the bank.
*/
@@ -1327,6 +1334,13 @@ run (void *cls,
merchant_url,
MHD_HTTP_OK,
NULL),
+ TALER_TESTING_cmd_merchant_post_orders ("create-proposal-10",
+ merchant_url,
+ MHD_HTTP_OK,
+ "100",
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
+ "EUR:10.0"),
TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1",
merchant_url,
"template-1",
@@ -1362,7 +1376,8 @@ run (void *cls,
merchant_url,
"template-2",
"another template",
- "data:image/jpeg;base64,RAWDATA",
+ NULL,
+ TALER_MCA_WITH_PRICE,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1383,7 +1398,8 @@ run (void *cls,
merchant_url,
"template-3",
"updated template",
- "data:image/jpeg;base64,RAWDATA",
+ NULL,
+ TALER_MCA_WITH_PRICE,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1395,6 +1411,7 @@ run (void *cls,
"template-amount",
"a different template with an amount",
NULL,
+ TALER_MCA_WITHOUT_PRICE,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
@@ -1437,6 +1454,18 @@ run (void *cls,
"summary-1",
"EUR:4",
MHD_HTTP_CONFLICT),
+ TALER_TESTING_cmd_merchant_pay_order ("pay-100",
+ merchant_url,
+ MHD_HTTP_OK,
+ "create-proposal-100",
+
"withdraw-coin-10a;withdraw-coin-10b",
+ "EUR:5",
+ "EUR:4.99",
+ NULL),
+ TALER_build_pos_confirmation ("pos1test",
+ TALER_MCA_WITH_PRICE,
+ total,
+ GNUNET_TIME_timestamp_get()),
TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty",
merchant_url,
"t1",
diff --git a/src/testing/testing_api_cmd_get_template.c
b/src/testing/testing_api_cmd_get_template.c
index 8b32156d..412c52c0 100644
--- a/src/testing/testing_api_cmd_get_template.c
+++ b/src/testing/testing_api_cmd_get_template.c
@@ -135,6 +135,27 @@ get_template_cb (void *cls,
return;
}
}
+ {
+ const enum TALER_MerchantConfirmationAlgorithm *expected_pos_alg;
+ const enum TALER_MerchantConfirmationAlgorithm pos_alg =
tgr->details.success.pos_alg;
+
+ if (GNUNET_OK !=
+ TALER_TESTING_get_trait_template_pos_alg (template_cmd,
+ &expected_pos_alg))
+ TALER_TESTING_interpreter_fail (gis->is);
+ if ( ( (0 == pos_alg) && (0 != *expected_pos_alg)) ||
+ ( (0 != pos_alg) && (0 == *expected_pos_alg)) ||
+ ( (0 != pos_alg) &&
+ (pos_alg != *expected_pos_alg)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Template pos_alg `%d' does not match `%d'\n",
+ pos_alg,
+ *expected_pos_alg);
+ TALER_TESTING_interpreter_fail (gis->is);
+ return;
+ }
+ }
{
const json_t *expected_template_contract;
diff --git a/src/testing/testing_api_cmd_patch_template.c
b/src/testing/testing_api_cmd_patch_template.c
index 81560fa7..bc260c00 100644
--- a/src/testing/testing_api_cmd_patch_template.c
+++ b/src/testing/testing_api_cmd_patch_template.c
@@ -64,6 +64,11 @@ struct PatchTemplateState
*/
char *pos_key;
+ /**
+ * Option that add amount of the order
+ */
+ enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
/**
* Contract of the company
*/
@@ -142,7 +147,7 @@ patch_template_run (void *cls,
pis->template_id,
pis->template_description,
pis->pos_key,
- TALER_MCA_NONE,
+ pis->pos_alg,
pis->template_contract,
&patch_template_cb,
pis);
@@ -171,6 +176,7 @@ patch_template_traits (void *cls,
TALER_TESTING_make_trait_template_description (&pts->template_description),
TALER_TESTING_make_trait_template_pos_key (
(const char **) &pts->pos_key),
+ TALER_TESTING_make_trait_template_pos_alg (&pts->pos_alg),
TALER_TESTING_make_trait_template_contract (pts->template_contract),
TALER_TESTING_make_trait_template_id (&pts->template_id),
TALER_TESTING_trait_end (),
@@ -215,6 +221,7 @@ TALER_TESTING_cmd_merchant_patch_template (
const char *template_id,
const char *template_description,
const char *pos_key,
+ const enum TALER_MerchantConfirmationAlgorithm pos_alg,
json_t *template_contract,
unsigned int http_status)
{
@@ -226,6 +233,7 @@ TALER_TESTING_cmd_merchant_patch_template (
pis->http_status = http_status;
pis->template_description = template_description;
pis->pos_key = (NULL == pos_key) ? NULL : GNUNET_strdup (pos_key);
+ pis->pos_alg = pos_alg;
pis->template_contract = template_contract; /* ownership taken */
{
struct TALER_TESTING_Command cmd = {
diff --git a/src/testing/testing_api_cmd_pay_order.c
b/src/testing/testing_api_cmd_pay_order.c
index cd589965..5ec9e46b 100644
--- a/src/testing/testing_api_cmd_pay_order.c
+++ b/src/testing/testing_api_cmd_pay_order.c
@@ -239,6 +239,8 @@ pay_cb (void *cls,
if (MHD_HTTP_OK == pr->hr.http_status)
{
ps->merchant_sig = pr->details.success.merchant_sig;
+ // FIXME: check if pr->details.success.pos_confirmation;
+ // for that, get pos_secret from ps->proposal_reference CMD and amount
from pay/order creation cmd using traits
}
TALER_TESTING_interpreter_next (ps->is);
}
diff --git a/src/testing/testing_api_cmd_post_templates.c
b/src/testing/testing_api_cmd_post_templates.c
index 39728792..2def21ea 100644
--- a/src/testing/testing_api_cmd_post_templates.c
+++ b/src/testing/testing_api_cmd_post_templates.c
@@ -64,6 +64,11 @@ struct PostTemplatesState
*/
char *pos_key;
+ /**
+ * Option that add amount of the order
+ */
+ enum TALER_MerchantConfirmationAlgorithm pos_alg;
+
/**
* Contract of the company
*/
@@ -141,7 +146,7 @@ post_templates_run (void *cls,
tis->template_id,
tis->template_description,
tis->pos_key,
- TALER_MCA_NONE,
+ tis->pos_alg,
tis->template_contract,
&post_templates_cb,
tis);
@@ -175,6 +180,7 @@ post_templates_traits (void *cls,
TALER_TESTING_make_trait_template_description (&pts->template_description),
TALER_TESTING_make_trait_template_pos_key (
(const char **) &pts->pos_key),
+ TALER_TESTING_make_trait_template_pos_alg (&pts->pos_alg),
TALER_TESTING_make_trait_template_contract (pts->template_contract),
TALER_TESTING_make_trait_template_id (&pts->template_id),
TALER_TESTING_trait_end (),
@@ -219,6 +225,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
const char *template_id,
const char *template_description,
const char *pos_key,
+ const enum TALER_MerchantConfirmationAlgorithm pos_alg,
json_t *template_contract,
unsigned int http_status)
{
@@ -233,6 +240,7 @@ TALER_TESTING_cmd_merchant_post_templates2 (
tis->http_status = http_status;
tis->template_description = template_description;
tis->pos_key = (NULL == pos_key) ? NULL : GNUNET_strdup (pos_key);
+ tis->pos_alg = pos_alg;
tis->template_contract = template_contract;
{
struct TALER_TESTING_Command cmd = {
@@ -261,6 +269,7 @@ TALER_TESTING_cmd_merchant_post_templates (const char
*label,
template_id,
template_description,
NULL,
+ TALER_MCA_WITHOUT_PRICE,
GNUNET_JSON_PACK (
GNUNET_JSON_pack_uint64 ("minimum_age", 0),
GNUNET_JSON_pack_time_rel ("pay_duration",
diff --git a/src/testing/testing_api_cmd_post_using_templates.c
b/src/testing/testing_api_cmd_post_using_templates.c
index 956a421a..137c7df1 100644
--- a/src/testing/testing_api_cmd_post_using_templates.c
+++ b/src/testing/testing_api_cmd_post_using_templates.c
@@ -209,7 +209,8 @@ TALER_TESTING_cmd_merchant_post_using_templates (
const char *template_ref,
const char *merchant_url,
const char *summary,
- const char *amount, unsigned int http_status)
+ const char *amount,
+ unsigned int http_status)
{
struct PostUsingTemplatesState *tis;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-merchant] branch master updated (3fa7d3be -> 4e207441), gnunet, 2023/03/29
- [taler-merchant] 02/07: update of the test TOTP but not finish, gnunet, 2023/03/29
- [taler-merchant] 07/07: update pay order / using templates for test case totp, gnunet, 2023/03/29
- [taler-merchant] 03/07: update of the test TOTP but not finish, gnunet, 2023/03/29
- [taler-merchant] 01/07: daily pull,
gnunet <=
- [taler-merchant] 05/07: pull, gnunet, 2023/03/29
- [taler-merchant] 04/07: pull, gnunet, 2023/03/29
- [taler-merchant] 06/07: pull, gnunet, 2023/03/29