From 5bd1483aa8ad170a3a2d7fa694f57621dfdf27a3 Mon Sep 17 00:00:00 2001 From: k4rli Date: Wed, 13 Aug 2025 13:01:56 +0300 Subject: [PATCH] Run test sync with curl --- run-test-sync-local.sh | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 run-test-sync-local.sh diff --git a/run-test-sync-local.sh b/run-test-sync-local.sh new file mode 100644 index 0000000..16d9645 --- /dev/null +++ b/run-test-sync-local.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +MEDUSA_ORDER_ID="order_01K1TQQHZGPXKDHAH81TDSNGXR" + +# HOSTNAME="https://test.medreport.ee" +# JOBS_API_TOKEN="fd26ec26-70ed-11f0-9e95-431ac3b15a84" + +HOSTNAME="http://localhost:3000" +JOBS_API_TOKEN=73ce073c-6dd4-11f0-8e75-8fee89786197 + +function send_medipost_test_response() { + curl -X POST "$HOSTNAME/api/order/medipost-test-response" \ + --header "x-jobs-api-key: $JOBS_API_TOKEN" \ + --header 'Content-Type: application/json' \ + --data '{ "medusaOrderId": "'$MEDUSA_ORDER_ID'" }' +} + +function sync_analysis_results() { + curl -X POST "$HOSTNAME/api/job/sync-analysis-results" \ + --header "x-jobs-api-key: $JOBS_API_TOKEN" +} + +function sync_analysis_groups() { + curl -X POST "$HOSTNAME/api/job/sync-analysis-groups" \ + --header "x-jobs-api-key: $JOBS_API_TOKEN" +} + +function sync_analysis_groups_store() { + curl -X POST "$HOSTNAME/api/job/sync-analysis-groups-store" \ + --header "x-jobs-api-key: $JOBS_API_TOKEN" +} + +# Requirements + +# 1. Sync analysis groups from Medipost to B2B +sync_analysis_groups + +# 2. Optional - sync all Medipost analysis groups from B2B to Medusa (or add manually) +#sync_analysis_groups_store + +# 3. Set up products configurations in Medusa so B2B "Telli analüüs" page shows the product and you can do payment flow + +# 4. After payment is done, run `send_medipost_test_response` to send the fake test results to Medipost +# send_medipost_test_response + +# 5. Run `sync_analysis_results` to sync the all new Medipost results to B2B +# sync_analysis_results