clean up taler-wire tool
This commit is contained in:
parent
824e6ce9d7
commit
c1996b7e69
@ -18,7 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @file taler-wire.c
|
* @file taler-wire.c
|
||||||
* @brief Utility performing wire transfers.
|
* @brief Utility for performing wire transfers.
|
||||||
* @author Marcello Stanisci
|
* @author Marcello Stanisci
|
||||||
* @author Christian Grothoff
|
* @author Christian Grothoff
|
||||||
*/
|
*/
|
||||||
@ -47,10 +47,9 @@ static unsigned int global_ret = 1;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* When a wire transfer is being performed, this value
|
* When a wire transfer is being performed, this value
|
||||||
* specifies the amount to wire-transfer. It's given in
|
* specifies the amount to transfer.
|
||||||
* the usual CURRENCY:X[.Y] format.
|
|
||||||
*/
|
*/
|
||||||
static char *amount;
|
static struct TALER_Amount amount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starting row.
|
* Starting row.
|
||||||
@ -183,36 +182,15 @@ confirmation_cb (void *cls,
|
|||||||
static void
|
static void
|
||||||
execute_wire_transfer ()
|
execute_wire_transfer ()
|
||||||
{
|
{
|
||||||
struct TALER_Amount a;
|
|
||||||
struct TALER_WireTransferIdentifierRawP wtid;
|
struct TALER_WireTransferIdentifierRawP wtid;
|
||||||
void *buf;
|
void *buf;
|
||||||
size_t buf_size;
|
size_t buf_size;
|
||||||
|
|
||||||
if (NULL == amount)
|
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
|
||||||
{
|
&wtid,
|
||||||
fprintf (stderr,
|
sizeof (wtid));
|
||||||
"The option -a: AMOUNT, is mandatory.\n");
|
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (GNUNET_OK != TALER_string_to_amount (amount,
|
|
||||||
&a))
|
|
||||||
{
|
|
||||||
fprintf (stderr,
|
|
||||||
"Amount string incorrect.\n");
|
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (NULL == destination_account_url)
|
|
||||||
{
|
|
||||||
fprintf (stderr,
|
|
||||||
"Please give destination"
|
|
||||||
" account URL (--destination/-d)\n");
|
|
||||||
GNUNET_SCHEDULER_shutdown ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TALER_BANK_prepare_wire_transfer (destination_account_url,
|
TALER_BANK_prepare_wire_transfer (destination_account_url,
|
||||||
&a,
|
&amount,
|
||||||
"http://exchange.example.com/",
|
"http://exchange.example.com/",
|
||||||
&wtid,
|
&wtid,
|
||||||
&buf,
|
&buf,
|
||||||
@ -387,16 +365,18 @@ main (int argc,
|
|||||||
"ACCOUNT-SECTION",
|
"ACCOUNT-SECTION",
|
||||||
"Which config section has the credentials to access the bank. Mandatory.\n",
|
"Which config section has the credentials to access the bank. Mandatory.\n",
|
||||||
&account_section)),
|
&account_section)),
|
||||||
GNUNET_GETOPT_option_string ('a',
|
GNUNET_GETOPT_option_mandatory
|
||||||
"amount",
|
(TALER_getopt_get_amount ('a',
|
||||||
"AMOUNT",
|
"amount",
|
||||||
"Specify the amount to transfer.",
|
"AMOUNT",
|
||||||
&amount),
|
"Specify the amount to transfer.",
|
||||||
GNUNET_GETOPT_option_string ('d',
|
&amount)),
|
||||||
"destination",
|
GNUNET_GETOPT_option_mandatory
|
||||||
"PAYTO-URL",
|
(GNUNET_GETOPT_option_string ('d',
|
||||||
"Destination account for the wire transfer.",
|
"destination",
|
||||||
&destination_account_url),
|
"PAYTO-URL",
|
||||||
|
"Destination account for the wire transfer.",
|
||||||
|
&destination_account_url)),
|
||||||
GNUNET_GETOPT_OPTION_END
|
GNUNET_GETOPT_OPTION_END
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user