diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-01-21 19:21:45 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-01-21 19:21:45 +0100 |
commit | 3f930c0f6aadc68c98fbe5f2b4824db9a61fc62a (patch) | |
tree | 6ab227f0e632b2c7d992a453d68180f12fe95ec6 | |
parent | a252daa6a1b3fe5b22757e7aeffc502e7f098261 (diff) | |
download | exchange-3f930c0f6aadc68c98fbe5f2b4824db9a61fc62a.tar.xz |
more wire transfer variants
-rw-r--r-- | src/exchange-lib/testing_api_cmd_fakebank_transfer.c | 82 | ||||
-rw-r--r-- | src/include/taler_testing_lib.h | 28 |
2 files changed, 110 insertions, 0 deletions
diff --git a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c index 588eb6721..eb8c6802c 100644 --- a/src/exchange-lib/testing_api_cmd_fakebank_transfer.c +++ b/src/exchange-lib/testing_api_cmd_fakebank_transfer.c @@ -318,4 +318,86 @@ TALER_TESTING_cmd_fakebank_transfer (const char *label, } +/** + * Create fakebank_transfer command with custom subject. + * + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label, + const char *amount, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *subject) +{ + struct TALER_TESTING_Command cmd; + struct FakebankTransferState *fts; + + fts = GNUNET_new (struct FakebankTransferState); + fts->credit_account_no = credit_account_no; + fts->debit_account_no = debit_account_no; + fts->auth_username = auth_username; + fts->auth_password = auth_password; + fts->subject = subject; + if (GNUNET_OK != + TALER_string_to_amount (amount, + &fts->amount)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to parse amount `%s' at %s\n", + amount, + label); + GNUNET_assert (0); + } + cmd.cls = fts; + cmd.label = label; + cmd.run = &fakebank_transfer_run; + cmd.cleanup = &fakebank_transfer_cleanup; + cmd.traits = &fakebank_transfer_traits; + return cmd; +} + + +/** + * Create fakebank_transfer command with custom subject. + * + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, + const char *amount, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *ref) +{ + struct TALER_TESTING_Command cmd; + struct FakebankTransferState *fts; + + fts = GNUNET_new (struct FakebankTransferState); + fts->credit_account_no = credit_account_no; + fts->debit_account_no = debit_account_no; + fts->auth_username = auth_username; + fts->auth_password = auth_password; + fts->reserve_reference = ref; + if (GNUNET_OK != + TALER_string_to_amount (amount, + &fts->amount)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Failed to parse amount `%s' at %s\n", + amount, + label); + GNUNET_assert (0); + } + cmd.cls = fts; + cmd.label = label; + cmd.run = &fakebank_transfer_run; + cmd.cleanup = &fakebank_transfer_cleanup; + cmd.traits = &fakebank_transfer_traits; + return cmd; +} + + /* end of testing_api_cmd_fakebank_transfer.c */ diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h index 5643572ff..48259bc8d 100644 --- a/src/include/taler_testing_lib.h +++ b/src/include/taler_testing_lib.h @@ -231,6 +231,34 @@ TALER_TESTING_cmd_fakebank_transfer (const char *label, /** + * Create fakebank_transfer command with custom subject. + * + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label, + const char *amount, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *subject); + + +/** + * Create fakebank_transfer command with custom subject. + * + */ +struct TALER_TESTING_Command +TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label, + const char *amount, + uint64_t debit_account_no, + uint64_t credit_account_no, + const char *auth_username, + const char *auth_password, + const char *ref); + + +/** * Execute taler-exchange-wirewatch process. * */ |