From 4f846eab966e2366c860c8708d3c47c18397d346 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 8 Jun 2019 19:55:18 +0200 Subject: fix #5756, also change sepa->iban as per payto:// spec --- src/wire-plugins/Makefile.am | 2 + src/wire-plugins/plugin_wire_ebics.c | 370 ++---------------------------- src/wire-plugins/plugin_wire_taler-bank.c | 289 ++++++++--------------- src/wire-plugins/test_ebics_wireformat.c | 6 +- 4 files changed, 115 insertions(+), 552 deletions(-) (limited to 'src/wire-plugins') diff --git a/src/wire-plugins/Makefile.am b/src/wire-plugins/Makefile.am index 393bfb1b8..e46ef48fa 100644 --- a/src/wire-plugins/Makefile.am +++ b/src/wire-plugins/Makefile.am @@ -42,6 +42,7 @@ libtaler_plugin_wire_taler_bank_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) \ $(top_builddir)/src/bank-lib/libtalerbank.la \ $(top_builddir)/src/json/libtalerjson.la \ + $(top_builddir)/src/wire/libtalerwire.la \ $(top_builddir)/src/util/libtalerutil.la \ -lgnunetcurl \ -lgnunetutil $(XLIB) @@ -53,6 +54,7 @@ libtaler_plugin_wire_ebics_la_LIBADD = \ $(LTLIBINTL) libtaler_plugin_wire_ebics_la_LDFLAGS = \ $(TALER_PLUGIN_LDFLAGS) \ + $(top_builddir)/src/wire/libtalerwire.la \ $(top_builddir)/src/util/libtalerutil.la \ -lgnunetutil $(XLIB) diff --git a/src/wire-plugins/plugin_wire_ebics.c b/src/wire-plugins/plugin_wire_ebics.c index 9aad9df08..c2e0dc922 100644 --- a/src/wire-plugins/plugin_wire_ebics.c +++ b/src/wire-plugins/plugin_wire_ebics.c @@ -22,6 +22,7 @@ * @author Sree Harsha Totakura */ #include "platform.h" +#include "taler_wire_lib.h" #include "taler_wire_plugin.h" #include "taler_signatures.h" #include @@ -81,358 +82,6 @@ ebics_amount_round (void *cls, } -/* Taken from GNU gettext */ - -/** - * Entry in the country table. - */ -struct CountryTableEntry -{ - /** - * 2-Character international country code. - */ - const char *code; - - /** - * Long English name of the country. - */ - const char *english; -}; - - -/* Keep the following table in sync with gettext. - WARNING: the entries should stay sorted according to the code */ -/** - * List of country codes. - */ -static const struct CountryTableEntry country_table[] = - { - { "AE", "U.A.E." }, - { "AF", "Afghanistan" }, - { "AL", "Albania" }, - { "AM", "Armenia" }, - { "AN", "Netherlands Antilles" }, - { "AR", "Argentina" }, - { "AT", "Austria" }, - { "AU", "Australia" }, - { "AZ", "Azerbaijan" }, - { "BA", "Bosnia and Herzegovina" }, - { "BD", "Bangladesh" }, - { "BE", "Belgium" }, - { "BG", "Bulgaria" }, - { "BH", "Bahrain" }, - { "BN", "Brunei Darussalam" }, - { "BO", "Bolivia" }, - { "BR", "Brazil" }, - { "BT", "Bhutan" }, - { "BY", "Belarus" }, - { "BZ", "Belize" }, - { "CA", "Canada" }, - { "CG", "Congo" }, - { "CH", "Switzerland" }, - { "CI", "Cote d'Ivoire" }, - { "CL", "Chile" }, - { "CM", "Cameroon" }, - { "CN", "People's Republic of China" }, - { "CO", "Colombia" }, - { "CR", "Costa Rica" }, - { "CS", "Serbia and Montenegro" }, - { "CZ", "Czech Republic" }, - { "DE", "Germany" }, - { "DK", "Denmark" }, - { "DO", "Dominican Republic" }, - { "DZ", "Algeria" }, - { "EC", "Ecuador" }, - { "EE", "Estonia" }, - { "EG", "Egypt" }, - { "ER", "Eritrea" }, - { "ES", "Spain" }, - { "ET", "Ethiopia" }, - { "FI", "Finland" }, - { "FO", "Faroe Islands" }, - { "FR", "France" }, - { "GB", "United Kingdom" }, - { "GD", "Caribbean" }, - { "GE", "Georgia" }, - { "GL", "Greenland" }, - { "GR", "Greece" }, - { "GT", "Guatemala" }, - { "HK", "Hong Kong" }, - { "HK", "Hong Kong S.A.R." }, - { "HN", "Honduras" }, - { "HR", "Croatia" }, - { "HT", "Haiti" }, - { "HU", "Hungary" }, - { "ID", "Indonesia" }, - { "IE", "Ireland" }, - { "IL", "Israel" }, - { "IN", "India" }, - { "IQ", "Iraq" }, - { "IR", "Iran" }, - { "IS", "Iceland" }, - { "IT", "Italy" }, - { "JM", "Jamaica" }, - { "JO", "Jordan" }, - { "JP", "Japan" }, - { "KE", "Kenya" }, - { "KG", "Kyrgyzstan" }, - { "KH", "Cambodia" }, - { "KR", "South Korea" }, - { "KW", "Kuwait" }, - { "KZ", "Kazakhstan" }, - { "LA", "Laos" }, - { "LB", "Lebanon" }, - { "LI", "Liechtenstein" }, - { "LK", "Sri Lanka" }, - { "LT", "Lithuania" }, - { "LU", "Luxembourg" }, - { "LV", "Latvia" }, - { "LY", "Libya" }, - { "MA", "Morocco" }, - { "MC", "Principality of Monaco" }, - { "MD", "Moldava" }, - { "MD", "Moldova" }, - { "ME", "Montenegro" }, - { "MK", "Former Yugoslav Republic of Macedonia" }, - { "ML", "Mali" }, - { "MM", "Myanmar" }, - { "MN", "Mongolia" }, - { "MO", "Macau S.A.R." }, - { "MT", "Malta" }, - { "MV", "Maldives" }, - { "MX", "Mexico" }, - { "MY", "Malaysia" }, - { "NG", "Nigeria" }, - { "NI", "Nicaragua" }, - { "NL", "Netherlands" }, - { "NO", "Norway" }, - { "NP", "Nepal" }, - { "NZ", "New Zealand" }, - { "OM", "Oman" }, - { "PA", "Panama" }, - { "PE", "Peru" }, - { "PH", "Philippines" }, - { "PK", "Islamic Republic of Pakistan" }, - { "PL", "Poland" }, - { "PR", "Puerto Rico" }, - { "PT", "Portugal" }, - { "PY", "Paraguay" }, - { "QA", "Qatar" }, - { "RE", "Reunion" }, - { "RO", "Romania" }, - { "RS", "Serbia" }, - { "RU", "Russia" }, - { "RW", "Rwanda" }, - { "SA", "Saudi Arabia" }, - { "SE", "Sweden" }, - { "SG", "Singapore" }, - { "SI", "Slovenia" }, - { "SK", "Slovak" }, - { "SN", "Senegal" }, - { "SO", "Somalia" }, - { "SR", "Suriname" }, - { "SV", "El Salvador" }, - { "SY", "Syria" }, - { "TH", "Thailand" }, - { "TJ", "Tajikistan" }, - { "TM", "Turkmenistan" }, - { "TN", "Tunisia" }, - { "TR", "Turkey" }, - { "TT", "Trinidad and Tobago" }, - { "TW", "Taiwan" }, - { "TZ", "Tanzania" }, - { "UA", "Ukraine" }, - { "US", "United States" }, - { "UY", "Uruguay" }, - { "VA", "Vatican" }, - { "VE", "Venezuela" }, - { "VN", "Viet Nam" }, - { "YE", "Yemen" }, - { "ZA", "South Africa" }, - { "ZW", "Zimbabwe" } - }; - - -/** - * Country code comparator function, for binary search with bsearch(). - * - * @param ptr1 pointer to a `struct table_entry` - * @param ptr2 pointer to a `struct table_entry` - * @return result of strncmp()'ing the 2-digit country codes of the entries - */ -static int -cmp_country_code (const void *ptr1, - const void *ptr2) -{ - const struct CountryTableEntry *cc1 = ptr1; - const struct CountryTableEntry *cc2 = ptr2; - - return strncmp (cc1->code, - cc2->code, - 2); -} - - -/** - * Validates given IBAN according to the European Banking Standards. See: - * http://www.europeanpaymentscouncil.eu/documents/ECBS%20IBAN%20standard%20EBS204_V3.2.pdf - * - * @param iban the IBAN number to validate - * @return #GNUNET_YES if correctly formatted; #GNUNET_NO if not - */ -static int -validate_iban (const char *iban) -{ - char cc[2]; - char ibancpy[35]; - struct CountryTableEntry cc_entry; - unsigned int len; - char *nbuf; - unsigned long long dividend; - unsigned long long remainder; - int nread; - int ret; - unsigned int i; - unsigned int j; - - len = strlen (iban); - if (len > 34) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "IBAN number too long to be valid\n"); - return GNUNET_NO; - } - strncpy (cc, iban, 2); - strncpy (ibancpy, iban + 4, len - 4); - strncpy (ibancpy + len - 4, iban, 4); - ibancpy[len] = '\0'; - cc_entry.code = cc; - cc_entry.english = NULL; - if (NULL == - bsearch (&cc_entry, - country_table, - sizeof (country_table) / sizeof (struct CountryTableEntry), - sizeof (struct CountryTableEntry), - &cmp_country_code)) - { - GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Country code `%c%c' not supported\n", - cc[0], - cc[1]); - return GNUNET_NO; - } - nbuf = GNUNET_malloc ((len * 2) + 1); - for (i=0, j=0; i < len; i++) - { - if (isalpha ((unsigned char) ibancpy[i])) - { - if (2 != snprintf(&nbuf[j], - 3, - "%2u", - (ibancpy[i] - 'A' + 10))) - { - GNUNET_free (nbuf); - return GNUNET_NO; - } - j += 2; - continue; - } - nbuf[j] = ibancpy[i]; - j++; - } - for (j=0;'\0' != nbuf[j];j++) - GNUNET_assert (isdigit( (unsigned char) nbuf[j])); - GNUNET_assert (sizeof(dividend) >= 8); - remainder = 0; - for (i=0; iiban = result; - } - else - { - GNUNET_free (result); - } - return TALER_EC_NONE; -} - - /** * Check if the given payto:// URL is correctly formatted for this plugin * @@ -444,8 +93,19 @@ static enum TALER_ErrorCode ebics_wire_validate (void *cls, const char *account_url) { - return parse_payto (account_url, - NULL); + (void) cls; + struct TALER_Account acc; + enum TALER_ErrorCode ec; + + ec = TALER_WIRE_payto_to_account (account_url, + &acc); + if (TALER_EC_NONE == ec) + { + if (TALER_PAC_IBAN != acc.type) + ec = TALER_EC_PAYTO_WRONG_METHOD; + TALER_WIRE_account_free (&acc); + } + return ec; } @@ -717,7 +377,7 @@ libtaler_plugin_wire_ebics_init (void *cls) } plugin = GNUNET_new (struct TALER_WIRE_Plugin); plugin->cls = sc; - plugin->method = "sepa"; + plugin->method = "iban"; plugin->amount_round = &ebics_amount_round; plugin->wire_validate = &ebics_wire_validate; plugin->prepare_wire_transfer = &ebics_prepare_wire_transfer; diff --git a/src/wire-plugins/plugin_wire_taler-bank.c b/src/wire-plugins/plugin_wire_taler-bank.c index 570302618..9aec4bd6d 100644 --- a/src/wire-plugins/plugin_wire_taler-bank.c +++ b/src/wire-plugins/plugin_wire_taler-bank.c @@ -22,6 +22,7 @@ #include "platform.h" #include "taler_wire_plugin.h" #include "taler_json_lib.h" +#include "taler_wire_lib.h" #include "taler_bank_service.h" #include "taler_signatures.h" #include @@ -29,11 +30,6 @@ /* only for HTTP status codes */ #include -/** - * Maximum legal 'value' for an account number, based on IEEE double (for JavaScript compatibility). - */ -#define MAX_ACCOUNT_NO (1LLU << 52) - /** * Type of the "cls" argument given to each of the functions in * our API. @@ -188,124 +184,6 @@ taler_bank_amount_round (void *cls, } -/** - * Information about an account extracted from a payto://-URL. - */ -struct Account -{ - /** - * Hostname of the bank (possibly including port). - */ - char *hostname; - - /** - * Bank account number. - */ - unsigned long long no; - - /** - * Base URL of the bank hosting the account above. - */ - char *bank_base_url; -}; - - -/** - * Parse payto:// account URL (only account information, - * wire subject and amount are ignored). - * - * @param account_url URL to parse - * @param account[out] set to information, can be NULL - * @return #TALER_EC_NONE if @a account_url is well-formed - */ -static enum TALER_ErrorCode -parse_payto (const char *account_url, - struct Account *r_account) -{ - const char *hostname; - const char *account; - const char *q; - unsigned long long no; - -#define PREFIX "payto://x-taler-bank/" - if (0 != strncasecmp (account_url, - PREFIX, - strlen (PREFIX))) - return TALER_EC_PAYTO_WRONG_METHOD; - hostname = &account_url[strlen (PREFIX)]; - if (NULL == (account = strchr (hostname, - (unsigned char) '/'))) - return TALER_EC_PAYTO_MALFORMED; - account++; - if (NULL != (q = strchr (account, - (unsigned char) '?'))) - { - char *s; - - s = GNUNET_strndup (account, - q - account); - if (1 != sscanf (s, - "%llu", - &no)) - { - GNUNET_free (s); - return TALER_EC_PAYTO_MALFORMED; - } - GNUNET_free (s); - } - else if (1 != sscanf (account, - "%llu", - &no)) - { - return TALER_EC_PAYTO_MALFORMED; - } - if (no > MAX_ACCOUNT_NO) - return TALER_EC_PAYTO_MALFORMED; - - if (NULL != r_account) - { - long long unsigned port; - char *p; - - r_account->hostname = GNUNET_strndup (hostname, - account - hostname); - r_account->no = no; - port = 443; /* if non given, equals 443. */ - if (NULL != (p = strchr (r_account->hostname, - (unsigned char) ':'))) - { - p++; - if (1 != sscanf (p, - "%llu", - &port)) - { - GNUNET_break (0); - TALER_LOG_ERROR ("Malformed host from payto:// URI\n"); - GNUNET_free (r_account->hostname); - return TALER_EC_PAYTO_MALFORMED; - } - } - if (443 != port) - { - GNUNET_assert - (GNUNET_SYSERR != GNUNET_asprintf - (&r_account->bank_base_url, - "http://%s", - r_account->hostname)); - } - else - { - GNUNET_assert - (GNUNET_SYSERR != GNUNET_asprintf - (&r_account->bank_base_url, - "https://%s", - r_account->hostname)); - } - } - return TALER_EC_NONE; -} - - /** * Check if the given payto:// URL is correctly formatted. * @@ -318,9 +196,18 @@ taler_bank_wire_validate (void *cls, const char *account_url) { (void) cls; + struct TALER_Account acc; + enum TALER_ErrorCode ec; - return parse_payto (account_url, - NULL); + ec = TALER_WIRE_payto_to_account (account_url, + &acc); + if (TALER_EC_NONE == ec) + { + if (TALER_PAC_X_TALER_BANK != acc.type) + ec = TALER_EC_PAYTO_WRONG_METHOD; + TALER_WIRE_account_free (&acc); + } + return ec; } @@ -462,7 +349,7 @@ do_prepare (void *cls) static int parse_account_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, - struct Account *account) + struct TALER_Account *account) { char *account_url; @@ -479,8 +366,8 @@ parse_account_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, } if (TALER_EC_NONE != - parse_payto (account_url, - account)) + TALER_WIRE_payto_to_account (account_url, + account)) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, section, @@ -489,6 +376,16 @@ parse_account_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_free (account_url); return GNUNET_SYSERR; } + if (TALER_PAC_X_TALER_BANK != account->type) + { + GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, + section, + "URL", + "Malformed payto:// URL for x-taler-bank method"); + GNUNET_free (account_url); + TALER_WIRE_account_free (account); + return GNUNET_SYSERR; + } GNUNET_free (account_url); return GNUNET_OK; } @@ -525,17 +422,25 @@ taler_bank_prepare_wire_transfer (void *cls, struct TalerBankClosure *tc = cls; struct TALER_WIRE_PrepareHandle *pth; char *origin_account_url; - struct Account a_in; - struct Account a_out; + struct TALER_Account a_in; + struct TALER_Account a_out; /* Check that payto:// URLs are valid */ if (TALER_EC_NONE != - parse_payto (destination_account_url, - &a_out)) + TALER_WIRE_payto_to_account (destination_account_url, + &a_out)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "payto://-URL `%s' is invalid!\n", + destination_account_url); + return NULL; + } + if (TALER_PAC_X_TALER_BANK != a_out.type) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "payto://-URL `%s' is invalid!\n", destination_account_url); + TALER_WIRE_account_free (&a_out); return NULL; } if (GNUNET_OK != @@ -547,43 +452,47 @@ taler_bank_prepare_wire_transfer (void *cls, GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, origin_account_section, "URL"); - GNUNET_free (a_out.hostname); - GNUNET_free (a_out.bank_base_url); + TALER_WIRE_account_free (&a_out); return NULL; } if (TALER_EC_NONE != - parse_payto (origin_account_url, - &a_in)) + TALER_WIRE_payto_to_account (origin_account_url, + &a_in)) { GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, origin_account_section, "URL", "Malformed payto:// URL for x-taler-bank method"); GNUNET_free (origin_account_url); - GNUNET_free (a_out.hostname); - GNUNET_free (a_out.bank_base_url); + TALER_WIRE_account_free (&a_out); + return NULL; + } + if (TALER_PAC_X_TALER_BANK != a_in.type) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "payto://-URL `%s' is invalid!\n", + origin_account_url); + GNUNET_free (origin_account_url); + TALER_WIRE_account_free (&a_in); + TALER_WIRE_account_free (&a_out); return NULL; } /* Make sure the bank is the same! */ - if (0 != strcasecmp (a_in.hostname, - a_out.hostname)) + if (0 != strcasecmp (a_in.details.x_taler_bank.hostname, + a_out.details.x_taler_bank.hostname)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "x-taler-bank hostname missmatch: `%s' != `%s'\n", - a_in.hostname, - a_out.hostname); - GNUNET_free (a_in.hostname); - GNUNET_free (a_in.bank_base_url); - GNUNET_free (a_out.hostname); - GNUNET_free (a_out.bank_base_url); + a_in.details.x_taler_bank.hostname, + a_out.details.x_taler_bank.hostname); + TALER_WIRE_account_free (&a_in); + TALER_WIRE_account_free (&a_out); GNUNET_free (origin_account_url); return NULL; } - GNUNET_free (a_in.hostname); - GNUNET_free (a_in.bank_base_url); - GNUNET_free (a_out.hostname); - GNUNET_free (a_out.bank_base_url); + TALER_WIRE_account_free (&a_in); + TALER_WIRE_account_free (&a_out); pth = GNUNET_new (struct TALER_WIRE_PrepareHandle); if (GNUNET_OK != @@ -690,8 +599,8 @@ taler_bank_execute_wire_transfer (void *cls, struct TalerBankClosure *tc = cls; struct TALER_WIRE_ExecuteHandle *eh; struct TALER_Amount amount; - struct Account origin_account; - struct Account destination_account; + struct TALER_Account origin_account; + struct TALER_Account destination_account; struct BufFormatP bf; const char *exchange_base_url; const char *origin_account_url; @@ -770,29 +679,28 @@ taler_bank_execute_wire_transfer (void *cls, } if (TALER_EC_NONE != - parse_payto (origin_account_url, - &origin_account)) + TALER_WIRE_payto_to_account (origin_account_url, + &origin_account)) { GNUNET_break (0); return NULL; } if (TALER_EC_NONE != - parse_payto (destination_account_url, - &destination_account)) + TALER_WIRE_payto_to_account (destination_account_url, + &destination_account)) { - GNUNET_free_non_null (origin_account.hostname); - GNUNET_free_non_null (origin_account.bank_base_url); + TALER_WIRE_account_free (&origin_account); GNUNET_break (0); return NULL; } - if (0 != strcasecmp (origin_account.hostname, - destination_account.hostname)) + if ( (TALER_PAC_X_TALER_BANK != origin_account.type) || + (TALER_PAC_X_TALER_BANK != destination_account.type) || + (0 != strcasecmp (origin_account.details.x_taler_bank.hostname, + destination_account.details.x_taler_bank.hostname)) ) { GNUNET_break (0); - GNUNET_free_non_null (origin_account.hostname); - GNUNET_free_non_null (destination_account.hostname); - GNUNET_free_non_null (origin_account.bank_base_url); - GNUNET_free_non_null (destination_account.bank_base_url); + TALER_WIRE_account_free (&origin_account); + TALER_WIRE_account_free (&destination_account); return NULL; } @@ -802,19 +710,17 @@ taler_bank_execute_wire_transfer (void *cls, wire_s = GNUNET_STRINGS_data_to_string_alloc (&bf.wtid, sizeof (bf.wtid)); eh->aaih = TALER_BANK_admin_add_incoming (tc->ctx, - origin_account.bank_base_url, + origin_account.details.x_taler_bank.bank_base_url, &auth, exchange_base_url, wire_s, &amount, - (uint64_t) origin_account.no, - (uint64_t) destination_account.no, + (uint64_t) origin_account.details.x_taler_bank.no, + (uint64_t) destination_account.details.x_taler_bank.no, &execute_cb, eh); - GNUNET_free_non_null (origin_account.bank_base_url); - GNUNET_free_non_null (destination_account.bank_base_url); - GNUNET_free_non_null (origin_account.hostname); - GNUNET_free_non_null (destination_account.hostname); + TALER_WIRE_account_free (&origin_account); + TALER_WIRE_account_free (&destination_account); GNUNET_free (wire_s); if (NULL == eh->aaih) { @@ -1044,7 +950,7 @@ taler_bank_get_history (void *cls, struct TALER_WIRE_HistoryHandle *whh; const uint64_t *start_off_b64; uint64_t start_row; - struct Account account; + struct TALER_Account account; if (0 == num_results) { @@ -1111,11 +1017,11 @@ taler_bank_get_history (void *cls, whh->hres_cb_cls = hres_cb_cls; whh->hh = TALER_BANK_history (tc->ctx, - account.bank_base_url, + account.details.x_taler_bank.bank_base_url, &whh->auth, - (uint64_t) account.no, + (uint64_t) account.details.x_taler_bank.no, direction, - /* Defaults to descending ordering always. */ + /* Defaults to descending ordering always. */ GNUNET_NO, start_row, num_results, @@ -1126,12 +1032,10 @@ taler_bank_get_history (void *cls, GNUNET_break (0); taler_bank_get_history_cancel (NULL, whh); - GNUNET_free (account.hostname); - GNUNET_free (account.bank_base_url); + TALER_WIRE_account_free (&account); return NULL; } - GNUNET_free (account.hostname); - GNUNET_free (account.bank_base_url); + TALER_WIRE_account_free (&account); GNUNET_assert (NULL != whh); return whh; } @@ -1171,7 +1075,7 @@ taler_bank_get_history_range GNUNET_break (0); return NULL; - struct Account account; + struct TALER_Account account; struct TalerBankClosure *tc = cls; struct TALER_WIRE_HistoryHandle *whh; @@ -1204,11 +1108,11 @@ taler_bank_get_history_range whh->hh = TALER_BANK_history_range (tc->ctx, - account.bank_base_url, + account.details.x_taler_bank.bank_base_url, &whh->auth, - account.no, + account.details.x_taler_bank.no, direction, - /* Just always descending. */ + /* Just always descending. */ GNUNET_NO, start_date, end_date, @@ -1219,13 +1123,10 @@ taler_bank_get_history_range GNUNET_break (0); taler_bank_get_history_cancel (NULL, whh); - GNUNET_free (account.hostname); - GNUNET_free (account.bank_base_url); + TALER_WIRE_account_free (&account); return NULL; } - - GNUNET_free (account.hostname); - GNUNET_free (account.bank_base_url); + TALER_WIRE_account_free (&account); GNUNET_assert (NULL != whh); return whh; @@ -1339,7 +1240,7 @@ taler_bank_reject_transfer (void *cls, struct TalerBankClosure *tc = cls; const uint64_t *rowid_b64 = start_off; struct TALER_WIRE_RejectHandle *rh; - struct Account account; + struct TALER_Account account; if (sizeof (uint64_t) != start_off_len) { @@ -1367,11 +1268,11 @@ taler_bank_reject_transfer (void *cls, rh->rej_cb = rej_cb; rh->rej_cb_cls = rej_cb_cls; TALER_LOG_INFO ("Rejecting over %s bank URL\n", - account.hostname); + account.details.x_taler_bank.hostname); rh->brh = TALER_BANK_reject (tc->ctx, - account.bank_base_url, + account.details.x_taler_bank.bank_base_url, &rh->auth, - (uint64_t) account.no, + (uint64_t) account.details.x_taler_bank.no, GNUNET_ntohll (*rowid_b64), &reject_cb, rh); @@ -1379,10 +1280,10 @@ taler_bank_reject_transfer (void *cls, { (void) taler_bank_reject_transfer_cancel (tc, rh); - GNUNET_free (account.hostname); + TALER_WIRE_account_free (&account); return NULL; } - GNUNET_free (account.hostname); + TALER_WIRE_account_free (&account); return rh; } diff --git a/src/wire-plugins/test_ebics_wireformat.c b/src/wire-plugins/test_ebics_wireformat.c index 0d6b76ad0..a810d5578 100644 --- a/src/wire-plugins/test_ebics_wireformat.c +++ b/src/wire-plugins/test_ebics_wireformat.c @@ -26,17 +26,17 @@ /** * Valid SEPA data */ -static const char *valid_wire_str = "payto://sepa/DE67830654080004822650"; +static const char *valid_wire_str = "payto://iban/DE67830654080004822650"; /** * IBAN has wrong country code */ -static const char *invalid_wire_str = "payto://sepa/XX67830654080004822650"; +static const char *invalid_wire_str = "payto://iban/XX67830654080004822650"; /** * IBAN has wrong checksum */ -static const char *invalid_wire_str2 = "payto://sepa/DE67830654080004822651"; +static const char *invalid_wire_str2 = "payto://iban/DE67830654080004822651"; /** * Unsupported wireformat type -- cgit v1.2.3