test_merchant_api.c (140078B)
1 /* 2 This file is part of TALER 3 Copyright (C) 2014-2023 Taler Systems SA 4 5 TALER is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as 7 published by the Free Software Foundation; either version 3, or 8 (at your 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 13 GNU 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 test_merchant_api.c 21 * @brief testcase to test exchange's HTTP API interface 22 * @author Sree Harsha Totakura <sreeharsha@totakura.in> 23 * @author Christian Grothoff 24 * @author Marcello Stanisci 25 */ 26 #include "taler/platform.h" 27 #include <gnunet/gnunet_time_lib.h> 28 #include <taler/taler_util.h> 29 #include <taler/taler_signatures.h> 30 #include <taler/taler_exchange_service.h> 31 #include <taler/taler_json_lib.h> 32 #include <gnunet/gnunet_util_lib.h> 33 #include <gnunet/gnunet_testing_lib.h> 34 #include <microhttpd.h> 35 #include <taler/taler_bank_service.h> 36 #include <taler/taler_fakebank_lib.h> 37 #include <taler/taler_testing_lib.h> 38 #include <taler/taler_error_codes.h> 39 #include "taler/taler_merchant_util.h" 40 #include "taler/taler_merchant_testing_lib.h" 41 42 #ifdef HAVE_DONAU_DONAU_SERVICE_H 43 #include <donau/donau_testing_lib.h> 44 #endif 45 46 47 /** 48 * The 'poll-orders-conclude-1' and other 'conclude' 49 * commands should NOT wait for this timeout! 50 */ 51 #define POLL_ORDER_TIMEOUT \ 52 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60) 53 54 /** 55 * The 'poll-orders-conclude-1x' and other 'conclude' 56 * commands that should (!) wait for this timeout! Hence, 57 * here we use a short value! 58 */ 59 #define POLL_ORDER_SHORT_TIMEOUT \ 60 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 2) 61 62 /** 63 * Configuration file we use. One (big) configuration is used 64 * for the various components for this test. 65 */ 66 static char *config_file; 67 68 /** 69 * Exchange base URL. Could also be taken from config. 70 */ 71 #define EXCHANGE_URL "http://localhost:8081/" 72 73 /** 74 * Payto URI of the customer (payer). 75 */ 76 static struct TALER_FullPayto payer_payto; 77 78 /** 79 * Payto URI of the exchange (escrow account). 80 */ 81 static struct TALER_FullPayto exchange_payto; 82 83 /** 84 * Payto URI of the merchant (receiver). 85 */ 86 static struct TALER_FullPayto merchant_payto; 87 88 /** 89 * Credentials for the test. 90 */ 91 static struct TALER_TESTING_Credentials cred; 92 93 /** 94 * Merchant base URL. 95 */ 96 static const char *merchant_url; 97 98 /** 99 * Merchant instance "i1a" base URL. 100 */ 101 static char *merchant_url_i1a; 102 103 /** 104 * Account number of the exchange at the bank. 105 */ 106 #define EXCHANGE_ACCOUNT_NAME "2" 107 108 /** 109 * Account number of some user. 110 */ 111 #define USER_ACCOUNT_NAME "62" 112 113 /** 114 * Account number of some other user. 115 */ 116 #define USER_ACCOUNT_NAME2 "63" 117 118 /** 119 * Account number used by the merchant 120 */ 121 #define MERCHANT_ACCOUNT_NAME "3" 122 123 static const char *order_1_transfers[] = { 124 "post-transfer-1", 125 NULL 126 }; 127 128 static const char *order_1_forgets_1[] = { 129 "forget-1", 130 NULL 131 }; 132 133 static const char *order_1_forgets_2[] = { 134 "forget-1", 135 "forget-order-array-elem", 136 NULL 137 }; 138 139 static const char *order_1_forgets_3[] = { 140 "forget-1", 141 "forget-order-array-elem", 142 "forget-order-array-wc", 143 NULL 144 }; 145 146 static const struct TALER_TESTING_ProductUnitExpectations 147 expect_unicorn_defaults = { 148 .have_unit_allow_fraction = true, 149 .unit_allow_fraction = true, 150 .have_unit_precision_level = true, 151 .unit_precision_level = 1 152 }; 153 154 static const struct TALER_TESTING_ProductUnitExpectations 155 expect_unicorn_patched = { 156 .have_unit_allow_fraction = true, 157 .unit_allow_fraction = false, 158 .have_unit_precision_level = true, 159 .unit_precision_level = 0 160 }; 161 162 /** 163 * Build an array of selected product IDs. 164 * 165 * @param first first product id 166 * @param second second product id or NULL 167 * @return JSON array of product ids 168 */ 169 static json_t * 170 make_selected_products (const char *first, 171 const char *second) 172 { 173 json_t *arr; 174 175 arr = json_array (); 176 GNUNET_assert (NULL != arr); 177 if (NULL != first) 178 GNUNET_assert (0 == 179 json_array_append_new (arr, 180 json_string (first))); 181 if (NULL != second) 182 GNUNET_assert (0 == 183 json_array_append_new (arr, 184 json_string (second))); 185 return arr; 186 } 187 188 189 /** 190 * Build an array of selected category IDs. 191 * 192 * @param first first category id 193 * @param second second category id or 0 194 * @return JSON array of category ids 195 */ 196 static json_t * 197 make_selected_categories (uint64_t first, 198 uint64_t second) 199 { 200 json_t *arr; 201 202 arr = json_array (); 203 GNUNET_assert (NULL != arr); 204 if (0 != first) 205 GNUNET_assert (0 == 206 json_array_append_new (arr, 207 json_integer (first))); 208 if (0 != second) 209 GNUNET_assert (0 == 210 json_array_append_new (arr, 211 json_integer (second))); 212 return arr; 213 } 214 215 216 /** 217 * Build an inventory selection array. 218 * 219 * @param first_id first product id 220 * @param first_qty first quantity 221 * @param second_id second product id or NULL 222 * @param second_qty second quantity or NULL 223 * @return JSON array of inventory selections 224 */ 225 static json_t * 226 make_inventory_selection (const char *first_id, 227 const char *first_qty, 228 const char *second_id, 229 const char *second_qty) 230 { 231 json_t *arr; 232 233 arr = json_array (); 234 GNUNET_assert (NULL != arr); 235 if (NULL != first_id) 236 GNUNET_assert (0 == 237 json_array_append_new ( 238 arr, 239 GNUNET_JSON_PACK ( 240 GNUNET_JSON_pack_string ("product_id", 241 first_id), 242 GNUNET_JSON_pack_string ("quantity", 243 first_qty)))); 244 if (NULL != second_id) 245 GNUNET_assert (0 == 246 json_array_append_new ( 247 arr, 248 GNUNET_JSON_PACK ( 249 GNUNET_JSON_pack_string ("product_id", 250 second_id), 251 GNUNET_JSON_pack_string ("quantity", 252 second_qty)))); 253 return arr; 254 } 255 256 257 /** 258 * Execute the taler-merchant-webhook command with 259 * our configuration file. 260 * 261 * @param label label to use for the command. 262 */ 263 static struct TALER_TESTING_Command 264 cmd_webhook (const char *label) 265 { 266 return TALER_TESTING_cmd_webhook (label, config_file); 267 } 268 269 270 /** 271 * Execute the taler-exchange-wirewatch command with 272 * our configuration file. 273 * 274 * @param label label to use for the command. 275 */ 276 static struct TALER_TESTING_Command 277 cmd_exec_wirewatch (const char *label) 278 { 279 return TALER_TESTING_cmd_exec_wirewatch (label, 280 config_file); 281 } 282 283 284 /** 285 * Execute the taler-exchange-aggregator, closer and transfer commands with 286 * our configuration file. 287 * 288 * @param label label to use for the command. 289 */ 290 #define CMD_EXEC_AGGREGATOR(label) \ 291 TALER_TESTING_cmd_exec_aggregator (label "-aggregator", config_file), \ 292 TALER_TESTING_cmd_exec_transfer (label "-transfer", config_file) 293 294 295 /** 296 * Run wire transfer of funds from some user's account to the 297 * exchange. 298 * 299 * @param label label to use for the command. 300 * @param amount amount to transfer, i.e. "EUR:1" 301 * @param url exchange_url 302 */ 303 static struct TALER_TESTING_Command 304 cmd_transfer_to_exchange (const char *label, 305 const char *amount) 306 { 307 return TALER_TESTING_cmd_admin_add_incoming (label, 308 amount, 309 &cred.ba, 310 payer_payto); 311 } 312 313 314 /** 315 * Main function that will tell the interpreter what commands to 316 * run. 317 * 318 * @param cls closure 319 */ 320 static void 321 run (void *cls, 322 struct TALER_TESTING_Interpreter *is) 323 { 324 struct TALER_TESTING_Command get_private_order_id[] = { 325 TALER_TESTING_cmd_merchant_post_instances ( 326 "instance-create-admin", 327 merchant_url, 328 "admin", 329 MHD_HTTP_NO_CONTENT), 330 TALER_TESTING_cmd_merchant_kyc_get ( 331 "instance-create-kyc-no-accounts", 332 merchant_url, 333 NULL, 334 NULL, 335 EXCHANGE_URL, 336 TALER_EXCHANGE_KLPT_NONE, 337 MHD_HTTP_NO_CONTENT, 338 false), 339 TALER_TESTING_cmd_merchant_post_account ( 340 "instance-create-default-account", 341 merchant_url, 342 merchant_payto, 343 NULL, NULL, 344 MHD_HTTP_OK), 345 TALER_TESTING_cmd_merchant_kyc_get ( 346 "instance-create-kyc-0", 347 merchant_url, 348 NULL, 349 NULL, 350 EXCHANGE_URL, 351 TALER_EXCHANGE_KLPT_NONE, 352 MHD_HTTP_OK, 353 true), 354 TALER_TESTING_cmd_merchant_post_orders_no_claim ( 355 "create-proposal-bad-currency", 356 merchant_url, 357 MHD_HTTP_CONFLICT, 358 "4", 359 GNUNET_TIME_UNIT_ZERO_TS, 360 GNUNET_TIME_UNIT_FOREVER_TS, 361 "XXX:5.0"), 362 TALER_TESTING_cmd_merchant_post_orders_no_claim ( 363 "create-proposal-4", 364 merchant_url, 365 MHD_HTTP_OK, 366 "4", 367 GNUNET_TIME_UNIT_ZERO_TS, 368 GNUNET_TIME_UNIT_FOREVER_TS, 369 "EUR:5.0"), 370 TALER_TESTING_cmd_merchant_get_order ( 371 "get-order-4", 372 merchant_url, 373 "create-proposal-4", 374 TALER_MERCHANT_OSC_UNPAID, 375 false, 376 MHD_HTTP_OK, 377 NULL), 378 TALER_TESTING_cmd_merchant_delete_order ( 379 "delete-order-4", 380 merchant_url, 381 "4", 382 MHD_HTTP_NO_CONTENT), 383 TALER_TESTING_cmd_merchant_purge_instance ( 384 "purge-admin", 385 merchant_url, 386 "admin", 387 MHD_HTTP_NO_CONTENT), 388 TALER_TESTING_cmd_end () 389 }; 390 391 struct TALER_TESTING_Command pay[] = { 392 /** 393 * Move money to the exchange's bank account. 394 */ 395 cmd_transfer_to_exchange ("create-reserve-1", 396 "EUR:10.02"), 397 /** 398 * Make a reserve exist, according to the previous transfer. 399 */ 400 cmd_exec_wirewatch ("wirewatch-1"), 401 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-2", 402 "EUR:10.02", 403 payer_payto, 404 exchange_payto, 405 "create-reserve-1"), 406 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", 407 "create-reserve-1", 408 "EUR:5", 409 0, 410 MHD_HTTP_OK), 411 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", 412 "create-reserve-1", 413 "EUR:5", 414 0, 415 MHD_HTTP_OK), 416 TALER_TESTING_cmd_merchant_get_orders ("get-orders-empty", 417 merchant_url, 418 MHD_HTTP_OK, 419 NULL), 420 /** 421 * Check the reserve is depleted. 422 */ 423 TALER_TESTING_cmd_status ("withdraw-status-1", 424 "create-reserve-1", 425 "EUR:0", 426 MHD_HTTP_OK), 427 TALER_TESTING_cmd_merchant_delete_order ("delete-order-nx", 428 merchant_url, 429 "1", 430 MHD_HTTP_NOT_FOUND), 431 TALER_TESTING_cmd_poll_orders_start ("poll-orders-1-start", 432 merchant_url, 433 POLL_ORDER_TIMEOUT), 434 TALER_TESTING_cmd_merchant_claim_order ("claim-order-nx", 435 merchant_url, 436 MHD_HTTP_NOT_FOUND, 437 NULL, 438 "1"), 439 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-1", 440 cred.cfg, 441 merchant_url, 442 MHD_HTTP_OK, 443 "1", 444 GNUNET_TIME_UNIT_ZERO_TS, 445 GNUNET_TIME_UNIT_FOREVER_TS, 446 true, 447 "EUR:5.0", 448 "x-taler-bank", 449 "", 450 "", 451 NULL), 452 TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-pay-w1", 453 merchant_url, 454 "webhook-pay-1", 455 "pay", 456 MHD_HTTP_NO_CONTENT), 457 TALER_TESTING_cmd_merchant_post_webhooks2 ("post-webhooks-settled-w1", 458 merchant_url, 459 "webhook-settled-1", 460 "order_settled", 461 "http://localhost:12345/", 462 "POST", 463 "Taler-test-header: settled", 464 "order-settled", 465 MHD_HTTP_NO_CONTENT), 466 TALER_TESTING_cmd_testserver ("launch-http-server-for-webhooks", 467 12345), 468 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-1-idem", 469 cred.cfg, 470 merchant_url, 471 MHD_HTTP_OK, 472 "1", 473 GNUNET_TIME_UNIT_ZERO_TS, 474 GNUNET_TIME_UNIT_FOREVER_TS, 475 true, 476 "EUR:5.0", 477 "x-taler-bank", 478 "", 479 "", 480 "create-proposal-1"), 481 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-1x", 482 cred.cfg, 483 merchant_url, 484 MHD_HTTP_OK, 485 "1x", 486 GNUNET_TIME_UNIT_ZERO_TS, 487 GNUNET_TIME_UNIT_FOREVER_TS, 488 true, 489 "EUR:5.0", 490 "x-taler-bank", 491 "", 492 "", 493 NULL), 494 TALER_TESTING_cmd_merchant_claim_order ("reclaim-1", 495 merchant_url, 496 MHD_HTTP_OK, 497 "create-proposal-1", 498 NULL), 499 TALER_TESTING_cmd_merchant_claim_order ("reclaim-1-bad-nonce", 500 merchant_url, 501 MHD_HTTP_CONFLICT, 502 NULL, 503 "1"), 504 TALER_TESTING_cmd_merchant_claim_order ("reclaim-1x", 505 merchant_url, 506 MHD_HTTP_OK, 507 "create-proposal-1x", 508 NULL), 509 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1-pre-exists", 510 cred.cfg, 511 merchant_url, 512 MHD_HTTP_CONFLICT, 513 "1", 514 GNUNET_TIME_UNIT_ZERO_TS, 515 GNUNET_TIME_UNIT_FOREVER_TS, 516 "EUR:5.0"), 517 TALER_TESTING_cmd_poll_orders_conclude ("poll-orders-1-conclude", 518 MHD_HTTP_OK, 519 "poll-orders-1-start"), 520 TALER_TESTING_cmd_merchant_get_orders ("get-orders-1", 521 merchant_url, 522 MHD_HTTP_OK, 523 "create-proposal-1x", 524 "create-proposal-1", 525 NULL), 526 TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1", 527 merchant_url, 528 "create-proposal-1", 529 false, 530 false, 531 false, 532 MHD_HTTP_PAYMENT_REQUIRED), 533 TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1", 534 merchant_url, 535 "create-proposal-1", 536 TALER_MERCHANT_OSC_CLAIMED, 537 false, 538 MHD_HTTP_OK, 539 NULL), 540 TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-start-1", 541 merchant_url, 542 "create-proposal-1", 543 POLL_ORDER_TIMEOUT, 544 NULL), 545 TALER_TESTING_cmd_wallet_poll_order_start2 ("poll-order-wallet-start-1x", 546 merchant_url, 547 "create-proposal-1x", 548 POLL_ORDER_SHORT_TIMEOUT, 549 NULL, /* no refund */ 550 "session-0"), 551 TALER_TESTING_cmd_poll_order_start ("poll-order-merchant-1-start", 552 merchant_url, 553 "1", 554 POLL_ORDER_TIMEOUT), 555 TALER_TESTING_cmd_merchant_pay_order ("deposit-simple", 556 merchant_url, 557 MHD_HTTP_OK, 558 "create-proposal-1", 559 "withdraw-coin-1", 560 "EUR:5", 561 "EUR:4.99", 562 "session-0"), 563 TALER_TESTING_cmd_poll_order_conclude ("poll-order-merchant-1-conclude", 564 MHD_HTTP_OK, 565 "poll-order-merchant-1-start"), 566 TALER_TESTING_cmd_wallet_poll_order_conclude ("poll-order-1-conclude", 567 MHD_HTTP_OK, 568 NULL, 569 "poll-order-wallet-start-1"), 570 /* Check for webhook */ 571 cmd_webhook ("pending-webhooks-pay-w1"), 572 /* Check webhook did anything: have a command that inspects traits of the testserver 573 and check if the traits have the right values set! */ 574 TALER_TESTING_cmd_checkserver ("check-http-server-for-webhooks", 575 "launch-http-server-for-webhooks", 576 0), 577 /* Here we expect to run into a timeout, as we do not pay this one */ 578 TALER_TESTING_cmd_wallet_poll_order_conclude2 ("poll-order-1x-conclude", 579 MHD_HTTP_PAYMENT_REQUIRED, 580 NULL, 581 "poll-order-wallet-start-1x", 582 "1"), 583 TALER_TESTING_cmd_merchant_post_orders_paid ("verify-order-1-paid", 584 merchant_url, 585 "deposit-simple", 586 "session-1", 587 MHD_HTTP_OK), 588 TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1-2", 589 merchant_url, 590 "create-proposal-1", 591 true, 592 false, 593 false, 594 MHD_HTTP_OK), 595 TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1-2a", 596 merchant_url, 597 "create-proposal-1", 598 TALER_MERCHANT_OSC_PAID, 599 false, 600 MHD_HTTP_OK, 601 NULL), 602 TALER_TESTING_cmd_merchant_get_orders ("get-orders-1-paid", 603 merchant_url, 604 MHD_HTTP_OK, 605 "create-proposal-1x", 606 "create-proposal-1", 607 NULL), 608 TALER_TESTING_cmd_merchant_pay_order ("replay-simple", 609 merchant_url, 610 MHD_HTTP_OK, 611 "create-proposal-1", 612 "withdraw-coin-1", 613 "EUR:5", 614 "EUR:4.99", 615 "session-0"), 616 TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"), 617 TALER_TESTING_cmd_sleep ( 618 "Wait for wire transfer deadline", 619 3), 620 CMD_EXEC_AGGREGATOR ("run-aggregator"), 621 TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-498c", 622 EXCHANGE_URL, 623 "EUR:4.98", 624 exchange_payto, 625 merchant_payto), 626 TALER_TESTING_cmd_merchant_post_transfer ("post-transfer-1", 627 &cred.ba, 628 merchant_payto, 629 merchant_url, 630 "EUR:4.98", 631 MHD_HTTP_NO_CONTENT, 632 "deposit-simple", 633 NULL), 634 TALER_TESTING_cmd_depositcheck ("run taler-merchant-depositcheck-1", 635 config_file), 636 TALER_TESTING_cmd_run_tme ("run taler-merchant-reconciliation-1", 637 config_file), 638 /* Check for settled webhook after reconciliation */ 639 cmd_webhook ("pending-webhooks-settled-w1"), 640 TALER_TESTING_cmd_checkserver2 ("check-http-server-for-settled-webhook", 641 "launch-http-server-for-webhooks", 642 1, 643 "/", 644 "POST", 645 "settled", 646 "order-settled"), 647 TALER_TESTING_cmd_merchant_post_transfer2 ("post-transfer-bad", 648 merchant_url, 649 merchant_payto, 650 "EUR:4.98", 651 NULL, 652 /*non-routable IP address 653 so we are sure to not get 654 any reply*/ 655 "http://192.0.2.1/404/", 656 MHD_HTTP_NO_CONTENT), 657 TALER_TESTING_cmd_merchant_get_transfers ("get-transfers-1", 658 merchant_url, 659 merchant_payto, 660 MHD_HTTP_OK, 661 "post-transfer-1", 662 "post-transfer-bad", 663 NULL), 664 TALER_TESTING_cmd_merchant_delete_transfer ("delete-transfer-1", 665 merchant_url, 666 "post-transfer-bad", 667 MHD_HTTP_NO_CONTENT), 668 TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-2b", 669 merchant_url, 670 "create-proposal-1", 671 TALER_MERCHANT_OSC_PAID, 672 true, 673 order_1_transfers, /* "post-transfer-1" */ 674 false, 675 NULL, 676 NULL, 677 MHD_HTTP_OK), 678 TALER_TESTING_cmd_merchant_forget_order ("forget-1", 679 merchant_url, 680 MHD_HTTP_NO_CONTENT, 681 "create-proposal-1", 682 NULL, 683 "$.dummy_obj", 684 NULL), 685 TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-1", 686 merchant_url, 687 "create-proposal-1", 688 TALER_MERCHANT_OSC_PAID, 689 true, 690 order_1_transfers, 691 false, 692 NULL, 693 order_1_forgets_1, 694 MHD_HTTP_OK), 695 TALER_TESTING_cmd_merchant_forget_order ("forget-unforgettable", 696 merchant_url, 697 MHD_HTTP_CONFLICT, 698 "create-proposal-1", 699 NULL, 700 "$.amount", 701 NULL), 702 TALER_TESTING_cmd_merchant_forget_order ("forget-order-nx", 703 merchant_url, 704 MHD_HTTP_NOT_FOUND, 705 NULL, 706 "nx-order", 707 "$.dummy_obj", 708 NULL), 709 TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-elem", 710 merchant_url, 711 MHD_HTTP_NO_CONTENT, 712 "create-proposal-1", 713 NULL, 714 "$.dummy_array[0].item", 715 NULL), 716 TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-2", 717 merchant_url, 718 "create-proposal-1", 719 TALER_MERCHANT_OSC_PAID, 720 true, 721 order_1_transfers, 722 false, 723 NULL, 724 order_1_forgets_2, 725 MHD_HTTP_OK), 726 TALER_TESTING_cmd_merchant_forget_order ("forget-order-array-wc", 727 merchant_url, 728 MHD_HTTP_NO_CONTENT, 729 "create-proposal-1", 730 NULL, 731 "$.dummy_array[*].item", 732 NULL), 733 TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1-forget-3", 734 merchant_url, 735 "create-proposal-1", 736 TALER_MERCHANT_OSC_PAID, 737 true, 738 order_1_transfers, 739 false, 740 NULL, 741 order_1_forgets_3, 742 MHD_HTTP_OK), 743 TALER_TESTING_cmd_merchant_forget_order ("forget-order-malformed", 744 merchant_url, 745 MHD_HTTP_BAD_REQUEST, 746 "create-proposal-1", 747 NULL, 748 "$.dummy_array[abc].item", 749 NULL), 750 TALER_TESTING_cmd_merchant_post_products ("post-products-p3", 751 merchant_url, 752 "product-3", 753 "a product", 754 "EUR:1", 755 MHD_HTTP_NO_CONTENT), 756 TALER_TESTING_cmd_merchant_post_products_with_unit_prices ( 757 "post-products-dup-currency", 758 merchant_url, 759 "product-dup-currency", 760 "duplicate currency product", 761 "test-unit", 762 (const char *[]) { "EUR:1", "EUR:2" }, 763 2, 764 MHD_HTTP_BAD_REQUEST), 765 TALER_TESTING_cmd_merchant_post_products2 ("post-products-p4", 766 merchant_url, 767 "product-4age", 768 "an age-restricted product", 769 NULL, 770 "unit", 771 "EUR:1", 772 "", /* image */ 773 NULL, 774 4, 775 16 /* minimum age */, 776 NULL, 777 GNUNET_TIME_UNIT_FOREVER_TS, 778 MHD_HTTP_NO_CONTENT), 779 TALER_TESTING_cmd_merchant_post_products3 ("post-products-frac", 780 merchant_url, 781 "product-frac", 782 "fractional product", 783 json_pack ("{s:s}", 784 "en", 785 "fractional product"), 786 "kg", 787 "EUR:1.5", 788 "", 789 json_array (), 790 1, 791 (TALER_MERCHANT_UNIT_FRAC_BASE 792 * 3) 793 / 4, 794 true, 795 0, 796 NULL, 797 GNUNET_TIME_UNIT_ZERO_TS, 798 MHD_HTTP_NO_CONTENT), 799 TALER_TESTING_cmd_merchant_get_product ("get-product-frac-post", 800 merchant_url, 801 "product-frac", 802 MHD_HTTP_OK, 803 "post-products-frac"), 804 TALER_TESTING_cmd_merchant_patch_product_with_unit_prices ( 805 "patch-products-dup-currency", 806 merchant_url, 807 "product-3", 808 "a product", 809 "can", 810 (const char *[]) { "EUR:1", "EUR:2" }, 811 2, 812 MHD_HTTP_BAD_REQUEST), 813 TALER_TESTING_cmd_merchant_patch_product ("patch-products-p3", 814 merchant_url, 815 "product-3", 816 "a product", 817 json_object (), 818 "can", 819 "EUR:1", 820 "data:image/jpeg;base64,RAWDATA", 821 json_array (), 822 5, 823 0, 824 json_object (), 825 GNUNET_TIME_relative_to_timestamp 826 ( 827 GNUNET_TIME_UNIT_MINUTES), 828 MHD_HTTP_NO_CONTENT), 829 TALER_TESTING_cmd_merchant_patch_product2 ("patch-product-frac", 830 merchant_url, 831 "product-frac", 832 "fractional product patched", 833 json_pack ("{s:s}", 834 "en", 835 "fractional product patched"), 836 "kg", 837 "EUR:1.6", 838 "", 839 json_array (), 840 2, 841 TALER_MERCHANT_UNIT_FRAC_BASE / 4 842 , 843 true, 844 0, 845 json_object (), 846 GNUNET_TIME_relative_to_timestamp 847 ( 848 GNUNET_TIME_UNIT_MINUTES), 849 MHD_HTTP_NO_CONTENT), 850 TALER_TESTING_cmd_merchant_get_product ("get-product-frac-patched", 851 merchant_url, 852 "product-frac", 853 MHD_HTTP_OK, 854 "patch-product-frac"), 855 TALER_TESTING_cmd_merchant_delete_unit ("delete-unit-piece-denied", 856 merchant_url, 857 "Piece", 858 MHD_HTTP_CONFLICT), 859 TALER_TESTING_cmd_merchant_post_units ("post-unit-piece-conflict", 860 merchant_url, 861 "Piece", 862 "piece", 863 "pc", 864 false, 865 0, 866 true, 867 NULL, 868 NULL, 869 MHD_HTTP_CONFLICT), 870 TALER_TESTING_cmd_merchant_post_units ("post-unit-bucket", 871 merchant_url, 872 "BucketCustomUnit", 873 "bucket", 874 "bkt", 875 false, 876 0, 877 true, 878 json_pack ("{s:s}", "en", "bucket"), 879 json_pack ("{s:s}", "en", "bkt"), 880 MHD_HTTP_NO_CONTENT), 881 TALER_TESTING_cmd_merchant_get_unit ("get-unit-bucket", 882 merchant_url, 883 "BucketCustomUnit", 884 MHD_HTTP_OK, 885 "post-unit-bucket"), 886 TALER_TESTING_cmd_merchant_get_units ("get-units-bucket-list", 887 merchant_url, 888 MHD_HTTP_OK, 889 "post-unit-bucket", 890 NULL), 891 TALER_TESTING_cmd_merchant_patch_unit ("patch-unit-bucket", 892 merchant_url, 893 "BucketCustomUnit", 894 "bucket-updated", 895 "bkt-upd", 896 json_pack ("{s:s}", "en", 897 "bucket-updated"), 898 json_pack ("{s:s}", "en", "bkt-upd"), 899 true, 900 0, 901 false, 902 MHD_HTTP_NO_CONTENT), 903 TALER_TESTING_cmd_merchant_get_unit ("get-unit-bucket-patched", 904 merchant_url, 905 "BucketCustomUnit", 906 MHD_HTTP_OK, 907 "patch-unit-bucket"), 908 TALER_TESTING_cmd_merchant_get_units ("get-units-bucket-updated", 909 merchant_url, 910 MHD_HTTP_OK, 911 "patch-unit-bucket", 912 NULL), 913 TALER_TESTING_cmd_merchant_delete_unit ("delete-unit-bucket", 914 merchant_url, 915 "BucketCustomUnit", 916 MHD_HTTP_NO_CONTENT), 917 TALER_TESTING_cmd_merchant_get_unit ("get-unit-bucket-deleted", 918 merchant_url, 919 "BucketCustomUnit", 920 MHD_HTTP_NOT_FOUND, 921 NULL), 922 TALER_TESTING_cmd_merchant_post_units ("post-unit-unicorn", 923 merchant_url, 924 "UnitUnicorn", 925 "unicorn", 926 "uni", 927 true, 928 1, 929 true, 930 json_pack ("{s:s}", "en", "unicorn"), 931 json_pack ("{s:s}", "en", "uni"), 932 MHD_HTTP_NO_CONTENT), 933 TALER_TESTING_cmd_merchant_post_products2 ("post-product-unicorn", 934 merchant_url, 935 "product-unicorn", 936 "a unicorn snack", 937 json_pack ("{s:s}", 938 "en", 939 "a unicorn snack"), 940 "UnitUnicorn", 941 "EUR:3.5", 942 "", 943 json_array (), 944 7, 945 0, 946 json_object (), 947 GNUNET_TIME_UNIT_ZERO_TS, 948 MHD_HTTP_NO_CONTENT), 949 TALER_TESTING_cmd_merchant_get_product2 ("get-product-unicorn-default", 950 merchant_url, 951 "product-unicorn", 952 MHD_HTTP_OK, 953 "post-product-unicorn", 954 &expect_unicorn_defaults), 955 TALER_TESTING_cmd_merchant_patch_unit ("patch-unit-unicorn", 956 merchant_url, 957 "UnitUnicorn", 958 NULL, 959 NULL, 960 NULL, 961 NULL, 962 false, 963 0, 964 true, 965 MHD_HTTP_NO_CONTENT), 966 TALER_TESTING_cmd_merchant_get_product2 ("get-product-unicorn-patched", 967 merchant_url, 968 "product-unicorn", 969 MHD_HTTP_OK, 970 "post-product-unicorn", 971 &expect_unicorn_patched), 972 TALER_TESTING_cmd_merchant_delete_product ("delete-product-unicorn", 973 merchant_url, 974 "product-unicorn", 975 MHD_HTTP_NO_CONTENT), 976 TALER_TESTING_cmd_merchant_delete_unit ("delete-unit-unicorn", 977 merchant_url, 978 "UnitUnicorn", 979 MHD_HTTP_NO_CONTENT), 980 TALER_TESTING_cmd_merchant_lock_product ("lock-product-p3", 981 merchant_url, 982 "product-3", 983 GNUNET_TIME_UNIT_MINUTES, 984 2, 985 MHD_HTTP_NO_CONTENT), 986 TALER_TESTING_cmd_merchant_lock_product2 ( 987 "lock-product-p3-float-denied", 988 merchant_url, 989 "product-3", 990 GNUNET_TIME_UNIT_MINUTES, 991 1, 992 TALER_MERCHANT_UNIT_FRAC_BASE / 2, 993 true, 994 MHD_HTTP_BAD_REQUEST), 995 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3-float-denied", 996 cred.cfg, 997 merchant_url, 998 MHD_HTTP_BAD_REQUEST, 999 "order-p3-float-denied", 1000 GNUNET_TIME_UNIT_ZERO_TS, 1001 GNUNET_TIME_UNIT_FOREVER_TS, 1002 true, 1003 "EUR:5.0", 1004 "x-taler-bank", 1005 "product-3/1.5", 1006 "", 1007 NULL), 1008 TALER_TESTING_cmd_merchant_patch_product2 ( 1009 "patch-product-3-allow-float", 1010 merchant_url, 1011 "product-3", 1012 "a product allow fractional", 1013 json_pack ("{s:s}", 1014 "en", 1015 "a product allow fractional"), 1016 "can", 1017 "EUR:1", 1018 "data:image/jpeg;base64,RAWDATA", 1019 json_array (), 1020 5, 1021 0, 1022 true, 1023 0, 1024 json_object (), 1025 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), 1026 MHD_HTTP_NO_CONTENT), 1027 cmd_transfer_to_exchange ("create-reserve-p3-float", 1028 "EUR:5.01"), 1029 cmd_exec_wirewatch ("wirewatch-p3-float"), 1030 TALER_TESTING_cmd_check_bank_admin_transfer ( 1031 "check_bank_transfer-p3-float", 1032 "EUR:5.01", 1033 payer_payto, 1034 exchange_payto, 1035 "create-reserve-p3-float"), 1036 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-p3-float", 1037 "create-reserve-p3-float", 1038 "EUR:5", 1039 0, 1040 MHD_HTTP_OK), 1041 TALER_TESTING_cmd_merchant_lock_product2 ( 1042 "lock-product-p3-float", 1043 merchant_url, 1044 "product-3", 1045 GNUNET_TIME_UNIT_MINUTES, 1046 1, 1047 TALER_MERCHANT_UNIT_FRAC_BASE / 2, 1048 true, 1049 MHD_HTTP_NO_CONTENT), 1050 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3-float", 1051 cred.cfg, 1052 merchant_url, 1053 MHD_HTTP_OK, 1054 "order-p3-float", 1055 GNUNET_TIME_UNIT_ZERO_TS, 1056 GNUNET_TIME_UNIT_FOREVER_TS, 1057 true, 1058 "EUR:5.0", 1059 "x-taler-bank", 1060 "product-3/1.5", 1061 "", 1062 NULL), 1063 TALER_TESTING_cmd_merchant_claim_order ("claim-order-p3-float", 1064 merchant_url, 1065 MHD_HTTP_OK, 1066 "create-proposal-p3-float", 1067 NULL), 1068 TALER_TESTING_cmd_merchant_pay_order ("pay-order-p3-float", 1069 merchant_url, 1070 MHD_HTTP_OK, 1071 "create-proposal-p3-float", 1072 "withdraw-coin-p3-float", 1073 "EUR:5", 1074 "EUR:4.99", 1075 "session-p3-float"), 1076 TALER_TESTING_cmd_sleep ( 1077 "Wait for wire transfer deadline-p3-float", 1078 3), 1079 CMD_EXEC_AGGREGATOR ("run-aggregator-p3-float"), 1080 TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-p3-float", 1081 EXCHANGE_URL, 1082 "EUR:4.98", 1083 exchange_payto, 1084 merchant_payto), 1085 TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-p3-float-paid", 1086 merchant_url, 1087 "create-proposal-p3-float", 1088 TALER_MERCHANT_OSC_PAID, 1089 false, 1090 MHD_HTTP_OK, 1091 NULL), 1092 TALER_TESTING_cmd_merchant_patch_product2 ( 1093 "patch-product-3-restore", 1094 merchant_url, 1095 "product-3", 1096 "a product", 1097 json_pack ("{s:s}", 1098 "en", 1099 "a product"), 1100 "can", 1101 "EUR:1", 1102 "data:image/jpeg;base64,RAWDATA", 1103 json_array (), 1104 5, 1105 0, 1106 false, 1107 0, 1108 json_object (), 1109 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), 1110 MHD_HTTP_NO_CONTENT), 1111 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3-wm-nx", 1112 cred.cfg, 1113 merchant_url, 1114 MHD_HTTP_NOT_FOUND, 1115 "order-p3", 1116 GNUNET_TIME_UNIT_ZERO_TS, 1117 GNUNET_TIME_UNIT_FOREVER_TS, 1118 true, 1119 "EUR:5.0", 1120 "unsupported-wire-method", 1121 "product-3/2", 1122 "", /* locks */ 1123 NULL), 1124 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3-pd-nx", 1125 cred.cfg, 1126 merchant_url, 1127 MHD_HTTP_NOT_FOUND, 1128 "order-p3", 1129 GNUNET_TIME_UNIT_ZERO_TS, 1130 GNUNET_TIME_UNIT_FOREVER_TS, 1131 true, 1132 "EUR:5.0", 1133 "x-taler-bank", 1134 "unknown-product/2", 1135 "", 1136 NULL), 1137 TALER_TESTING_cmd_merchant_post_orders2 ( 1138 "create-proposal-p3-not-enough-stock", 1139 cred.cfg, 1140 merchant_url, 1141 MHD_HTTP_GONE, 1142 "order-p3", 1143 GNUNET_TIME_UNIT_ZERO_TS, 1144 GNUNET_TIME_UNIT_FOREVER_TS, 1145 true, 1146 "EUR:5.0", 1147 "x-taler-bank", 1148 "product-3/24", 1149 "", 1150 NULL), 1151 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p3", 1152 cred.cfg, 1153 merchant_url, 1154 MHD_HTTP_OK, 1155 "order-p3", 1156 GNUNET_TIME_UNIT_ZERO_TS, 1157 GNUNET_TIME_UNIT_FOREVER_TS, 1158 false, 1159 "EUR:5.0", 1160 "x-taler-bank", 1161 "product-3/3", 1162 "lock-product-p3", 1163 NULL), 1164 TALER_TESTING_cmd_merchant_post_orders2 ("create-proposal-p4-age", 1165 cred.cfg, 1166 merchant_url, 1167 MHD_HTTP_OK, 1168 "order-p4-age", 1169 GNUNET_TIME_UNIT_ZERO_TS, 1170 GNUNET_TIME_UNIT_FOREVER_TS, 1171 false, 1172 "EUR:5.0", 1173 "x-taler-bank", 1174 "product-4age", 1175 "", /* locks */ 1176 NULL), 1177 TALER_TESTING_cmd_merchant_get_order4 ("get-order-merchant-p4-age", 1178 merchant_url, 1179 "create-proposal-p4-age", 1180 TALER_MERCHANT_OSC_CLAIMED, 1181 16, 1182 MHD_HTTP_OK), 1183 TALER_TESTING_cmd_merchant_delete_order ("delete-order-paid", 1184 merchant_url, 1185 "1", 1186 MHD_HTTP_CONFLICT), 1187 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-no-id", 1188 cred.cfg, 1189 merchant_url, 1190 MHD_HTTP_OK, 1191 NULL, 1192 GNUNET_TIME_UNIT_ZERO_TS, 1193 GNUNET_TIME_UNIT_FOREVER_TS, 1194 "EUR:5.0"), 1195 TALER_TESTING_cmd_merchant_delete_webhook ("post-webhooks-pay-w1", 1196 merchant_url, 1197 "webhook-pay-1", 1198 MHD_HTTP_NO_CONTENT), 1199 TALER_TESTING_cmd_merchant_delete_webhook ("post-webhooks-settled-w1", 1200 merchant_url, 1201 "webhook-settled-1", 1202 MHD_HTTP_NO_CONTENT), 1203 TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"), 1204 TALER_TESTING_cmd_end () 1205 }; 1206 struct TALER_TESTING_Command double_spending[] = { 1207 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-2", 1208 cred.cfg, 1209 merchant_url, 1210 MHD_HTTP_OK, 1211 "2", 1212 GNUNET_TIME_UNIT_ZERO_TS, 1213 GNUNET_TIME_UNIT_FOREVER_TS, 1214 "EUR:5.0"), 1215 TALER_TESTING_cmd_merchant_claim_order ("fetch-proposal-2", 1216 merchant_url, 1217 MHD_HTTP_OK, 1218 "create-proposal-2", 1219 NULL), 1220 TALER_TESTING_cmd_merchant_pay_order ("deposit-double-2", 1221 merchant_url, 1222 MHD_HTTP_CONFLICT, 1223 "create-proposal-2", 1224 "withdraw-coin-1", 1225 "EUR:5", 1226 "EUR:4.99", 1227 NULL), 1228 TALER_TESTING_cmd_end () 1229 }; 1230 1231 const char *order_1r_refunds[] = { 1232 "refund-increase-1r", 1233 "refund-increase-1r-2", 1234 NULL 1235 }; 1236 struct TALER_TESTING_Command refund[] = { 1237 cmd_transfer_to_exchange ("create-reserve-1r", 1238 "EUR:10.02"), 1239 /** 1240 * Make a reserve exist, according to the previous transfer. 1241 */ 1242 cmd_exec_wirewatch ("wirewatch-1r"), 1243 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-2r", 1244 "EUR:10.02", 1245 payer_payto, 1246 exchange_payto, 1247 "create-reserve-1r"), 1248 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1r", 1249 "create-reserve-1r", 1250 "EUR:5", 1251 0, 1252 MHD_HTTP_OK), 1253 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2r", 1254 "create-reserve-1r", 1255 "EUR:5", 1256 0, 1257 MHD_HTTP_OK), 1258 /** 1259 * Check the reserve is depleted. 1260 */ 1261 TALER_TESTING_cmd_status ("withdraw-status-1r", 1262 "create-reserve-1r", 1263 "EUR:0", 1264 MHD_HTTP_OK), 1265 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-1r", 1266 cred.cfg, 1267 merchant_url, 1268 MHD_HTTP_OK, 1269 "1r", 1270 GNUNET_TIME_UNIT_ZERO_TS, 1271 GNUNET_TIME_UNIT_FOREVER_TS, 1272 "EUR:5.0"), 1273 TALER_TESTING_cmd_wallet_poll_order_start ("poll-order-wallet-refund-1-low", 1274 merchant_url, 1275 "create-proposal-1r", 1276 POLL_ORDER_TIMEOUT, 1277 "EUR:0.01"), 1278 TALER_TESTING_cmd_wallet_poll_order_start ( 1279 "poll-order-wallet-refund-1-high", 1280 merchant_url, 1281 "create-proposal-1r", 1282 POLL_ORDER_TIMEOUT, 1283 "EUR:0.2"), 1284 TALER_TESTING_cmd_merchant_pay_order ("pay-for-refund-1r", 1285 merchant_url, 1286 MHD_HTTP_OK, 1287 "create-proposal-1r", 1288 "withdraw-coin-1r", 1289 "EUR:5", 1290 "EUR:4.99", 1291 NULL), 1292 TALER_TESTING_cmd_poll_order_start ("poll-payment-refund-1", 1293 merchant_url, 1294 "1r", /* proposal name, not cmd ref! */ 1295 POLL_ORDER_TIMEOUT), 1296 TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r", 1297 merchant_url, 1298 "refund test", 1299 "1r", /* order ID */ 1300 "EUR:0.1", 1301 MHD_HTTP_OK), 1302 TALER_TESTING_cmd_wallet_poll_order_conclude ("poll-order-1-conclude-low", 1303 MHD_HTTP_OK, 1304 "EUR:0.1", 1305 "poll-order-wallet-refund-1-low"), 1306 TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1r", 1307 merchant_url, 1308 "create-proposal-1r", 1309 true, 1310 true, 1311 true, 1312 MHD_HTTP_OK), 1313 TALER_TESTING_cmd_merchant_order_refund ("refund-increase-1r-2", 1314 merchant_url, 1315 "refund test 2", 1316 "1r", /* order ID */ 1317 "EUR:1.0", 1318 MHD_HTTP_OK), 1319 TALER_TESTING_cmd_wallet_poll_order_conclude ("poll-order-1-conclude-high", 1320 MHD_HTTP_OK, 1321 "EUR:1.0", 1322 "poll-order-wallet-refund-1-high"), 1323 TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1r-2", 1324 merchant_url, 1325 "create-proposal-1r", 1326 true, 1327 true, 1328 true, 1329 MHD_HTTP_OK), 1330 TALER_TESTING_cmd_wallet_order_refund ("obtain-refund-1r", 1331 merchant_url, 1332 "create-proposal-1r", 1333 MHD_HTTP_OK, 1334 "refund-increase-1r", 1335 "refund-increase-1r-2", 1336 NULL), 1337 TALER_TESTING_cmd_wallet_get_order ("get-order-wallet-1r-3", 1338 merchant_url, 1339 "create-proposal-1r", 1340 true, 1341 true, 1342 false, 1343 MHD_HTTP_OK), 1344 TALER_TESTING_cmd_merchant_get_order ("get-order-merchant-1r", 1345 merchant_url, 1346 "create-proposal-1r", 1347 TALER_MERCHANT_OSC_PAID, 1348 true, 1349 MHD_HTTP_OK, 1350 "refund-increase-1r", 1351 "refund-increase-1r-2", 1352 NULL), 1353 TALER_TESTING_cmd_merchant_get_order2 ("get-order-merchant-1r-2", 1354 merchant_url, 1355 "create-proposal-1r", 1356 TALER_MERCHANT_OSC_PAID, 1357 false, 1358 NULL, 1359 true, 1360 order_1r_refunds, 1361 NULL, 1362 MHD_HTTP_OK), 1363 TALER_TESTING_cmd_poll_order_conclude ("poll-payment-refund-conclude-1", 1364 MHD_HTTP_OK, 1365 "poll-payment-refund-1"), 1366 1367 /* Test /refund on a contract that was never paid. */ 1368 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-not-to-be-paid", 1369 cred.cfg, 1370 merchant_url, 1371 MHD_HTTP_OK, 1372 "1-unpaid", 1373 GNUNET_TIME_UNIT_ZERO_TS, 1374 GNUNET_TIME_UNIT_FOREVER_TS, 1375 "EUR:5.0"), 1376 /* Try to increase an unpaid proposal. */ 1377 TALER_TESTING_cmd_merchant_order_refund ("refund-increase-unpaid-proposal", 1378 merchant_url, 1379 "refund test", 1380 "1-unpaid", 1381 "EUR:0.1", 1382 MHD_HTTP_CONFLICT), 1383 /* Try to increase a non existent proposal. */ 1384 TALER_TESTING_cmd_merchant_order_refund ( 1385 "refund-increase-nonexistent-proposal", 1386 merchant_url, 1387 "refund test", 1388 "non-existent-id", 1389 "EUR:0.1", 1390 MHD_HTTP_NOT_FOUND), 1391 /* 1392 The following block will (1) create a new 1393 reserve, then (2) a proposal, then (3) pay for 1394 it, and finally (4) attempt to pick up a refund 1395 from it without any increasing taking place 1396 in the first place. 1397 */ 1398 cmd_transfer_to_exchange ("create-reserve-unincreased-refund", 1399 "EUR:5.01"), 1400 cmd_exec_wirewatch ("wirewatch-unincreased-refund"), 1401 TALER_TESTING_cmd_check_bank_admin_transfer ( 1402 "check_bank_transfer-unincreased-refund", 1403 "EUR:5.01", 1404 payer_payto, 1405 exchange_payto, 1406 "create-reserve-unincreased-refund"), 1407 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-unincreased-refund", 1408 "create-reserve-unincreased-refund", 1409 "EUR:5", 1410 0, 1411 MHD_HTTP_OK), 1412 TALER_TESTING_cmd_merchant_post_orders ( 1413 "create-proposal-unincreased-refund", 1414 cred.cfg, 1415 merchant_url, 1416 MHD_HTTP_OK, 1417 "unincreased-proposal", 1418 GNUNET_TIME_UNIT_ZERO_TS, 1419 GNUNET_TIME_UNIT_FOREVER_TS, 1420 "EUR:5.0"), 1421 TALER_TESTING_cmd_merchant_pay_order ("pay-unincreased-proposal", 1422 merchant_url, 1423 MHD_HTTP_OK, 1424 "create-proposal-unincreased-refund", 1425 "withdraw-coin-unincreased-refund", 1426 "EUR:5", 1427 "EUR:4.99", 1428 NULL), 1429 TALER_TESTING_cmd_sleep ( 1430 "Wait for wire transfer deadline", 1431 3), 1432 CMD_EXEC_AGGREGATOR ("run-aggregator-unincreased-refund"), 1433 TALER_TESTING_cmd_check_bank_transfer ( 1434 "check_bank_transfer-paid-unincreased-refund", 1435 EXCHANGE_URL, 1436 "EUR:8.97", /* '4.98 from above', plus 4.99 from 'pay-for-refund-1r' 1437 and MINUS 0.1 MINUS 0.9 from 1438 'refund-increase-1r' and 'refund-increase-1r-2' */ 1439 exchange_payto, 1440 merchant_payto), 1441 TALER_TESTING_cmd_end () 1442 }; 1443 1444 struct TALER_TESTING_Command auth[] = { 1445 TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1a", 1446 merchant_url, 1447 "i1a", 1448 MHD_HTTP_NO_CONTENT), 1449 TALER_TESTING_cmd_merchant_post_account ( 1450 "instance-create-i1a-account", 1451 merchant_url_i1a, 1452 merchant_payto, 1453 NULL, NULL, 1454 MHD_HTTP_OK), 1455 TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-1", 1456 merchant_url_i1a, 1457 "nx-product", 1458 MHD_HTTP_NOT_FOUND, 1459 NULL), 1460 TALER_TESTING_cmd_merchant_get_products ("get-i1a-products-empty-1", 1461 merchant_url_i1a, 1462 MHD_HTTP_OK, 1463 NULL), 1464 TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-2", 1465 merchant_url_i1a, 1466 "nx-product", 1467 MHD_HTTP_NOT_FOUND, 1468 NULL), 1469 TALER_TESTING_cmd_merchant_get_products ("get-i1a-products-empty-2", 1470 merchant_url_i1a, 1471 MHD_HTTP_OK, 1472 NULL), 1473 TALER_TESTING_cmd_merchant_post_instance_auth ( 1474 "instance-create-i1a-auth-ok", 1475 merchant_url, 1476 "i1a", 1477 "my-secret", 1478 MHD_HTTP_NO_CONTENT), 1479 TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-3", 1480 merchant_url_i1a, 1481 "nx-product", 1482 MHD_HTTP_UNAUTHORIZED, 1483 NULL), 1484 TALER_TESTING_cmd_merchant_get_products ("get-i1a-products-empty-3", 1485 merchant_url_i1a, 1486 MHD_HTTP_UNAUTHORIZED, 1487 NULL), 1488 TALER_TESTING_cmd_set_authorization ("set-auth-valid", 1489 "Basic aTFhOm15LXNlY3JldA=="), 1490 TALER_TESTING_cmd_merchant_post_instance_token ( 1491 "instance-create-i1a-token-ok", 1492 merchant_url, 1493 "i1a", 1494 "write", /* scope */ 1495 GNUNET_TIME_UNIT_DAYS, /* duration */ 1496 GNUNET_YES, /* refreshable */ 1497 MHD_HTTP_OK), 1498 TALER_TESTING_cmd_set_authorization ("unset-auth-valid", 1499 NULL), // Unset header 1500 TALER_TESTING_cmd_merchant_set_instance_token ( 1501 "instance-create-i1a-token-set", 1502 "instance-create-i1a-token-ok"), 1503 TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-4", 1504 merchant_url_i1a, 1505 "nx-product", 1506 MHD_HTTP_NOT_FOUND, 1507 NULL), 1508 TALER_TESTING_cmd_merchant_get_products ("get-i1a-products-empty-4", 1509 merchant_url_i1a, 1510 MHD_HTTP_OK, 1511 NULL), 1512 TALER_TESTING_cmd_merchant_delete_instance_token ( 1513 "instance-create-i1a-token-delete", 1514 merchant_url, 1515 "i1a", 1516 MHD_HTTP_NO_CONTENT), 1517 TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-5", 1518 merchant_url_i1a, 1519 "nx-product", 1520 MHD_HTTP_UNAUTHORIZED, 1521 NULL), 1522 TALER_TESTING_cmd_merchant_get_products ("get-i1a-products-empty-5", 1523 merchant_url_i1a, 1524 MHD_HTTP_UNAUTHORIZED, 1525 NULL), 1526 TALER_TESTING_cmd_merchant_purge_instance ("instance-delete-i1a-fail", 1527 merchant_url_i1a, 1528 NULL, 1529 MHD_HTTP_UNAUTHORIZED), 1530 TALER_TESTING_cmd_set_authorization ("set-token-auth-valid-again", 1531 "Basic aTFhOm15LXNlY3JldA=="), 1532 TALER_TESTING_cmd_merchant_post_instance_token ( 1533 "set-auth-valid-again", 1534 merchant_url, 1535 "i1a", 1536 "write", /* scope */ 1537 GNUNET_TIME_UNIT_DAYS, /* duration */ 1538 GNUNET_YES, /* refreshable */ 1539 MHD_HTTP_OK), 1540 TALER_TESTING_cmd_set_authorization ("unset-auth-valid2", 1541 NULL), // Unset header 1542 TALER_TESTING_cmd_merchant_set_instance_token ( 1543 "instance-create-i1a-token-set-again", 1544 "set-auth-valid-again"), 1545 TALER_TESTING_cmd_merchant_post_instance_auth ( 1546 "instance-create-i1a-auth-ok-idempotent", 1547 merchant_url_i1a, 1548 NULL, 1549 RFC_8959_PREFIX "my-other-secret", 1550 MHD_HTTP_NO_CONTENT), 1551 TALER_TESTING_cmd_merchant_post_instance_auth ( 1552 "instance-create-i1a-clear-auth", 1553 merchant_url_i1a, 1554 NULL, 1555 NULL, 1556 MHD_HTTP_NO_CONTENT), 1557 TALER_TESTING_cmd_set_authorization ("set-auth-none", 1558 NULL), 1559 TALER_TESTING_cmd_merchant_purge_instance ("instance-delete-i1a", 1560 merchant_url_i1a, 1561 NULL, 1562 MHD_HTTP_NO_CONTENT), 1563 TALER_TESTING_cmd_end () 1564 }; 1565 1566 struct TALER_TESTING_Command pay_again[] = { 1567 cmd_transfer_to_exchange ("create-reserve-20", 1568 "EUR:20.04"), 1569 cmd_exec_wirewatch ("wirewatch-20"), 1570 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-10", 1571 "EUR:20.04", 1572 payer_payto, 1573 exchange_payto, 1574 "create-reserve-20"), 1575 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10a", 1576 "create-reserve-20", 1577 "EUR:5", 1578 0, 1579 MHD_HTTP_OK), 1580 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10b", 1581 "create-reserve-20", 1582 "EUR:5", 1583 0, 1584 MHD_HTTP_OK), 1585 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10c", 1586 "create-reserve-20", 1587 "EUR:5", 1588 0, 1589 MHD_HTTP_OK), 1590 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10d", 1591 "create-reserve-20", 1592 "EUR:5", 1593 0, 1594 MHD_HTTP_OK), 1595 TALER_TESTING_cmd_status ("withdraw-status-20", 1596 "create-reserve-20", 1597 "EUR:0", 1598 MHD_HTTP_OK), 1599 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-10", 1600 cred.cfg, 1601 merchant_url, 1602 MHD_HTTP_OK, 1603 "10", 1604 GNUNET_TIME_UNIT_ZERO_TS, 1605 GNUNET_TIME_UNIT_FOREVER_TS, 1606 "EUR:10.0"), 1607 TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-10", 1608 merchant_url, 1609 MHD_HTTP_CONFLICT, 1610 "create-proposal-10", 1611 "withdraw-coin-10a;withdraw-coin-1", 1612 "EUR:5", 1613 "EUR:4.99", 1614 NULL), 1615 TALER_TESTING_cmd_merchant_pay_order ("pay-again-10", 1616 merchant_url, 1617 MHD_HTTP_OK, 1618 "create-proposal-10", 1619 "withdraw-coin-10a;withdraw-coin-10b", 1620 "EUR:5", 1621 "EUR:4.99", 1622 NULL), 1623 TALER_TESTING_cmd_merchant_pay_order ("pay-too-much-10", 1624 merchant_url, 1625 MHD_HTTP_CONFLICT, 1626 "create-proposal-10", 1627 "withdraw-coin-10c;withdraw-coin-10d", 1628 "EUR:5", 1629 "EUR:4.99", 1630 NULL), 1631 TALER_TESTING_cmd_sleep ( 1632 "Wait for wire transfer deadline", 1633 3), 1634 CMD_EXEC_AGGREGATOR ("run-aggregator-10"), 1635 TALER_TESTING_cmd_check_bank_transfer ("check_bank_transfer-9.97-10", 1636 EXCHANGE_URL, 1637 "EUR:9.97", 1638 exchange_payto, 1639 merchant_payto), 1640 TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-10"), 1641 TALER_TESTING_cmd_end () 1642 }; 1643 1644 struct TALER_TESTING_Command pay_abort[] = { 1645 cmd_transfer_to_exchange ("create-reserve-11", 1646 "EUR:10.02"), 1647 cmd_exec_wirewatch ("wirewatch-11"), 1648 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-11", 1649 "EUR:10.02", 1650 payer_payto, 1651 exchange_payto, 1652 "create-reserve-11"), 1653 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-11a", 1654 "create-reserve-11", 1655 "EUR:5", 1656 0, 1657 MHD_HTTP_OK), 1658 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-11b", 1659 "create-reserve-11", 1660 "EUR:5", 1661 0, 1662 MHD_HTTP_OK), 1663 TALER_TESTING_cmd_status ("withdraw-status-11", 1664 "create-reserve-11", 1665 "EUR:0", 1666 MHD_HTTP_OK), 1667 TALER_TESTING_cmd_merchant_post_orders ("create-proposal-11", 1668 cred.cfg, 1669 merchant_url, 1670 MHD_HTTP_OK, 1671 "11", 1672 GNUNET_TIME_UNIT_ZERO_TS, 1673 GNUNET_TIME_UNIT_FOREVER_TS, 1674 "EUR:10.0"), 1675 TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-11-good", 1676 merchant_url, 1677 MHD_HTTP_BAD_REQUEST, 1678 "create-proposal-11", 1679 "withdraw-coin-11a", 1680 "EUR:5", 1681 "EUR:4.99", 1682 NULL), 1683 TALER_TESTING_cmd_merchant_pay_order ("pay-fail-partial-double-11-bad", 1684 merchant_url, 1685 MHD_HTTP_CONFLICT, 1686 "create-proposal-11", 1687 "withdraw-coin-1", 1688 "EUR:5", 1689 "EUR:4.99", 1690 NULL), 1691 TALER_TESTING_cmd_merchant_order_abort ("pay-abort-11", 1692 merchant_url, 1693 "pay-fail-partial-double-11-good", 1694 MHD_HTTP_OK), 1695 TALER_TESTING_cmd_sleep ( 1696 "Wait for wire transfer deadline", 1697 3), 1698 CMD_EXEC_AGGREGATOR ("run-aggregator-11"), 1699 TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-11"), 1700 TALER_TESTING_cmd_end () 1701 }; 1702 1703 struct TALER_TESTING_Command templates[] = { 1704 cmd_transfer_to_exchange ("create-reserve-20x", 1705 "EUR:20.04"), 1706 cmd_exec_wirewatch ("wirewatch-20x"), 1707 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-20x", 1708 "EUR:20.04", 1709 payer_payto, 1710 exchange_payto, 1711 "create-reserve-20x"), 1712 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xa", 1713 "create-reserve-20x", 1714 "EUR:5", 1715 0, 1716 MHD_HTTP_OK), 1717 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xb", 1718 "create-reserve-20x", 1719 "EUR:5", 1720 0, 1721 MHD_HTTP_OK), 1722 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xc", 1723 "create-reserve-20x", 1724 "EUR:5", 1725 0, 1726 MHD_HTTP_OK), 1727 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-xd", 1728 "create-reserve-20x", 1729 "EUR:5", 1730 0, 1731 MHD_HTTP_OK), 1732 TALER_TESTING_cmd_status ("withdraw-status-20x", 1733 "create-reserve-20x", 1734 "EUR:0", 1735 MHD_HTTP_OK), 1736 TALER_TESTING_cmd_merchant_get_templates ("get-templates-empty", 1737 merchant_url, 1738 MHD_HTTP_OK, 1739 NULL), 1740 TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1", 1741 merchant_url, 1742 "template-1", 1743 "a template", 1744 MHD_HTTP_NO_CONTENT), 1745 TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-idem", 1746 merchant_url, 1747 "template-1", 1748 "a template", 1749 MHD_HTTP_NO_CONTENT), 1750 TALER_TESTING_cmd_merchant_post_templates ("post-templates-t1-non-idem", 1751 merchant_url, 1752 "template-1", 1753 "a different template", 1754 MHD_HTTP_CONFLICT), 1755 TALER_TESTING_cmd_merchant_get_templates ("get-templates-t1", 1756 merchant_url, 1757 MHD_HTTP_OK, 1758 "post-templates-t1", 1759 NULL), 1760 TALER_TESTING_cmd_merchant_get_template ("get-template-t1", 1761 merchant_url, 1762 "template-1", 1763 MHD_HTTP_OK, 1764 "post-templates-t1"), 1765 TALER_TESTING_cmd_merchant_post_templates ("post-templates-t2", 1766 merchant_url, 1767 "template-2", 1768 "a template", 1769 MHD_HTTP_NO_CONTENT), 1770 TALER_TESTING_cmd_merchant_patch_template ( 1771 "patch-templates-t2", 1772 merchant_url, 1773 "template-2", 1774 "another template", 1775 NULL, 1776 GNUNET_JSON_PACK ( 1777 GNUNET_JSON_pack_uint64 ("minimum_age", 0), 1778 GNUNET_JSON_pack_time_rel ("pay_duration", 1779 GNUNET_TIME_UNIT_MINUTES)), 1780 MHD_HTTP_NO_CONTENT), 1781 TALER_TESTING_cmd_merchant_get_template ("get-template-t2", 1782 merchant_url, 1783 "template-2", 1784 MHD_HTTP_OK, 1785 "patch-templates-t2"), 1786 TALER_TESTING_cmd_merchant_get_template ("get-template-nx", 1787 merchant_url, 1788 "template-nx", 1789 MHD_HTTP_NOT_FOUND, 1790 NULL), 1791 TALER_TESTING_cmd_merchant_post_otp_devices ( 1792 "post-otp-device", 1793 merchant_url, 1794 "otp-dev", 1795 "my OTP device", 1796 "FEE4P2J", 1797 TALER_MCA_WITH_PRICE, 1798 0, 1799 MHD_HTTP_NO_CONTENT), 1800 TALER_TESTING_cmd_merchant_patch_template ( 1801 "patch-templates-t3-nx", 1802 merchant_url, 1803 "template-3", 1804 "updated template", 1805 "otp-dev", 1806 GNUNET_JSON_PACK ( 1807 GNUNET_JSON_pack_uint64 ("minimum_age", 0), 1808 GNUNET_JSON_pack_time_rel ("pay_duration", 1809 GNUNET_TIME_UNIT_MINUTES)), 1810 MHD_HTTP_NOT_FOUND), 1811 TALER_TESTING_cmd_merchant_post_templates2 ( 1812 "post-templates-t3-amount", 1813 merchant_url, 1814 "template-amount", 1815 "a different template with an amount", 1816 NULL, 1817 GNUNET_JSON_PACK ( 1818 GNUNET_JSON_pack_uint64 ("minimum_age", 0), 1819 GNUNET_JSON_pack_time_rel ("pay_duration", 1820 GNUNET_TIME_UNIT_MINUTES), 1821 GNUNET_JSON_pack_string ("amount", 1822 "EUR:4")), 1823 MHD_HTTP_NO_CONTENT), 1824 TALER_TESTING_cmd_merchant_post_using_templates ( 1825 "using-templates-t1", 1826 "post-templates-t1", 1827 NULL, 1828 merchant_url, 1829 "1", 1830 "summary-1", 1831 "EUR:9.98", 1832 GNUNET_TIME_UNIT_ZERO_TS, 1833 GNUNET_TIME_UNIT_FOREVER_TS, 1834 MHD_HTTP_OK), 1835 TALER_TESTING_cmd_merchant_post_using_templates ( 1836 "using-templates-t1-amount-missing", 1837 "post-templates-t1", 1838 NULL, 1839 merchant_url, 1840 "2", 1841 "summary-1", 1842 NULL, 1843 GNUNET_TIME_UNIT_ZERO_TS, 1844 GNUNET_TIME_UNIT_FOREVER_TS, 1845 MHD_HTTP_CONFLICT), 1846 TALER_TESTING_cmd_merchant_post_using_templates ( 1847 "using-templates-t1-summary-missing", 1848 "post-templates-t1", 1849 NULL, 1850 merchant_url, 1851 "3", 1852 NULL, 1853 "EUR:10", 1854 GNUNET_TIME_UNIT_ZERO_TS, 1855 GNUNET_TIME_UNIT_FOREVER_TS, 1856 MHD_HTTP_CONFLICT), 1857 TALER_TESTING_cmd_merchant_post_using_templates ( 1858 "using-templates-t1-amount-conflict", 1859 "post-templates-t3-amount", 1860 NULL, 1861 merchant_url, 1862 "4", 1863 "summary-1", 1864 "EUR:10", 1865 GNUNET_TIME_UNIT_ZERO_TS, 1866 GNUNET_TIME_UNIT_FOREVER_TS, 1867 MHD_HTTP_CONFLICT), 1868 TALER_TESTING_cmd_merchant_post_using_templates ( 1869 "using-templates-t1-amount-duplicate", 1870 "post-templates-t3-amount", 1871 NULL, 1872 merchant_url, 1873 "4", 1874 "summary-1", 1875 "EUR:4", 1876 GNUNET_TIME_UNIT_ZERO_TS, 1877 GNUNET_TIME_UNIT_FOREVER_TS, 1878 MHD_HTTP_CONFLICT), 1879 TALER_TESTING_cmd_merchant_pay_order ("pay-100", 1880 merchant_url, 1881 MHD_HTTP_OK, 1882 "using-templates-t1", 1883 "withdraw-coin-xa;withdraw-coin-xb", 1884 "EUR:4.99", 1885 "EUR:4.99", 1886 NULL), 1887 TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty", 1888 merchant_url, 1889 "t1", 1890 MHD_HTTP_NOT_FOUND), 1891 TALER_TESTING_cmd_merchant_delete_template ("get-templates-empty", 1892 merchant_url, 1893 "template-1", 1894 MHD_HTTP_NO_CONTENT), 1895 TALER_TESTING_cmd_merchant_post_using_templates ( 1896 "post-templates-t1-deleted", 1897 "post-templates-t1", 1898 NULL, 1899 merchant_url, 1900 "0", 1901 "summary-1", 1902 "EUR:5", 1903 GNUNET_TIME_UNIT_ZERO_TS, 1904 GNUNET_TIME_UNIT_FOREVER_TS, 1905 MHD_HTTP_NOT_FOUND), 1906 TALER_TESTING_cmd_merchant_post_otp_devices ( 1907 "post-otp-device", 1908 merchant_url, 1909 "otp-dev-2", 1910 "my OTP device", 1911 "secret", 1912 TALER_MCA_WITH_PRICE, 1913 0, 1914 MHD_HTTP_NO_CONTENT), 1915 TALER_TESTING_cmd_merchant_post_templates2 ( 1916 "post-templates-with-pos-key", 1917 merchant_url, 1918 "template-key", 1919 "a different template with POS KEY", 1920 "otp-dev-2", 1921 GNUNET_JSON_PACK ( 1922 GNUNET_JSON_pack_uint64 ("minimum_age", 0), 1923 GNUNET_JSON_pack_time_rel ("pay_duration", 1924 GNUNET_TIME_UNIT_MINUTES)), 1925 MHD_HTTP_NO_CONTENT), 1926 1927 TALER_TESTING_cmd_merchant_post_using_templates ( 1928 "using-templates-pos-key", 1929 "post-templates-with-pos-key", 1930 "post-otp-device", 1931 merchant_url, 1932 "1", 1933 "summary-1-pos", 1934 "EUR:9.98", 1935 GNUNET_TIME_UNIT_ZERO_TS, 1936 GNUNET_TIME_UNIT_FOREVER_TS, 1937 MHD_HTTP_OK), 1938 TALER_TESTING_cmd_merchant_pay_order ("pay-with-pos", 1939 merchant_url, 1940 MHD_HTTP_OK, 1941 "using-templates-pos-key", 1942 "withdraw-coin-xc;withdraw-coin-xd", 1943 "EUR:4.99", 1944 "EUR:4.99", 1945 NULL), 1946 cmd_transfer_to_exchange ("create-reserve-20y", 1947 "EUR:10.02"), 1948 cmd_exec_wirewatch ("wirewatch-20y"), 1949 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-20y", 1950 "EUR:10.02", 1951 payer_payto, 1952 exchange_payto, 1953 "create-reserve-20y"), 1954 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-yk", 1955 "create-reserve-20y", 1956 "EUR:5", 1957 0, 1958 MHD_HTTP_OK), 1959 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-ykb", 1960 "create-reserve-20y", 1961 "EUR:5", 1962 0, 1963 MHD_HTTP_OK), 1964 TALER_TESTING_cmd_status ("withdraw-status-20y", 1965 "create-reserve-20y", 1966 "EUR:0", 1967 MHD_HTTP_OK), 1968 TALER_TESTING_cmd_merchant_post_products_with_unit_prices ( 1969 "post-products-inv-1", 1970 merchant_url, 1971 "inv-product-1", 1972 "Inventory Product One", 1973 "test-unit", 1974 (const char *[]) { "EUR:1", "KUDOS:1" }, 1975 2, 1976 MHD_HTTP_NO_CONTENT), 1977 TALER_TESTING_cmd_merchant_post_products_with_unit_prices ( 1978 "post-products-inv-2", 1979 merchant_url, 1980 "inv-product-2", 1981 "Inventory Product Two", 1982 "test-unit", 1983 (const char *[]) { "EUR:2", "KUDOS:2" }, 1984 2, 1985 MHD_HTTP_NO_CONTENT), 1986 TALER_TESTING_cmd_merchant_post_templates2 ( 1987 "post-templates-inv-one", 1988 merchant_url, 1989 "template-inv-one", 1990 "inventory template one", 1991 NULL, 1992 GNUNET_JSON_PACK ( 1993 GNUNET_JSON_pack_string ("template_type", 1994 "inventory-cart"), 1995 GNUNET_JSON_pack_string ("summary", 1996 "inventory template"), 1997 GNUNET_JSON_pack_time_rel ("pay_duration", 1998 GNUNET_TIME_UNIT_MINUTES), 1999 GNUNET_JSON_pack_array_steal ( 2000 "selected_products", 2001 make_selected_products ("inv-product-1", 2002 "inv-product-2")), 2003 GNUNET_JSON_pack_bool ("choose_one", 2004 true)), 2005 MHD_HTTP_NO_CONTENT), 2006 TALER_TESTING_cmd_merchant_wallet_get_template ( 2007 "wallet-get-template-inv-one", 2008 merchant_url, 2009 "template-inv-one", 2010 0, 2011 NULL, 2012 NULL, 2013 false, 2014 0, 2015 NULL, 2016 NULL, 2017 NULL, 2018 0, 2019 0, 2020 MHD_HTTP_OK), 2021 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2022 "using-templates-inv-one", 2023 "post-templates-inv-one", 2024 NULL, 2025 merchant_url, 2026 "inv-1", 2027 GNUNET_JSON_PACK ( 2028 GNUNET_JSON_pack_string ("amount", 2029 "EUR:1"), 2030 GNUNET_JSON_pack_string ("template_type", 2031 "inventory-cart"), 2032 GNUNET_JSON_pack_array_steal ( 2033 "inventory_selection", 2034 make_inventory_selection ("inv-product-1", 2035 "1.0", 2036 NULL, 2037 NULL))), 2038 MHD_HTTP_OK), 2039 TALER_TESTING_cmd_merchant_post_templates2 ( 2040 "post-templates-inv-multi", 2041 merchant_url, 2042 "template-inv-multi", 2043 "inventory template multi", 2044 NULL, 2045 GNUNET_JSON_PACK ( 2046 GNUNET_JSON_pack_string ("template_type", 2047 "inventory-cart"), 2048 GNUNET_JSON_pack_string ("summary", 2049 "inventory template multi"), 2050 GNUNET_JSON_pack_time_rel ("pay_duration", 2051 GNUNET_TIME_UNIT_MINUTES), 2052 GNUNET_JSON_pack_array_steal ( 2053 "selected_products", 2054 make_selected_products ("inv-product-1", 2055 "inv-product-2"))), 2056 MHD_HTTP_NO_CONTENT), 2057 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2058 "using-templates-inv-multi", 2059 "post-templates-inv-multi", 2060 NULL, 2061 merchant_url, 2062 "inv-2", 2063 GNUNET_JSON_PACK ( 2064 GNUNET_JSON_pack_string ("amount", 2065 "EUR:3"), 2066 GNUNET_JSON_pack_string ("template_type", 2067 "inventory-cart"), 2068 GNUNET_JSON_pack_array_steal ( 2069 "inventory_selection", 2070 make_inventory_selection ("inv-product-1", 2071 "1.0", 2072 "inv-product-2", 2073 "1.0"))), 2074 MHD_HTTP_OK), 2075 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2076 "using-templates-inv-one-empty", 2077 "post-templates-inv-one", 2078 NULL, 2079 merchant_url, 2080 "inv-1-empty", 2081 GNUNET_JSON_PACK ( 2082 GNUNET_JSON_pack_string ("amount", 2083 "EUR:1"), 2084 GNUNET_JSON_pack_string ("template_type", 2085 "inventory-cart"), 2086 GNUNET_JSON_pack_array_steal ( 2087 "inventory_selection", 2088 json_array ())), 2089 MHD_HTTP_CONFLICT), 2090 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2091 "using-templates-inv-one-two", 2092 "post-templates-inv-one", 2093 NULL, 2094 merchant_url, 2095 "inv-1-two", 2096 GNUNET_JSON_PACK ( 2097 GNUNET_JSON_pack_string ("amount", 2098 "EUR:3"), 2099 GNUNET_JSON_pack_string ("template_type", 2100 "inventory-cart"), 2101 GNUNET_JSON_pack_array_steal ( 2102 "inventory_selection", 2103 make_inventory_selection ("inv-product-1", 2104 "1.0", 2105 "inv-product-2", 2106 "1.0"))), 2107 MHD_HTTP_CONFLICT), 2108 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2109 "using-templates-inv-one-tip", 2110 "post-templates-inv-one", 2111 NULL, 2112 merchant_url, 2113 "inv-1-tip", 2114 GNUNET_JSON_PACK ( 2115 GNUNET_JSON_pack_string ("amount", 2116 "EUR:1"), 2117 GNUNET_JSON_pack_string ("tip", 2118 "EUR:1"), 2119 GNUNET_JSON_pack_string ("template_type", 2120 "inventory-cart"), 2121 GNUNET_JSON_pack_array_steal ( 2122 "inventory_selection", 2123 make_inventory_selection ("inv-product-1", 2124 "1.0", 2125 NULL, 2126 NULL))), 2127 MHD_HTTP_CONFLICT), 2128 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2129 "using-templates-inv-one-tip-ok", 2130 "post-templates-inv-one", 2131 NULL, 2132 merchant_url, 2133 "inv-1-tip-ok", 2134 GNUNET_JSON_PACK ( 2135 GNUNET_JSON_pack_string ("amount", 2136 "EUR:2"), 2137 GNUNET_JSON_pack_string ("tip", 2138 "EUR:1"), 2139 GNUNET_JSON_pack_string ("template_type", 2140 "inventory-cart"), 2141 GNUNET_JSON_pack_array_steal ( 2142 "inventory_selection", 2143 make_inventory_selection ("inv-product-1", 2144 "1.0", 2145 NULL, 2146 NULL))), 2147 MHD_HTTP_OK), 2148 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2149 "using-templates-inv-one-unknown", 2150 "post-templates-inv-one", 2151 NULL, 2152 merchant_url, 2153 "inv-1-unknown", 2154 GNUNET_JSON_PACK ( 2155 GNUNET_JSON_pack_string ("amount", 2156 "EUR:1"), 2157 GNUNET_JSON_pack_string ("template_type", 2158 "inventory-cart"), 2159 GNUNET_JSON_pack_array_steal ( 2160 "inventory_selection", 2161 make_inventory_selection ("inv-product-404", 2162 "1.0", 2163 NULL, 2164 NULL))), 2165 MHD_HTTP_NOT_FOUND), 2166 TALER_TESTING_cmd_merchant_post_templates2 ( 2167 "post-templates-inv-only", 2168 merchant_url, 2169 "template-inv-only", 2170 "inventory template only", 2171 NULL, 2172 GNUNET_JSON_PACK ( 2173 GNUNET_JSON_pack_string ("template_type", 2174 "inventory-cart"), 2175 GNUNET_JSON_pack_string ("summary", 2176 "inventory template only"), 2177 GNUNET_JSON_pack_time_rel ("pay_duration", 2178 GNUNET_TIME_UNIT_MINUTES), 2179 GNUNET_JSON_pack_array_steal ( 2180 "selected_products", 2181 make_selected_products ("inv-product-1", 2182 NULL))), 2183 MHD_HTTP_NO_CONTENT), 2184 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2185 "using-templates-inv-only-wrong", 2186 "post-templates-inv-only", 2187 NULL, 2188 merchant_url, 2189 "inv-only-wrong", 2190 GNUNET_JSON_PACK ( 2191 GNUNET_JSON_pack_string ("amount", 2192 "EUR:2"), 2193 GNUNET_JSON_pack_string ("template_type", 2194 "inventory-cart"), 2195 GNUNET_JSON_pack_array_steal ( 2196 "inventory_selection", 2197 make_inventory_selection ("inv-product-2", 2198 "1.0", 2199 NULL, 2200 NULL))), 2201 MHD_HTTP_CONFLICT), 2202 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2203 "using-templates-inv-multi-amount-mismatch", 2204 "post-templates-inv-multi", 2205 NULL, 2206 merchant_url, 2207 "inv-2-mismatch", 2208 GNUNET_JSON_PACK ( 2209 GNUNET_JSON_pack_string ("amount", 2210 "EUR:4"), 2211 GNUNET_JSON_pack_string ("template_type", 2212 "inventory-cart"), 2213 GNUNET_JSON_pack_array_steal ( 2214 "inventory_selection", 2215 make_inventory_selection ("inv-product-1", 2216 "1.0", 2217 "inv-product-2", 2218 "1.0"))), 2219 MHD_HTTP_CONFLICT), 2220 TALER_TESTING_cmd_merchant_post_units ("post-unit-special", 2221 merchant_url, 2222 "special-unit", 2223 "Special Unit", 2224 "sunit", 2225 true, 2226 1, 2227 true, 2228 json_pack ("{s:s}", 2229 "en", 2230 "Special Unit"), 2231 json_pack ("{s:s}", 2232 "en", 2233 "sunit"), 2234 MHD_HTTP_NO_CONTENT), 2235 TALER_TESTING_cmd_merchant_post_categories ("post-category-special", 2236 merchant_url, 2237 "Category Special", 2238 json_pack ("{s:s}", 2239 "en", 2240 "Category Special"), 2241 1, 2242 MHD_HTTP_OK), 2243 TALER_TESTING_cmd_merchant_post_categories ("post-category-special-2", 2244 merchant_url, 2245 "Category Special Two", 2246 json_pack ("{s:s}", 2247 "en", 2248 "Category Special Two"), 2249 2, 2250 MHD_HTTP_OK), 2251 TALER_TESTING_cmd_merchant_post_products_with_categories ( 2252 "post-products-inv-unit-1", 2253 merchant_url, 2254 "inv-unit-product-1", 2255 "Inventory Unit Product One", 2256 "special-unit", 2257 "EUR:5", 2258 1, 2259 (const uint64_t[]) { 1 }, 2260 true, 2261 1, 2262 MHD_HTTP_NO_CONTENT), 2263 TALER_TESTING_cmd_merchant_post_products2 ( 2264 "post-products-inv-unit-2", 2265 merchant_url, 2266 "inv-unit-product-2", 2267 "Inventory Unit Product Two", 2268 json_pack ("{s:s}", "en", "Inventory Unit Product Two"), 2269 "test-unit", 2270 "EUR:1.2", 2271 "", 2272 json_array (), 2273 -1, /* total stock: infinite */ 2274 0, /* minimum age */ 2275 json_pack ("{s:s}", "street", "my street"), 2276 GNUNET_TIME_UNIT_ZERO_TS, 2277 MHD_HTTP_NO_CONTENT), 2278 TALER_TESTING_cmd_merchant_post_products_with_categories ( 2279 "post-products-inv-unit-3", 2280 merchant_url, 2281 "inv-unit-product-3", 2282 "Inventory Unit Product Three", 2283 "test-unit", 2284 "EUR:9", 2285 1, 2286 (const uint64_t[]) { 2 }, 2287 false, 2288 0, 2289 MHD_HTTP_NO_CONTENT), 2290 TALER_TESTING_cmd_merchant_post_templates2 ( 2291 "post-templates-inv-cat-prod-unit", 2292 merchant_url, 2293 "template-inv-cat-prod-unit", 2294 "inventory template category+product unit", 2295 NULL, 2296 GNUNET_JSON_PACK ( 2297 GNUNET_JSON_pack_string ("template_type", 2298 "inventory-cart"), 2299 GNUNET_JSON_pack_string ("summary", 2300 "inventory template category+product unit"), 2301 GNUNET_JSON_pack_time_rel ("pay_duration", 2302 GNUNET_TIME_UNIT_MINUTES), 2303 GNUNET_JSON_pack_array_steal ( 2304 "selected_categories", 2305 make_selected_categories (1, 2306 0)), 2307 GNUNET_JSON_pack_array_steal ( 2308 "selected_products", 2309 make_selected_products ("inv-unit-product-2", 2310 "inv-unit-product-3"))), 2311 MHD_HTTP_NO_CONTENT), 2312 TALER_TESTING_cmd_merchant_wallet_get_template ( 2313 "wallet-get-template-inv-cat-prod-unit", 2314 merchant_url, 2315 "template-inv-cat-prod-unit", 2316 3, 2317 "inv-unit-product-1", 2318 "special-unit", 2319 true, 2320 1, 2321 json_pack ("{s:s}", 2322 "en", 2323 "sunit"), 2324 "inv-unit-product-2", 2325 "inv-unit-product-3", 2326 1, 2327 2, 2328 MHD_HTTP_OK), 2329 TALER_TESTING_cmd_merchant_post_using_templates2 ( 2330 "using-templates-inv-cat-prod-unit", 2331 "post-templates-inv-cat-prod-unit", 2332 NULL, 2333 merchant_url, 2334 "inv-cat-prod-unit", 2335 GNUNET_JSON_PACK ( 2336 GNUNET_JSON_pack_string ("amount", 2337 "EUR:3.2"), 2338 GNUNET_JSON_pack_string ("template_type", 2339 "inventory-cart"), 2340 GNUNET_JSON_pack_array_steal ( 2341 "inventory_selection", 2342 make_inventory_selection ("inv-unit-product-1", 2343 "0.4", 2344 "inv-unit-product-2", 2345 "1"))), 2346 MHD_HTTP_OK), 2347 TALER_TESTING_cmd_merchant_pay_order_choices ( 2348 "pay-inv-cat-prod-unit", 2349 merchant_url, 2350 MHD_HTTP_OK, 2351 "using-templates-inv-cat-prod-unit", 2352 "withdraw-coin-yk", 2353 "EUR:3.2", 2354 "EUR:3.2", 2355 NULL, 2356 0, 2357 NULL), 2358 2359 2360 TALER_TESTING_cmd_end () 2361 }; 2362 2363 struct TALER_TESTING_Command webhooks[] = { 2364 TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-empty", 2365 merchant_url, 2366 MHD_HTTP_OK, 2367 NULL), 2368 TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1", 2369 merchant_url, 2370 "webhook-1", 2371 "Paid", 2372 MHD_HTTP_NO_CONTENT), 2373 TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1-idem", 2374 merchant_url, 2375 "webhook-1", 2376 "Paid", 2377 MHD_HTTP_NO_CONTENT), 2378 TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w1-non-idem", 2379 merchant_url, 2380 "webhook-1", 2381 "Refund", 2382 MHD_HTTP_CONFLICT), 2383 TALER_TESTING_cmd_merchant_get_webhooks ("get-webhooks-w1", 2384 merchant_url, 2385 MHD_HTTP_OK, 2386 "post-webhooks-w1", 2387 NULL), 2388 TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-w1", 2389 merchant_url, 2390 "webhook-1", 2391 MHD_HTTP_OK, 2392 "post-webhooks-w1"), 2393 TALER_TESTING_cmd_merchant_post_webhooks ("post-webhooks-w2", 2394 merchant_url, 2395 "webhook-2", 2396 "Paid", 2397 MHD_HTTP_NO_CONTENT), 2398 TALER_TESTING_cmd_merchant_patch_webhook ("patch-webhooks-w2", 2399 merchant_url, 2400 "webhook-2", 2401 "Refund2", 2402 "http://localhost:38188/", 2403 "POST", 2404 "Authorization:WHWOXZXPLL", 2405 "Amount", 2406 MHD_HTTP_NO_CONTENT), 2407 TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-w2", 2408 merchant_url, 2409 "webhook-2", 2410 MHD_HTTP_OK, 2411 "patch-webhooks-w2"), 2412 TALER_TESTING_cmd_merchant_get_webhook ("get-webhook-nx", 2413 merchant_url, 2414 "webhook-nx", 2415 MHD_HTTP_NOT_FOUND, 2416 NULL), 2417 TALER_TESTING_cmd_merchant_patch_webhook ("patch-webhooks-w3-nx", 2418 merchant_url, 2419 "webhook-3", 2420 "Paid2", 2421 "https://example.com", 2422 "POST", 2423 "Authorization:WHWOXZXPLL", 2424 "Amount", 2425 MHD_HTTP_NOT_FOUND), 2426 TALER_TESTING_cmd_merchant_delete_webhook ("get-webhooks-empty", 2427 merchant_url, 2428 "w1", 2429 MHD_HTTP_NOT_FOUND), 2430 TALER_TESTING_cmd_merchant_delete_webhook ("get-webhooks-empty", 2431 merchant_url, 2432 "webhook-1", 2433 MHD_HTTP_NO_CONTENT), 2434 TALER_TESTING_cmd_end () 2435 }; 2436 struct TALER_TESTING_Command inventory_webhooks[] = { 2437 TALER_TESTING_cmd_testserver ( 2438 "launch-http-server-for-inventory-webhooks", 2439 12346), 2440 TALER_TESTING_cmd_merchant_post_webhooks2 ( 2441 "post-webhooks-inventory-added", 2442 merchant_url, 2443 "webhook-inventory-added", 2444 "inventory_added", 2445 "http://localhost:12346/", 2446 "POST", 2447 "Taler-test-header: inventory", 2448 "inventory-added", 2449 MHD_HTTP_NO_CONTENT), 2450 TALER_TESTING_cmd_merchant_post_webhooks2 ( 2451 "post-webhooks-inventory-updated", 2452 merchant_url, 2453 "webhook-inventory-updated", 2454 "inventory_updated", 2455 "http://localhost:12346/", 2456 "POST", 2457 "Taler-test-header: inventory", 2458 "inventory-updated", 2459 MHD_HTTP_NO_CONTENT), 2460 TALER_TESTING_cmd_merchant_post_webhooks2 ( 2461 "post-webhooks-inventory-deleted", 2462 merchant_url, 2463 "webhook-inventory-deleted", 2464 "inventory_deleted", 2465 "http://localhost:12346/", 2466 "POST", 2467 "Taler-test-header: inventory", 2468 "inventory-deleted", 2469 MHD_HTTP_NO_CONTENT), 2470 TALER_TESTING_cmd_merchant_post_products ( 2471 "post-product-inventory-hook", 2472 merchant_url, 2473 "product-inventory-hook", 2474 "webhook inventory product", 2475 "EUR:1", 2476 MHD_HTTP_NO_CONTENT), 2477 cmd_webhook ("pending-webhooks-inventory-added"), 2478 TALER_TESTING_cmd_checkserver2 ( 2479 "check-inventory-webhook-added", 2480 "launch-http-server-for-inventory-webhooks", 2481 0, 2482 "/", 2483 "POST", 2484 NULL, 2485 "inventory-added"), 2486 TALER_TESTING_cmd_merchant_patch_product ( 2487 "patch-product-inventory-hook", 2488 merchant_url, 2489 "product-inventory-hook", 2490 "webhook inventory product patched", 2491 json_object (), 2492 "unit", 2493 "EUR:2", 2494 "", 2495 json_array (), 2496 5, 2497 0, 2498 json_object (), 2499 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), 2500 MHD_HTTP_NO_CONTENT), 2501 cmd_webhook ("pending-webhooks-inventory-updated"), 2502 TALER_TESTING_cmd_checkserver2 ( 2503 "check-inventory-webhook-updated", 2504 "launch-http-server-for-inventory-webhooks", 2505 1, 2506 "/", 2507 "POST", 2508 NULL, 2509 "inventory-updated"), 2510 TALER_TESTING_cmd_merchant_delete_product ( 2511 "delete-product-inventory-hook", 2512 merchant_url, 2513 "product-inventory-hook", 2514 MHD_HTTP_NO_CONTENT), 2515 cmd_webhook ("pending-webhooks-inventory-deleted"), 2516 TALER_TESTING_cmd_checkserver2 ( 2517 "check-inventory-webhook-deleted", 2518 "launch-http-server-for-inventory-webhooks", 2519 2, 2520 "/", 2521 "POST", 2522 NULL, 2523 "inventory-deleted"), 2524 TALER_TESTING_cmd_end () 2525 }; 2526 struct TALER_TESTING_Command repurchase[] = { 2527 cmd_transfer_to_exchange ( 2528 "create-reserve-30x", 2529 "EUR:30.06"), 2530 cmd_exec_wirewatch ( 2531 "wirewatch-30x"), 2532 TALER_TESTING_cmd_check_bank_admin_transfer ( 2533 "check_bank_transfer-30x", 2534 "EUR:30.06", 2535 payer_payto, 2536 exchange_payto, 2537 "create-reserve-30x"), 2538 TALER_TESTING_cmd_withdraw_amount ( 2539 "withdraw-coin-rep", 2540 "create-reserve-30x", 2541 "EUR:5", 2542 0, 2543 MHD_HTTP_OK), 2544 TALER_TESTING_cmd_merchant_post_orders3 ( 2545 "post-order-repurchase-original", 2546 cred.cfg, 2547 merchant_url, 2548 MHD_HTTP_OK, 2549 "repurchase-original", 2550 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_HOURS), 2551 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), 2552 "https://fulfillment.example.com/", 2553 "EUR:1.0"), 2554 TALER_TESTING_cmd_merchant_pay_order ( 2555 "repurchase-pay-first", 2556 merchant_url, 2557 MHD_HTTP_OK, 2558 "post-order-repurchase-original", 2559 "withdraw-coin-rep", 2560 "EUR:1.00", 2561 "EUR:0.99", 2562 "repurchase-session"), 2563 TALER_TESTING_cmd_wallet_get_order ( 2564 "repurchase-wallet-check-primary-order", 2565 merchant_url, 2566 "post-order-repurchase-original", 2567 true, 2568 false, 2569 false, 2570 MHD_HTTP_OK), 2571 TALER_TESTING_cmd_merchant_get_order3 ( 2572 "repurchase-check-primary-payment", 2573 merchant_url, 2574 "post-order-repurchase-original", 2575 TALER_MERCHANT_OSC_PAID, 2576 "repurchase-session", 2577 NULL, 2578 MHD_HTTP_OK), 2579 TALER_TESTING_cmd_merchant_get_order3 ( 2580 "repurchase-check-primary-payment-bad-binding", 2581 merchant_url, 2582 "post-order-repurchase-original", 2583 TALER_MERCHANT_OSC_CLAIMED, /* someone else has it! */ 2584 "wrong-session", 2585 NULL, 2586 MHD_HTTP_OK), 2587 TALER_TESTING_cmd_merchant_post_orders3 ( 2588 "post-order-repurchase-secondary", 2589 cred.cfg, 2590 merchant_url, 2591 MHD_HTTP_OK, 2592 "repurchase-secondary", 2593 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_HOURS), 2594 GNUNET_TIME_relative_to_timestamp (GNUNET_TIME_UNIT_MINUTES), 2595 "https://fulfillment.example.com/", 2596 "EUR:1.0"), 2597 TALER_TESTING_cmd_merchant_get_order3 ( 2598 "repurchase-check-secondary-payment", 2599 merchant_url, 2600 "post-order-repurchase-secondary", 2601 TALER_MERCHANT_OSC_UNPAID, 2602 "repurchase-session", 2603 NULL, 2604 MHD_HTTP_OK), 2605 TALER_TESTING_cmd_merchant_get_order3 ( 2606 "repurchase-check-secondary-payment", 2607 merchant_url, 2608 "post-order-repurchase-secondary", 2609 TALER_MERCHANT_OSC_UNPAID, 2610 "repurchase-session", 2611 "post-order-repurchase-original", 2612 MHD_HTTP_OK), 2613 TALER_TESTING_cmd_wallet_get_order2 ( 2614 "repurchase-wallet-check-order-secondary", 2615 merchant_url, 2616 "post-order-repurchase-secondary", 2617 "repurchase-session", 2618 false, 2619 false, 2620 false, 2621 "post-order-repurchase-original", 2622 MHD_HTTP_PAYMENT_REQUIRED), 2623 TALER_TESTING_cmd_wallet_get_order2 ( 2624 "repurchase-wallet-check-order-secondary-bad-session", 2625 merchant_url, 2626 "post-order-repurchase-secondary", 2627 "wrong-session", 2628 false, 2629 false, 2630 false, 2631 NULL, 2632 MHD_HTTP_PAYMENT_REQUIRED), 2633 TALER_TESTING_cmd_merchant_order_refund ( 2634 "refund-repurchased", 2635 merchant_url, 2636 "refund repurchase", 2637 "repurchase-original", 2638 "EUR:1.0", 2639 MHD_HTTP_OK), 2640 TALER_TESTING_cmd_wallet_get_order2 ( 2641 "repurchase-wallet-check-primary-order-refunded-no-session", 2642 merchant_url, 2643 "post-order-repurchase-original", 2644 NULL, 2645 true, 2646 true, 2647 true, 2648 "post-order-repurchase-original", 2649 MHD_HTTP_OK), 2650 TALER_TESTING_cmd_wallet_get_order2 ( 2651 "repurchase-wallet-check-primary-order-refunded", 2652 merchant_url, 2653 "post-order-repurchase-original", 2654 "repurchase-session", 2655 true, 2656 true, 2657 true, 2658 "post-order-repurchase-original", 2659 MHD_HTTP_OK), 2660 TALER_TESTING_cmd_merchant_get_order3 ( 2661 "repurchase-check-refunded", 2662 merchant_url, 2663 "post-order-repurchase-secondary", 2664 TALER_MERCHANT_OSC_CLAIMED, 2665 "repurchase-session", 2666 NULL, 2667 MHD_HTTP_OK), 2668 2669 TALER_TESTING_cmd_end () 2670 }; 2671 2672 struct TALER_TESTING_Command tokens[] = { 2673 /** 2674 * Move money to the exchange's bank account. 2675 */ 2676 cmd_transfer_to_exchange ("create-reserve-tokens", 2677 "EUR:20.03"), 2678 /** 2679 * Make a reserve exist, according to the previous transfer. 2680 */ 2681 cmd_exec_wirewatch ("wirewatch-1"), 2682 TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-tokens", 2683 "EUR:20.03", 2684 payer_payto, 2685 exchange_payto, 2686 "create-reserve-tokens"), 2687 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1", 2688 "create-reserve-tokens", 2689 "EUR:5", 2690 0, 2691 MHD_HTTP_OK), 2692 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2", 2693 "create-reserve-tokens", 2694 "EUR:5", 2695 0, 2696 MHD_HTTP_OK), 2697 TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-3", 2698 "create-reserve-tokens", 2699 "EUR:5", 2700 0, 2701 MHD_HTTP_OK), 2702 TALER_TESTING_cmd_merchant_post_tokenfamilies ( 2703 "create-upcoming-tokenfamily", 2704 merchant_url, 2705 MHD_HTTP_NO_CONTENT, 2706 "subscription-upcoming", 2707 "Upcoming Subscription", 2708 "An upcoming subscription that is not valid yet.", 2709 NULL, 2710 /* In one day */ 2711 GNUNET_TIME_absolute_to_timestamp ( 2712 GNUNET_TIME_absolute_add ( 2713 GNUNET_TIME_timestamp_get ().abs_time, 2714 GNUNET_TIME_UNIT_DAYS)), 2715 /* In a year */ 2716 GNUNET_TIME_absolute_to_timestamp ( 2717 GNUNET_TIME_absolute_add ( 2718 GNUNET_TIME_timestamp_get ().abs_time, 2719 GNUNET_TIME_UNIT_YEARS)), 2720 GNUNET_TIME_UNIT_MONTHS, 2721 GNUNET_TIME_UNIT_MONTHS, 2722 "subscription"), 2723 TALER_TESTING_cmd_merchant_post_orders_choices ( 2724 "create-order-with-upcoming-output", 2725 cred.cfg, 2726 merchant_url, 2727 MHD_HTTP_OK, 2728 "subscription-upcoming", 2729 "A choice in the contract", 2730 NULL, 2731 0, 2732 1, 2733 "5-upcoming-output", 2734 GNUNET_TIME_UNIT_ZERO_TS, 2735 GNUNET_TIME_UNIT_FOREVER_TS, 2736 "EUR:5.0"), 2737 TALER_TESTING_cmd_merchant_post_tokenfamilies ( 2738 "create-tokenfamily", 2739 merchant_url, 2740 MHD_HTTP_NO_CONTENT, 2741 "subscription-1", 2742 "Subscription", 2743 "A subscription.", 2744 NULL, 2745 GNUNET_TIME_UNIT_ZERO_TS, 2746 GNUNET_TIME_relative_to_timestamp ( 2747 GNUNET_TIME_UNIT_YEARS), 2748 GNUNET_TIME_UNIT_MONTHS, 2749 GNUNET_TIME_UNIT_MONTHS, 2750 "subscription"), 2751 TALER_TESTING_cmd_merchant_post_orders_choices ( 2752 "create-order-with-output", 2753 cred.cfg, 2754 merchant_url, 2755 MHD_HTTP_OK, 2756 "subscription-1", 2757 "A choice in the contract", 2758 NULL, 2759 0, 2760 1, 2761 "5-output", 2762 GNUNET_TIME_UNIT_ZERO_TS, 2763 GNUNET_TIME_UNIT_FOREVER_TS, 2764 "EUR:5.0"), 2765 TALER_TESTING_cmd_merchant_pay_order_choices ( 2766 "pay-order-with-output", 2767 merchant_url, 2768 MHD_HTTP_OK, 2769 "create-order-with-output", 2770 "withdraw-coin-1", 2771 "EUR:5", 2772 "EUR:4.99", 2773 NULL, 2774 0, 2775 NULL), 2776 TALER_TESTING_cmd_merchant_post_orders_choices ( 2777 "create-order-with-input-and-output", 2778 cred.cfg, 2779 merchant_url, 2780 MHD_HTTP_OK, 2781 "subscription-1", 2782 "A choice in the contract", 2783 NULL, 2784 1, 2785 1, 2786 "5-input-output", 2787 GNUNET_TIME_UNIT_ZERO_TS, 2788 GNUNET_TIME_UNIT_FOREVER_TS, 2789 "EUR:0.0"), 2790 TALER_TESTING_cmd_merchant_pay_order_choices ( 2791 "pay-order-with-input-and-output", 2792 merchant_url, 2793 MHD_HTTP_OK, 2794 "create-order-with-input-and-output", 2795 "", 2796 "EUR:0", 2797 "EUR:0", 2798 NULL, 2799 0, 2800 "pay-order-with-output"), 2801 // TALER_TESTING_cmd_merchant_pay_order_choices ("idempotent-pay-order-with-input-and-output", 2802 // merchant_url, 2803 // MHD_HTTP_OK, 2804 // "create-order-with-input-and-output", 2805 // "", 2806 // "EUR:0", 2807 // "EUR:0", 2808 // NULL, 2809 // 0, 2810 // "pay-order-with-output"), 2811 TALER_TESTING_cmd_merchant_post_orders_choices ( 2812 "create-another-order-with-input-and-output", 2813 cred.cfg, 2814 merchant_url, 2815 MHD_HTTP_OK, 2816 "subscription-1", 2817 "A choice in the contract", 2818 NULL, 2819 1, 2820 1, 2821 "5-input-output-2", 2822 GNUNET_TIME_UNIT_ZERO_TS, 2823 GNUNET_TIME_UNIT_FOREVER_TS, 2824 "EUR:0.0"), 2825 TALER_TESTING_cmd_merchant_pay_order_choices ("double-spend-token", 2826 merchant_url, 2827 MHD_HTTP_CONFLICT, 2828 "create-another-order-with-input-and-output", 2829 "", 2830 "EUR:0", 2831 "EUR:0", 2832 NULL, 2833 0, 2834 "pay-order-with-output"), 2835 TALER_TESTING_cmd_end () 2836 }; 2837 2838 #ifdef HAVE_DONAU_DONAU_SERVICE_H 2839 const struct DONAU_BearerToken bearer = { 2840 .token = NULL 2841 }; 2842 2843 struct TALER_TESTING_Command donau[] = { 2844 TALER_TESTING_cmd_set_var ( 2845 "donau", 2846 TALER_TESTING_cmd_get_donau ("get-donau", 2847 cred.cfg, 2848 true /* wait for response */)), 2849 TALER_TESTING_cmd_charity_post_merchant ("post-charity", 2850 "example", 2851 "example.com", 2852 "EUR:50", // max_per_year 2853 &bearer, 2854 "create-another-order-with-input-and-output", 2855 // reusing the merchant_reference for merchant_pub 2856 MHD_HTTP_CREATED), 2857 TALER_TESTING_cmd_charity_post_merchant ("post-charity-idempotent", 2858 "example", 2859 "example.com", 2860 "EUR:50", // max_per_year 2861 &bearer, 2862 "create-another-order-with-input-and-output", 2863 // reusing the merchant_reference for merchant_pub 2864 MHD_HTTP_CREATED), 2865 TALER_TESTING_cmd_merchant_post_donau_instance ( 2866 "post-donau-instance", 2867 merchant_url, 2868 "create-another-order-with-input-and-output", 2869 MHD_HTTP_NO_CONTENT), 2870 TALER_TESTING_cmd_merchant_post_donau_instance ( 2871 "post-donau-instance-idempotent", 2872 merchant_url, 2873 "create-another-order-with-input-and-output", 2874 MHD_HTTP_NO_CONTENT), 2875 TALER_TESTING_cmd_merchant_get_donau_instances ( 2876 "get-donau-instances-after-insert", 2877 merchant_url, 2878 1, 2879 MHD_HTTP_OK), 2880 TALER_TESTING_cmd_exec_donaukeyupdate ("run-merchant-donaukeyupdate", 2881 config_file), 2882 TALER_TESTING_cmd_merchant_get_donau_instances ( 2883 "get-donau-instance", 2884 merchant_url, 2885 1, 2886 MHD_HTTP_OK), 2887 TALER_TESTING_cmd_merchant_post_orders_donau ( 2888 "create-donau-order", 2889 cred.cfg, 2890 merchant_url, 2891 MHD_HTTP_OK, 2892 "donau", 2893 GNUNET_TIME_UNIT_ZERO_TS, 2894 GNUNET_TIME_UNIT_FOREVER_TS, 2895 "EUR:1"), 2896 TALER_TESTING_cmd_merchant_pay_order_donau ( 2897 "pay-donau-order", 2898 merchant_url, 2899 MHD_HTTP_OK, 2900 "create-donau-order", 2901 "withdraw-coin-3", 2902 "EUR:1", /* full amount */ 2903 "EUR:0.99", /* amount without fees */ 2904 "EUR:1", /* donation amount */ 2905 NULL, 2906 0, 2907 "post-charity", 2908 GNUNET_TIME_get_current_year (), 2909 "7560001010000", 2910 "1234" 2911 ), 2912 TALER_TESTING_cmd_merchant_delete_donau_instance ( 2913 "delete-donau-instance", 2914 merchant_url, 2915 1, 2916 MHD_HTTP_NO_CONTENT), 2917 TALER_TESTING_cmd_merchant_get_donau_instances ( 2918 "get-donau-instances-after-delete", 2919 merchant_url, 2920 0, 2921 MHD_HTTP_OK), 2922 TALER_TESTING_cmd_end () 2923 }; 2924 #endif 2925 2926 struct TALER_TESTING_Command commands[] = { 2927 /* general setup */ 2928 TALER_TESTING_cmd_run_fakebank ( 2929 "run-fakebank", 2930 cred.cfg, 2931 "exchange-account-exchange"), 2932 #ifdef HAVE_DONAU_DONAU_SERVICE_H 2933 TALER_TESTING_cmd_system_start ( 2934 "start-taler", 2935 config_file, 2936 "-emaD", 2937 "-u", "exchange-account-exchange", 2938 "-r", "merchant-exchange-test", 2939 NULL), 2940 #else 2941 TALER_TESTING_cmd_system_start ( 2942 "start-taler", 2943 config_file, 2944 "-ema", 2945 "-u", "exchange-account-exchange", 2946 "-r", "merchant-exchange-test", 2947 NULL), 2948 #endif 2949 TALER_TESTING_cmd_get_exchange ( 2950 "get-exchange", 2951 cred.cfg, 2952 NULL, 2953 true, 2954 true), 2955 TALER_TESTING_cmd_batch ( 2956 "orders-id", 2957 get_private_order_id), 2958 TALER_TESTING_cmd_config ( 2959 "config", 2960 merchant_url, 2961 MHD_HTTP_OK), 2962 TALER_TESTING_cmd_merchant_get_instances ( 2963 "instances-empty", 2964 merchant_url, 2965 MHD_HTTP_OK, 2966 NULL), 2967 TALER_TESTING_cmd_merchant_post_instances ( 2968 "instance-create-default-setup", 2969 merchant_url, 2970 "admin", 2971 MHD_HTTP_NO_CONTENT), 2972 TALER_TESTING_cmd_merchant_post_account ( 2973 "instance-create-default-account", 2974 merchant_url, 2975 merchant_payto, 2976 NULL, NULL, 2977 MHD_HTTP_OK), 2978 TALER_TESTING_cmd_merchant_post_instances ( 2979 "instance-create-i1", 2980 merchant_url, 2981 "i1", 2982 MHD_HTTP_NO_CONTENT), 2983 TALER_TESTING_cmd_merchant_get_instances ( 2984 "instances-get-i1", 2985 merchant_url, 2986 MHD_HTTP_OK, 2987 "instance-create-i1", 2988 "instance-create-default-setup", 2989 NULL), 2990 TALER_TESTING_cmd_merchant_get_instance ( 2991 "instances-get-i1", 2992 merchant_url, 2993 "i1", 2994 MHD_HTTP_OK, 2995 "instance-create-i1"), 2996 TALER_TESTING_cmd_merchant_patch_instance ( 2997 "instance-patch-i1", 2998 merchant_url, 2999 "i1", 3000 "bob-the-merchant", 3001 json_pack ("{s:s}", 3002 "street", 3003 "bobstreet"), 3004 json_pack ("{s:s}", 3005 "street", 3006 "bobjuryst"), 3007 true, 3008 GNUNET_TIME_UNIT_ZERO, /* wire transfer */ 3009 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3010 2), /* small pay delay */ 3011 MHD_HTTP_NO_CONTENT), 3012 TALER_TESTING_cmd_merchant_get_instance ( 3013 "instances-get-i1-2", 3014 merchant_url, 3015 "i1", 3016 MHD_HTTP_OK, 3017 "instance-patch-i1"), 3018 TALER_TESTING_cmd_merchant_get_instance ( 3019 "instances-get-i2-nx", 3020 merchant_url, 3021 "i2", 3022 MHD_HTTP_NOT_FOUND, 3023 NULL), 3024 TALER_TESTING_cmd_merchant_post_instances2 ( 3025 "instance-create-ACL", 3026 merchant_url, 3027 "i-acl", 3028 "controlled instance", 3029 json_pack ("{s:s}", "city", 3030 "shopcity"), 3031 json_pack ("{s:s}", "city", 3032 "lawyercity"), 3033 true, 3034 GNUNET_TIME_UNIT_ZERO, /* wire transfer */ 3035 GNUNET_TIME_UNIT_SECONDS, /* pay delay */ 3036 // FIXME: change this back once 3037 // we have a update auth test CMD 3038 // RFC_8959_PREFIX "EXAMPLE", 3039 NULL, 3040 MHD_HTTP_NO_CONTENT), 3041 TALER_TESTING_cmd_merchant_patch_instance ( 3042 "instance-patch-ACL", 3043 merchant_url, 3044 "i-acl", 3045 "controlled instance", 3046 json_pack ("{s:s}", 3047 "street", 3048 "bobstreet"), 3049 json_pack ("{s:s}", 3050 "street", 3051 "bobjuryst"), 3052 true, 3053 GNUNET_TIME_UNIT_ZERO, /* wire transfer */ 3054 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 3055 2), /* small pay delay */ 3056 MHD_HTTP_NO_CONTENT), 3057 TALER_TESTING_cmd_merchant_post_instances ( 3058 "instance-create-i2", 3059 merchant_url, 3060 "i2", 3061 MHD_HTTP_NO_CONTENT), 3062 TALER_TESTING_cmd_merchant_post_instances ( 3063 "instance-create-i2-idem", 3064 merchant_url, 3065 "i2", 3066 MHD_HTTP_NO_CONTENT), 3067 TALER_TESTING_cmd_merchant_delete_instance ( 3068 "instance-delete-i2", 3069 merchant_url, 3070 "i2", 3071 MHD_HTTP_NO_CONTENT), 3072 TALER_TESTING_cmd_merchant_get_instance ( 3073 "instances-get-i2-post-deletion", 3074 merchant_url, 3075 "i2", 3076 MHD_HTTP_NOT_FOUND, 3077 NULL), 3078 TALER_TESTING_cmd_merchant_purge_instance ( 3079 "instance-delete-then-purge-i2", 3080 merchant_url, 3081 "i2", 3082 MHD_HTTP_NO_CONTENT), 3083 TALER_TESTING_cmd_merchant_purge_instance ( 3084 "instance-purge-i1", 3085 merchant_url, 3086 "i1", 3087 MHD_HTTP_NO_CONTENT), 3088 TALER_TESTING_cmd_merchant_delete_instance ( 3089 "instance-purge-then-delete-i1", 3090 merchant_url, 3091 "i1", 3092 MHD_HTTP_NOT_FOUND), 3093 TALER_TESTING_cmd_merchant_purge_instance ( 3094 "instance-purge-i-acl-middle", 3095 merchant_url, 3096 "i-acl", 3097 MHD_HTTP_NO_CONTENT), 3098 TALER_TESTING_cmd_merchant_purge_instance ( 3099 "instance-purge-default-middle", 3100 merchant_url, 3101 "admin", 3102 MHD_HTTP_NO_CONTENT), 3103 TALER_TESTING_cmd_merchant_post_instances ( 3104 "instance-create-default-after-purge", 3105 merchant_url, 3106 "admin", 3107 MHD_HTTP_NO_CONTENT), 3108 TALER_TESTING_cmd_merchant_post_account ( 3109 "instance-create-default-account-after-purge", 3110 merchant_url, 3111 merchant_payto, 3112 NULL, NULL, 3113 MHD_HTTP_OK), 3114 TALER_TESTING_cmd_merchant_get_products ( 3115 "get-products-empty", 3116 merchant_url, 3117 MHD_HTTP_OK, 3118 NULL), 3119 TALER_TESTING_cmd_merchant_post_products ( 3120 "post-products-p1", 3121 merchant_url, 3122 "product-1", 3123 "a product", 3124 "EUR:1", 3125 MHD_HTTP_NO_CONTENT), 3126 TALER_TESTING_cmd_merchant_post_products ( 3127 "post-products-p1-idem", 3128 merchant_url, 3129 "product-1", 3130 "a product", 3131 "EUR:1", 3132 MHD_HTTP_NO_CONTENT), 3133 TALER_TESTING_cmd_merchant_post_products ( 3134 "post-products-p1-non-idem", 3135 merchant_url, 3136 "product-1", 3137 "a different product", 3138 "EUR:1", 3139 MHD_HTTP_CONFLICT), 3140 TALER_TESTING_cmd_merchant_get_products ( 3141 "get-products-p1", 3142 merchant_url, 3143 MHD_HTTP_OK, 3144 "post-products-p1", 3145 NULL), 3146 TALER_TESTING_cmd_merchant_get_product ( 3147 "get-product-p1", 3148 merchant_url, 3149 "product-1", 3150 MHD_HTTP_OK, 3151 "post-products-p1"), 3152 TALER_TESTING_cmd_merchant_post_products2 ( 3153 "post-products-img", 3154 merchant_url, 3155 "product-img", 3156 "product with image", 3157 json_pack ("{s:s}", "en", "product with image"), 3158 "test-unit", 3159 "EUR:1", 3160 "data:image/jpeg;base64,RAWDATA", 3161 json_array (), 3162 4, 3163 0, 3164 json_pack ("{s:s}", "street", "my street"), 3165 GNUNET_TIME_UNIT_ZERO_TS, 3166 MHD_HTTP_NO_CONTENT), 3167 TALER_TESTING_cmd_get_product_image ( 3168 "get-product-image-img", 3169 merchant_url, 3170 "post-products-img", 3171 "5831ca012639a29df949c3b1e5cd436bac0a5b26a5340ccd95df394b7a8742d6", 3172 MHD_HTTP_OK), 3173 TALER_TESTING_cmd_get_product_image ( 3174 "get-product-image-invalid", 3175 merchant_url, 3176 NULL, 3177 "not-a-valid-hash", 3178 MHD_HTTP_BAD_REQUEST), 3179 TALER_TESTING_cmd_get_product_image ( 3180 "get-product-image-empty", 3181 merchant_url, 3182 NULL, 3183 "", 3184 MHD_HTTP_BAD_REQUEST), 3185 TALER_TESTING_cmd_get_product_image ( 3186 "get-product-image-not-found", 3187 merchant_url, 3188 NULL, 3189 "5831ca012639a29df949c3b1e5cd436bac0a5b26a5340ccd95df394b7a8742d7", 3190 MHD_HTTP_NOT_FOUND), 3191 TALER_TESTING_cmd_merchant_post_products ( 3192 "post-products-p2", 3193 merchant_url, 3194 "product-2", 3195 "a product", 3196 "EUR:1", 3197 MHD_HTTP_NO_CONTENT), 3198 TALER_TESTING_cmd_merchant_patch_product ( 3199 "patch-products-p2", 3200 merchant_url, 3201 "product-2", 3202 "another product", 3203 json_pack ("{s:s}", "en", "text"), 3204 "kg", 3205 "EUR:1", 3206 "data:image/jpeg;base64,RAWDATA", 3207 json_array (), 3208 40, 3209 0, 3210 json_pack ("{s:s}", 3211 "street", 3212 "pstreet"), 3213 GNUNET_TIME_relative_to_timestamp ( 3214 GNUNET_TIME_UNIT_MINUTES), 3215 MHD_HTTP_NO_CONTENT), 3216 TALER_TESTING_cmd_merchant_get_product ( 3217 "get-product-p2", 3218 merchant_url, 3219 "product-2", 3220 MHD_HTTP_OK, 3221 "patch-products-p2"), 3222 TALER_TESTING_cmd_merchant_get_product ( 3223 "get-product-nx", 3224 merchant_url, 3225 "product-nx", 3226 MHD_HTTP_NOT_FOUND, 3227 NULL), 3228 TALER_TESTING_cmd_merchant_patch_product ( 3229 "patch-products-p3-nx", 3230 merchant_url, 3231 "product-3", 3232 "nx updated product", 3233 json_pack ("{s:s}", "en", "text"), 3234 "kg", 3235 "EUR:1", 3236 "data:image/jpeg;base64,RAWDATA", 3237 json_array (), 3238 40, 3239 0, 3240 json_pack ("{s:s}", 3241 "street", 3242 "pstreet"), 3243 GNUNET_TIME_relative_to_timestamp ( 3244 GNUNET_TIME_UNIT_MINUTES), 3245 MHD_HTTP_NOT_FOUND), 3246 TALER_TESTING_cmd_merchant_delete_product ( 3247 "get-products-empty", 3248 merchant_url, 3249 "p1", 3250 MHD_HTTP_NOT_FOUND), 3251 TALER_TESTING_cmd_merchant_delete_product ( 3252 "get-products-empty", 3253 merchant_url, 3254 "product-1", 3255 MHD_HTTP_NO_CONTENT), 3256 TALER_TESTING_cmd_merchant_lock_product ( 3257 "lock-product-p2", 3258 merchant_url, 3259 "product-2", 3260 GNUNET_TIME_UNIT_MINUTES, 3261 2, 3262 MHD_HTTP_NO_CONTENT), 3263 TALER_TESTING_cmd_merchant_lock_product ( 3264 "lock-product-nx", 3265 merchant_url, 3266 "product-nx", 3267 GNUNET_TIME_UNIT_MINUTES, 3268 2, 3269 MHD_HTTP_NOT_FOUND), 3270 TALER_TESTING_cmd_merchant_lock_product ( 3271 "lock-product-too-much", 3272 merchant_url, 3273 "product-2", 3274 GNUNET_TIME_UNIT_MINUTES, 3275 39, 3276 MHD_HTTP_GONE), 3277 TALER_TESTING_cmd_merchant_delete_product ( 3278 "delete-product-locked", 3279 merchant_url, 3280 "product-2", 3281 MHD_HTTP_CONFLICT), 3282 TALER_TESTING_cmd_batch ("pay", 3283 pay), 3284 TALER_TESTING_cmd_batch ("double-spending", 3285 double_spending), 3286 TALER_TESTING_cmd_batch ("pay-again", 3287 pay_again), 3288 TALER_TESTING_cmd_batch ("pay-abort", 3289 pay_abort), 3290 TALER_TESTING_cmd_batch ("refund", 3291 refund), 3292 TALER_TESTING_cmd_batch ("templates", 3293 templates), 3294 TALER_TESTING_cmd_batch ("webhooks", 3295 webhooks), 3296 TALER_TESTING_cmd_batch ("inventory-webhooks", 3297 inventory_webhooks), 3298 TALER_TESTING_cmd_batch ("auth", 3299 auth), 3300 TALER_TESTING_cmd_batch ("repurchase", 3301 repurchase), 3302 TALER_TESTING_cmd_batch ("tokens", 3303 tokens), 3304 3305 #ifdef HAVE_DONAU_DONAU_SERVICE_H 3306 TALER_TESTING_cmd_batch ("donau", 3307 donau), 3308 #endif 3309 3310 TALER_TESTING_cmd_merchant_get_statisticsamount ("stats-refund", 3311 merchant_url, 3312 "refunds-granted", 6, 0, 3313 MHD_HTTP_OK), 3314 TALER_TESTING_cmd_merchant_get_statisticscounter ("stats-tokens-issued", 3315 merchant_url, 3316 "tokens-issued", 6, 0, 3317 MHD_HTTP_OK), 3318 TALER_TESTING_cmd_merchant_get_statisticscounter ("stats-tokens-used", 3319 merchant_url, 3320 "tokens-used", 6, 0, 3321 MHD_HTTP_OK), 3322 3323 /** 3324 * End the suite. 3325 */ 3326 TALER_TESTING_cmd_end () 3327 }; 3328 3329 TALER_TESTING_run (is, 3330 commands); 3331 } 3332 3333 3334 int 3335 main (int argc, 3336 char *const *argv) 3337 { 3338 { 3339 char *cipher; 3340 3341 cipher = GNUNET_STRINGS_get_suffix_from_binary_name (argv[0]); 3342 GNUNET_assert (NULL != cipher); 3343 GNUNET_asprintf (&config_file, 3344 "test_merchant_api-%s.conf", 3345 cipher); 3346 GNUNET_free (cipher); 3347 } 3348 payer_payto.full_payto = 3349 (char *) "payto://x-taler-bank/localhost/" USER_ACCOUNT_NAME 3350 "?receiver-name=" USER_ACCOUNT_NAME; 3351 exchange_payto.full_payto = 3352 (char *) "payto://x-taler-bank/localhost/" EXCHANGE_ACCOUNT_NAME 3353 "?receiver-name=" 3354 EXCHANGE_ACCOUNT_NAME; 3355 merchant_payto.full_payto = 3356 (char *) "payto://x-taler-bank/localhost/" MERCHANT_ACCOUNT_NAME 3357 "?receiver-name=" MERCHANT_ACCOUNT_NAME; 3358 merchant_url = "http://localhost:8080/"; 3359 GNUNET_asprintf (&merchant_url_i1a, 3360 "%sinstances/i1a/", 3361 merchant_url); 3362 return TALER_TESTING_main (argv, 3363 "INFO", 3364 config_file, 3365 "exchange-account-exchange", 3366 TALER_TESTING_BS_FAKEBANK, 3367 &cred, 3368 &run, 3369 NULL); 3370 } 3371 3372 3373 /* end of test_merchant_api.c */