aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpriscilla <priscilla.huang@efrei.net>2022-11-24 10:31:49 -0500
committerpriscilla <priscilla.huang@efrei.net>2022-11-24 10:31:49 -0500
commit6874f45896dfe00d5106c69fa9312cbac216899a (patch)
tree9942890cd1bbc21d910fba5433079c058158dfde
parenta16f8ac9bbdafc11b293860619907836f651ead1 (diff)
Update
-rw-r--r--src/backenddb/merchant-0004.sql33
-rwxr-xr-xsrc/testing/test_merchant_product_creation.sh3
-rw-r--r--src/testing/test_merchant_template_creation.sh0
3 files changed, 35 insertions, 1 deletions
diff --git a/src/backenddb/merchant-0004.sql b/src/backenddb/merchant-0004.sql
index 0e8428ca..0b2cc349 100644
--- a/src/backenddb/merchant-0004.sql
+++ b/src/backenddb/merchant-0004.sql
@@ -48,3 +48,36 @@ COMMENT ON COLUMN merchant_template.template_contract
IS 'The template contract will contains some additional information.';
COMMIT;
+
+
+CREATE TABLE IF NOT EXISTS merchant_webhooks
+ (webhooks_serial BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
+ ,merchant_serial BIGINT NOT NULL
+ REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE
+ ,webhooks_id VARCHAR NOT NULL
+ ,event_type VARCHAR NOT NULL
+ ,url VARCHAR NOT NULL
+ ,methods VARCHAR NOT NULL
+ ,header_template VARCHAR NOT NULL -- in JSON format
+ ,body_template VARCHAR NOT NULL -- in JSON format
+ ,merchant_instance VARCHAR NOT NULL
+ ,UNIQUE (merchant_serial, webhooks_id)
+ );
+COMMENT ON TABLE merchant_webhooks
+ IS 'webhooks used by the merchant (may be incomplete, frontend can override)';
+COMMENT ON COLUMN merchant_webhooks.event_type
+ IS 'Event of the webhooks';
+COMMENT ON COLUMN merchant_webhooks.url
+ IS 'URL use by the customer';
+COMMENT ON COLUMN merchant_webhooks.methods
+ IS 'Methods use by the merchant';
+COMMENT ON COLUMN merchant_webhooks.header_template
+ IS 'Header of the webhooks';
+COMMENT ON COLUMN merchant_webhooks.body_template
+ IS 'Body of the webhooks';
+COMMENT ON COLUMN merchant_webhooks.merchant_instance
+ IS 'Information of the merchant';
+
+COMMIT;
+
+
diff --git a/src/testing/test_merchant_product_creation.sh b/src/testing/test_merchant_product_creation.sh
index 9b109f0f..246efd33 100755
--- a/src/testing/test_merchant_product_creation.sh
+++ b/src/testing/test_merchant_product_creation.sh
@@ -24,7 +24,8 @@ FORTYTHREE=`get_payto_uri fortythree x`
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"payto_uris":["'$FORTYTHREE'"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"payto_uris":["'$FORTYTHREE'"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS
+:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_template_creation.sh b/src/testing/test_merchant_template_creation.sh
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/testing/test_merchant_template_creation.sh