From 2821b4c5f85aa22620d18b2dfc1cb917833946ee Mon Sep 17 00:00:00 2001 From: Thibaud Guillaume-Gentil Date: Fri, 20 Sep 2024 09:06:17 +0200 Subject: [PATCH] Skip locali for now This will be handle manually by them. --- app.rb | 2 +- config/mapping.yml | 28 ++++++++++----------- test/app_test.rb | 62 +++++++++++++++++++++++----------------------- 3 files changed, 46 insertions(+), 46 deletions(-) diff --git a/app.rb b/app.rb index 1bc2735..049f8cb 100644 --- a/app.rb +++ b/app.rb @@ -16,9 +16,9 @@ class App < Sinatra::Base verify_signature! payload = parse_payload - logger.info payload begin member_params = Webhook.handle!(payload) + logger.info payload logger.info member_params rescue => e logger.info "#{e.class} - #{e.message}" diff --git a/config/mapping.yml b/config/mapping.yml index 4ff36d7..7cf7509 100644 --- a/config/mapping.yml +++ b/config/mapping.yml @@ -52,20 +52,6 @@ cocagne: 33578: 37 # 158 rte d'Aïre 1219 Aïre 33577: 48 # 12 ch. de la Verseuse 1219 Le Lignon -locali: - store_id: 33 - api_endpoint: https://admin.panier-locali.ch/api/v1/members - basket_sizes: - 34090: 1 # Panier famille ? - depots: - 35412: 9 # Vernier (à confirmer) - 35411: 7 # Meyrin Champs Fréchets (à confirmer) - 34101: 4 # Servette - 34099: 1 # Plainpalais - 34100: 3 # Plan les Ouates Sciers (à confirmer) - 34097: 2 # Meyrin Vergers - 34096: 6 # Conches - touviere: store_id: 34 api_endpoint: https://admin.touviere.ch/api/v1/members @@ -80,3 +66,17 @@ touviere: 34132: 2 # Chêne-Bourg 34131: 3 # Jonction 34129: 1 # Domaine de la Touvière + +# locali: +# store_id: 33 +# api_endpoint: https://admin.panier-locali.ch/api/v1/members +# basket_sizes: +# 34090: 1 # Panier famille ? +# depots: +# 35412: 9 # Vernier (à confirmer) +# 35411: 7 # Meyrin Champs Fréchets (à confirmer) +# 34101: 4 # Servette +# 34099: 1 # Plainpalais +# 34100: 3 # Plan les Ouates Sciers (à confirmer) +# 34097: 2 # Meyrin Vergers +# 34096: 6 # Conches diff --git a/test/app_test.rb b/test/app_test.rb index e140f34..8d94dd6 100644 --- a/test/app_test.rb +++ b/test/app_test.rb @@ -62,37 +62,37 @@ def test_valid_webhook_request_cocagne }.to_json end - def test_valid_webhook_request_locali - ENV["LOCALI_API_TOKEN"] = "api-token-locali" - payload = File.read('test/fixtures/order_completed_locali.json') - stub_request(:any, "https://admin.panier-locali.test/api/v1/members") - .to_return(status: 201) - - request(payload) - - assert_equal 204, last_response.status - assert_empty last_response.body - - assert_requested :post, "https://admin.panier-locali.test/api/v1/members", - times: 1, - headers: { - "Content-Type" => "application/json", - "Authorization" => "Token token=api-token-locali" - }, - body: { - name: "Doe John", - emails: "john@doe.ch", - phones: "0791234567", - address: "Chemin de la Mairie 1", - city: "Genève", - zip: "1205", - country_code: "CH", - note: "Commande locali-ge.ch #35717", - waiting_basket_size_id: 1, - waiting_depot_id: 3, - members_basket_complements_attributes: [] - }.to_json - end + # def test_valid_webhook_request_locali + # ENV["LOCALI_API_TOKEN"] = "api-token-locali" + # payload = File.read('test/fixtures/order_completed_locali.json') + # stub_request(:any, "https://admin.panier-locali.test/api/v1/members") + # .to_return(status: 201) + + # request(payload) + + # assert_equal 204, last_response.status + # assert_empty last_response.body + + # assert_requested :post, "https://admin.panier-locali.test/api/v1/members", + # times: 1, + # headers: { + # "Content-Type" => "application/json", + # "Authorization" => "Token token=api-token-locali" + # }, + # body: { + # name: "Doe John", + # emails: "john@doe.ch", + # phones: "0791234567", + # address: "Chemin de la Mairie 1", + # city: "Genève", + # zip: "1205", + # country_code: "CH", + # note: "Commande locali-ge.ch #35717", + # waiting_basket_size_id: 1, + # waiting_depot_id: 3, + # members_basket_complements_attributes: [] + # }.to_json + # end def test_valid_webhook_request_touviere ENV["TOUVIERE_API_TOKEN"] = "api-token-touviere"