merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

test_merchant_instance_creation.sh (2553B)


      1 #!/bin/bash
      2 # This file is part of TALER
      3 # Copyright (C) 2014-2023 Taler Systems SA
      4 #
      5 # TALER is free software; you can redistribute it and/or modify
      6 # it under the terms of the GNU General Public License as
      7 # published by the Free Software Foundation; either version 3, or
      8 # (at your option) any later version.
      9 #
     10 # TALER is distributed in the hope that it will be useful, but
     11 # WITHOUT ANY WARRANTY; without even the implied warranty of
     12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13 # GNU General Public License for more details.
     14 #
     15 # You should have received a copy of the GNU General Public
     16 # License along with TALER; see the file COPYING.  If not, see
     17 # <http://www.gnu.org/licenses/>
     18 #
     19 
     20 . setup.sh
     21 
     22 # Launch only the merchant.
     23 setup -c test_template.conf -m
     24 
     25 
     26 echo -n "Configuring a merchant instance before configuring the admin instance ..."
     27 
     28 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     29     http://localhost:9966/management/instances \
     30     -d '{"auth":{"method":"token","password":"secret-token:other_secret"},"id":"first","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
     31     -w "%{http_code}" -s -o /dev/null)
     32 
     33 if [ "$STATUS" != "204" ]
     34 then
     35     echo "Expected 204, instance created. got: $STATUS"
     36     exit 1
     37 fi
     38 
     39 echo " OK"
     40 
     41 echo -n "Configuring admin instance ..."
     42 
     43 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     44     -H 'Authorization: Bearer secret-token:super_secret' \
     45     http://localhost:9966/management/instances \
     46     -d '{"auth":{"method":"external"},"id":"admin","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
     47     -w "%{http_code}" -s -o /dev/null)
     48 
     49 if [ "$STATUS" != "401" ]
     50 then
     51     echo "Expected 401, permission denied. got: $STATUS"
     52     exit 1
     53 fi
     54 
     55 echo " OK"
     56 
     57 echo -n "Configuring a second merchant instance ..."
     58 
     59 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     60     http://localhost:9966/management/instances \
     61     -d '{"auth":{"method":"token","password":"secret-token:other_secret"},"id":"second","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
     62     -w "%{http_code}" -s -o /dev/null)
     63 
     64 if [ "$STATUS" != "401" ]
     65 then
     66     echo "Expected 401, permission denied. got: $STATUS"
     67     exit 1
     68 fi
     69 
     70 echo " OK"
     71 
     72 exit 0