diff options
Diffstat (limited to 'src/testing/testing_api_trait_payment_secret.c')
-rw-r--r-- | src/testing/testing_api_trait_payment_secret.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/testing/testing_api_trait_payment_secret.c b/src/testing/testing_api_trait_payment_secret.c new file mode 100644 index 0000000..6238879 --- /dev/null +++ b/src/testing/testing_api_trait_payment_secret.c | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | This file is part of TALER | ||
3 | Copyright (C) 2019 Taler Systems SA | ||
4 | |||
5 | TALER is free software; you can redistribute it and/or modify it | ||
6 | under the terms of the GNU General Public License as published | ||
7 | by the Free Software Foundation; either version 3, or (at your | ||
8 | option) any later version. | ||
9 | |||
10 | TALER is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public | ||
16 | License along with TALER; see the file COPYING. If not, see | ||
17 | <http://www.gnu.org/licenses/> | ||
18 | */ | ||
19 | /** | ||
20 | * @file lib/testing_api_trait_payment_secret.c | ||
21 | * @brief traits to offer a payment identifier | ||
22 | * @author Dennis Neufeld | ||
23 | */ | ||
24 | #include "platform.h" | ||
25 | #include "anastasis_testing_lib.h" | ||
26 | |||
27 | #define ANASTASIS_TESTING_TRAIT_PAYMENT_SECRET \ | ||
28 | "anastasis-payment_secret" | ||
29 | |||
30 | |||
31 | /** | ||
32 | * Obtain an account public key from @a cmd. | ||
33 | * | ||
34 | * @param cmd command to extract the payment identifier from. | ||
35 | * @param index the payment identifier's index number. | ||
36 | * @param n[out] set to the payment identifier coming from @a cmd. | ||
37 | * @return #GNUNET_OK on success. | ||
38 | */ | ||
39 | int | ||
40 | ANASTASIS_TESTING_get_trait_payment_secret | ||
41 | (const struct TALER_TESTING_Command *cmd, | ||
42 | unsigned int index, | ||
43 | const struct ANASTASIS_PaymentSecretP **payment_secret) | ||
44 | { | ||
45 | return cmd->traits (cmd->cls, | ||
46 | (const void **) payment_secret, | ||
47 | ANASTASIS_TESTING_TRAIT_PAYMENT_SECRET, | ||
48 | index); | ||
49 | } | ||
50 | |||
51 | |||
52 | /** | ||
53 | * Offer a payment identifier. | ||
54 | * | ||
55 | * @param index usually zero | ||
56 | * @param h the payment identifier to offer. | ||
57 | * @return #GNUNET_OK on success. | ||
58 | */ | ||
59 | struct TALER_TESTING_Trait | ||
60 | ANASTASIS_TESTING_make_trait_payment_secret | ||
61 | (unsigned int index, | ||
62 | const struct ANASTASIS_PaymentSecretP *h) | ||
63 | { | ||
64 | struct TALER_TESTING_Trait ret = { | ||
65 | .index = index, | ||
66 | .trait_name = ANASTASIS_TESTING_TRAIT_PAYMENT_SECRET, | ||
67 | .ptr = (const void *) h | ||
68 | }; | ||
69 | return ret; | ||
70 | } | ||
71 | |||
72 | |||
73 | /* end of testing_api_trait_payment_secret.c */ | ||