merchant

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

test_merchant_instance_purge.sh (2659B)


      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 LAST_RESPONSE=$(mktemp -p "${TMPDIR:-/tmp}" test_response.conf-XXXXXX)
     25 
     26 echo -n "Configuring admin instance ..." >&2
     27 
     28 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     29     -H 'Authorization: Bearer secret-token:super_secret' \
     30     http://localhost:9966/management/instances \
     31     -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}}' \
     32     -w "%{http_code}" -s -o /dev/null)
     33 
     34 if [ "$STATUS" != "204" ]
     35 then
     36     exit_fail "Expected 204, instance created. got: $STATUS"
     37 fi
     38 
     39 echo " OK" >&2
     40 
     41 echo -n "Configuring merchant instance ..." >&2
     42 
     43 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     44     http://localhost:9966/management/instances \
     45     -d '{"auth":{"method":"token","password":"secret-token:other_secret"},"id":"test","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
     46     -w "%{http_code}" -s -o /dev/null)
     47 
     48 if [ "$STATUS" != "204" ]
     49 then
     50     exit_fail "Expected 204, instance created. got: $STATUS"
     51 fi
     52 echo " OK" >&2
     53 
     54 echo -n "Deleting instance ..." >&2
     55 STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
     56     "http://localhost:9966/management/instances/test" \
     57     -w "%{http_code}" -s -o /dev/null)
     58 
     59 if [ "$STATUS" != "204" ]
     60 then
     61     exit_fail "Expected 204, instance deleted. got: $STATUS"
     62 fi
     63 
     64 echo " OK" >&2
     65 echo -n "Purging instance ..." >&2
     66 
     67 STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
     68     "http://localhost:9966/management/instances/test?purge=yes" \
     69     -w "%{http_code}" -s -o /dev/null)
     70 
     71 
     72 if [ "$STATUS" != "204" ]
     73 then
     74     exit_fail "Expected 204, instance deleted. got: $STATUS"
     75 fi
     76 
     77 echo " OK" >&2
     78 echo "Test PASSED"
     79 
     80 exit 0