diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-08 19:55:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-08 19:55:18 +0200 |
commit | 4f846eab966e2366c860c8708d3c47c18397d346 (patch) | |
tree | 935d88530cc09a9c1fe935c7205ede29356bbbce /src/include | |
parent | 8800110b72d539e6e9a57ca9e6a66a9ad427f528 (diff) |
fix #5756, also change sepa->iban as per payto:// spec
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_exchangedb_plugin.h | 2 | ||||
-rw-r--r-- | src/include/taler_signatures.h | 6 | ||||
-rw-r--r-- | src/include/taler_wire_lib.h | 97 | ||||
-rw-r--r-- | src/include/taler_wire_plugin.h | 4 |
4 files changed, 103 insertions, 6 deletions
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 0a46c7264..6f1625dd0 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -1922,7 +1922,7 @@ struct TALER_EXCHANGEDB_Plugin * * @param cls closure * @param session database connection - * @param type type of the wire transfer (i.e. "sepa") + * @param type type of the wire transfer (i.e. "iban") * @param buf buffer with wire transfer preparation data * @param buf_size number of bytes in @a buf * @return query status code diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h index 5472ad01f..bff73f737 100644 --- a/src/include/taler_signatures.h +++ b/src/include/taler_signatures.h @@ -72,7 +72,7 @@ #define TALER_SIGNATURE_MASTER_DENOMINATION_KEY_REVOKED 1029 /** - * Signature where the Exchange confirms its SEPA details in + * Signature where the Exchange confirms its IBAN details in * the /wire response. */ #define TALER_SIGNATURE_MASTER_WIRE_DETAILS 1030 @@ -878,7 +878,7 @@ struct TALER_ExchangeKeyValidityPS /** * @brief Information signed by the exchange's master - * key affirming the SEPA details for the exchange. + * key affirming the IBAN details for the exchange. */ struct TALER_MasterWireDetailsPS { @@ -911,7 +911,7 @@ struct TALER_MasterWireFeePS struct GNUNET_CRYPTO_EccSignaturePurpose purpose; /** - * Hash over the wire method (yes, H("test") or H("sepa")), in lower + * Hash over the wire method (yes, H("x-taler-bank") or H("iban")), in lower * case, including 0-terminator. Used to uniquely identify which * wire method these fees apply to. */ diff --git a/src/include/taler_wire_lib.h b/src/include/taler_wire_lib.h index aef61f61c..835ea7ca5 100644 --- a/src/include/taler_wire_lib.h +++ b/src/include/taler_wire_lib.h @@ -24,6 +24,103 @@ #include <gnunet/gnunet_util_lib.h> #include "taler_wire_plugin.h" +/** + * Different account types supported by payto://. + */ +enum TALER_PaytoAccountType + { + + /** + * Used to indicate an uninitialized struct. + */ + TALER_PAC_NONE = 0, + + /** + * Account type of a bank running the x-taler-bank protocol. + */ + TALER_PAC_X_TALER_BANK, + + /** + * Account identified by IBAN number. + */ + TALER_PAC_IBAN + }; + +/** + * Information about an account extracted from a payto://-URL. + */ +struct TALER_Account +{ + + /** + * How this the account represented. + */ + enum TALER_PaytoAccountType type; + + /** + * Internals depending on @e type. + */ + union { + + /** + * Taler bank address from x-taler-bank. Set if + * @e type is #TALER_AC_X_TALER_BANK. + */ + struct { + + /** + * 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; + } x_taler_bank; + + /** + * Taler bank address from iban. Set if + * @e type is #TALER_AC_IBAN. + */ + struct { + + /** + * IBAN number. + */ + char *number; + + } iban; + + } details; +}; + + +/** + * Release memory allocated in @a acc. + * + * @param acc account to free, the pointer itself is NOT free'd. + */ +void +TALER_WIRE_account_free (struct TALER_Account *acc); + + +/** + * Parse @a payto_url and store the result in @a acc + * + * @param payto_url URL to parse + * @param acc[in,out] account to initialize, free using #TALER_WIRE_account_free() later + * @return #TALER_EC_NONE if @a payto_url is well-formed + */ +enum TALER_ErrorCode +TALER_WIRE_payto_to_account (const char *payto_url, + struct TALER_Account *acc); + /** * Obtain the payment method from a @a payto_url diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h index ff89593eb..3d05ae01e 100644 --- a/src/include/taler_wire_plugin.h +++ b/src/include/taler_wire_plugin.h @@ -172,7 +172,7 @@ struct TALER_WIRE_Plugin /** * Which wire method (payto://METHOD/") is supported by this plugin? - * For example, "sepa" or "x-taler-bank". + * For example, "iban" or "x-taler-bank". */ const char *method; @@ -180,7 +180,7 @@ struct TALER_WIRE_Plugin /** * Round amount DOWN to the amount that can be transferred via the wire * method. For example, Taler may support 0.000001 EUR as a unit of - * payment, but SEPA only supports 0.01 EUR. This function would + * payment, but IBAN only supports 0.01 EUR. This function would * round 0.125 EUR to 0.12 EUR in this case. * * @param cls the @e cls of this struct with the plugin-specific state |