aboutsummaryrefslogtreecommitdiff
path: root/src/bank-lib/testing_api_cmd_reject.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bank-lib/testing_api_cmd_reject.c')
-rw-r--r--src/bank-lib/testing_api_cmd_reject.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/bank-lib/testing_api_cmd_reject.c b/src/bank-lib/testing_api_cmd_reject.c
index 1f19a379d..8d37266d1 100644
--- a/src/bank-lib/testing_api_cmd_reject.c
+++ b/src/bank-lib/testing_api_cmd_reject.c
@@ -79,14 +79,16 @@ reject_cb (void *cls,
79 { 79 {
80 GNUNET_break (0); 80 GNUNET_break (0);
81 fprintf (stderr, 81 fprintf (stderr,
82 "Unexpected response code %u:\n", 82 "Unexpected response code %u/%d\n",
83 http_status); 83 http_status,
84 (int) ec);
84 TALER_TESTING_interpreter_fail (is); 85 TALER_TESTING_interpreter_fail (is);
85 return; 86 return;
86 } 87 }
87 TALER_TESTING_interpreter_next (is); 88 TALER_TESTING_interpreter_next (is);
88} 89}
89 90
91
90/** 92/**
91 * Cleanup the state of a "reject" CMD, and possibly 93 * Cleanup the state of a "reject" CMD, and possibly
92 * cancel a pending operation thereof. 94 * cancel a pending operation thereof.
@@ -95,21 +97,21 @@ reject_cb (void *cls,
95 * @param cmd the command. 97 * @param cmd the command.
96 */ 98 */
97static void 99static void
98reject_cleanup 100reject_cleanup (void *cls,
99 (void *cls, 101 const struct TALER_TESTING_Command *cmd)
100 const struct TALER_TESTING_Command *cmd)
101{ 102{
102 struct RejectState *rs = cls; 103 struct RejectState *rs = cls;
103 104
105 (void) cmd;
104 if (NULL != rs->rh) 106 if (NULL != rs->rh)
105 { 107 {
106 TALER_LOG_WARNING ("/reject did not complete\n"); 108 TALER_LOG_WARNING ("/reject did not complete\n");
107 TALER_BANK_reject_cancel (rs->rh); 109 TALER_BANK_reject_cancel (rs->rh);
108 } 110 }
109
110 GNUNET_free (rs); 111 GNUNET_free (rs);
111} 112}
112 113
114
113/** 115/**
114 * Run the command. 116 * Run the command.
115 * 117 *
@@ -128,19 +130,18 @@ reject_run (void *cls,
128 const uint64_t *row_id; 130 const uint64_t *row_id;
129 extern struct TALER_BANK_AuthenticationData AUTHS[]; 131 extern struct TALER_BANK_AuthenticationData AUTHS[];
130 132
131 deposit_cmd = TALER_TESTING_interpreter_lookup_command 133 (void) cmd;
132 (is, rs->deposit_reference); 134 deposit_cmd
133 135 = TALER_TESTING_interpreter_lookup_command (is,
136 rs->deposit_reference);
134 if (NULL == deposit_cmd) 137 if (NULL == deposit_cmd)
135 TALER_TESTING_FAIL (is); 138 TALER_TESTING_FAIL (is);
136 139 GNUNET_assert (GNUNET_OK ==
137 GNUNET_assert 140 TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT (deposit_cmd,
138 (GNUNET_OK == TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT 141 &credit_account));
139 (deposit_cmd, &credit_account)); 142 GNUNET_assert (GNUNET_OK ==
140 143 TALER_TESTING_GET_TRAIT_ROW_ID (deposit_cmd,
141 GNUNET_assert 144 &row_id));
142 (GNUNET_OK == TALER_TESTING_GET_TRAIT_ROW_ID
143 (deposit_cmd, &row_id));
144 TALER_LOG_INFO ("Account %llu rejects deposit\n", 145 TALER_LOG_INFO ("Account %llu rejects deposit\n",
145 (unsigned long long) *credit_account); 146 (unsigned long long) *credit_account);
146 rs->rh = TALER_BANK_reject (is->ctx, 147 rs->rh = TALER_BANK_reject (is->ctx,
@@ -191,7 +192,6 @@ reject_traits (void *cls,
191 * @param deposit_reference reference to a command that will 192 * @param deposit_reference reference to a command that will
192 * provide a "row id" and credit (bank) account to craft 193 * provide a "row id" and credit (bank) account to craft
193 * the "reject" request. 194 * the "reject" request.
194 *
195 * @return the command. 195 * @return the command.
196 */ 196 */
197struct TALER_TESTING_Command 197struct TALER_TESTING_Command
@@ -205,16 +205,17 @@ TALER_TESTING_cmd_bank_reject (const char *label,
205 rs->bank_url = bank_url; 205 rs->bank_url = bank_url;
206 rs->deposit_reference = deposit_reference; 206 rs->deposit_reference = deposit_reference;
207 207
208 struct TALER_TESTING_Command cmd = { 208 {
209 .cls = rs, 209 struct TALER_TESTING_Command cmd = {
210 .run = &reject_run, 210 .cls = rs,
211 .cleanup = &reject_cleanup, 211 .run = &reject_run,
212 .label = label, 212 .cleanup = &reject_cleanup,
213 .traits = &reject_traits 213 .label = label,
214 }; 214 .traits = &reject_traits
215 215 };
216 return cmd; 216
217 217 return cmd;
218 }
218} 219}
219 220
220 221