From 92aa812717047d65c507d2627aad145d432f9c05 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Fri, 27 Apr 2018 16:02:16 +0200 Subject: configuring the merchant the "payto"-compliant way --- config/generate-config | 54 +++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'config') diff --git a/config/generate-config b/config/generate-config index e42c7af..be9de02 100755 --- a/config/generate-config +++ b/config/generate-config @@ -60,7 +60,7 @@ def config(currency, envname, exchange_pub, standalone): cfg_put("bank", "database", "postgres:///taler{}".format(envname)) if standalone: - cfg_put("bank", "suggested_exchange", "https://env.taler.net/{}/exchange/".format(envname)) + cfg_put("bank", "suggested_exchange", "https://env.taler.net/{}/exchange/".format(os.getenv("HOME"))) else: cfg_put("bank", "suggested_exchange", "https://exchange.{}.taler.net/".format(envname)) @@ -218,12 +218,22 @@ def config(currency, envname, exchange_pub, standalone): cfg_put("instance-tutorial", "keyfile", "${TALER_DEPLOYMENT_SHARED}/merchant/tutorial.priv") cfg_put("instance-tutorial", "name", "Tutorial") - cfg_put("instance-wireformat-Tor", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/tor.json") - cfg_put("instance-wireformat-GNUnet", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/gnunet.json") - cfg_put("instance-wireformat-Taler", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/taler.json") - cfg_put("instance-wireformat-FSF", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/fsf.json") - cfg_put("instance-wireformat-default", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/default.json") - cfg_put("instance-wireformat-tutorial", "test_response_file", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/default.json") + if standalone: + cfg_put("account-merchant", "url", "payto://x-taler-bank/env.taler.net/{}/bank/{}".format(os.getenv("HOME"), "3")) + else: + cfg_put("account-merchant", "url", "payto://x-taler-bank/bank.{}.taler.net/{}".format(envname, "3")) + + cfg_put("account-merchant", "plugin", "taler_bank") + cfg_put("account-merchant", "taler_bank_auth_method", "basic") + cfg_put("account-merchant", "username", "user") + cfg_put("account-merchant", "password", "pass") + cfg_put("account-merchant", "wire_response", "${TALER_DEPLOYMENT_SHARED}/merchant/wire/merchant.json") + + cfg_put("account-merchant", "HONOR_default", "YES") + cfg_put("account-merchant", "HONOR_tor", "YES") + cfg_put("account-merchant", "HONOR_gnunet", "YES") + cfg_put("account-merchant", "HONOR_taler", "YES") + cfg_put("account-merchant", "HONOR_fsf", "YES") coin(currency, "ct_10", "0.10") coin(currency, "1", "1") @@ -233,16 +243,15 @@ def config(currency, envname, exchange_pub, standalone): coin(currency, "1000", "1000") -def merchant_wf(envname, instance_name, acct_no, standalone): +def merchant_wf(envname, acct_no, standalone): + if standalone: - bank_url = "https://env.taler.net/{}/bank/".format(envname) + payto_url = "payto://x-taler-bank/env.taler.net/{}/bank/{}".format(envname, acct_no) else: - bank_url = "https://bank.{}.taler.net/".format(envname) + payto_url = "payto://x-taler-bank/bank.{}.taler.net/{}".format(envname, acct_no) + data = OrderedDict( - type="test", - bank_url=bank_url, - sig="MERCHANTSIGNATURE", - account_number=acct_no, + url=payto_url, salt="SALT" ) @@ -288,18 +297,14 @@ def main(currency, envname, outdir, shared_outdir, exchange_pub, standalone): config(currency, envname, exchange_pub, standalone) - merchant_wireformats = [ - merchant_wf(envname, "gnunet", 4, standalone), - merchant_wf(envname, "taler", 5, standalone), - merchant_wf(envname, "tor", 3, standalone), - merchant_wf(envname, "fsf", 6, standalone), - merchant_wf(envname, "default", 7, standalone), - ] - exchange_wireformats = [ exchange_wf(envname, "test", 2, "The exchange", standalone) ] + merchant_wireformats = [ + merchant_wf(envname, 3, standalone) + ] + if outdir: os.makedirs(outdir, exist_ok=True) tc = os.path.join(outdir, "taler.conf") @@ -311,11 +316,14 @@ def main(currency, envname, outdir, shared_outdir, exchange_pub, standalone): if shared_outdir: d = os.path.join(shared_outdir, "merchant", "wire") os.makedirs(d, exist_ok=True) + for name, data in merchant_wireformats: - f = open(os.path.join(d, name+".json"), "w") + filename = os.path.join(d, "merchant.json") + f = open(filename, "w") f.write(data) f.close() + d = os.path.join(shared_outdir, "exchange", "wire") os.makedirs(d, exist_ok=True) for name, data in exchange_wireformats: -- cgit v1.2.3