Created
July 10, 2023 11:29
-
-
Save longdog/bbecc02d2c8bf94ce5531f476c3ea7fd to your computer and use it in GitHub Desktop.
atol online xml check generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
XMLFILE=$1 | |
EMAILS=("[email protected]", "[email protected]", "[email protected]") | |
ITEMS=("Услуги") | |
# My data | |
MY_EMAIL="[email protected]" | |
MY_INN="1183128101" | |
MY_PAGE="test.ru" | |
CASHIER="Иванов Иван Иванович" | |
readarray -t CHECKS < "./sums" | |
/bin/cat <<EOM >$XMLFILE | |
<?xml version="1.0" encoding="UTF-8"?> | |
<main> | |
EOM | |
# Generate Checks | |
for PRICE in "${CHECKS[@]}"; do | |
TIMESTAMP=$(date +"%d.%m.%Y %H:%M:%S") | |
EXTERNAL_ID=$(uuidgen) | |
CLIENT_EMAIL=${EMAILS[RANDOM % ${#EMAILS[@]}]} | |
ITEM=${ITEMS[RANDOM % ${#ITEMS[@]}]} | |
/bin/cat <<EOM >>$XMLFILE | |
<check> | |
<timestamp>$TIMESTAMP</timestamp> | |
<external_id>$EXTERNAL_ID</external_id> | |
<is_bso>false</is_bso> | |
<receipt> | |
<operation>sell</operation> | |
<client> | |
<email>$CLIENT_EMAIL</email> | |
</client> | |
<company> | |
<email>$MY_EMAIL</email> | |
<sno>patent</sno> | |
<inn>$MY_INN</inn> | |
<payment_address>$MY_PAGE</payment_address> | |
</company> | |
<items> | |
<item> | |
<name>$ITEM</name> | |
<price>$PRICE</price> | |
<quantity>1</quantity> | |
<sum>$PRICE</sum> | |
<payment_method>full_payment</payment_method> | |
<payment_object>service</payment_object> | |
<vat> | |
<type>none</type> | |
<sum>0.00</sum> | |
</vat> | |
</item> | |
</items> | |
<payments> | |
<payment> | |
<type>1</type> | |
<sum>$PRICE</sum> | |
</payment> | |
</payments> | |
<vats> | |
<vat> | |
<type>none</type> | |
<sum>0.00</sum> | |
</vat> | |
</vats> | |
<total>$PRICE</total> | |
<cashier>$CASHIER</cashier> | |
</receipt> | |
</check> | |
EOM | |
done # end loop | |
# | |
/bin/cat <<EOM >>$XMLFILE | |
</main> | |
EOM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100.0 | |
20.0 | |
150.0 | |
320.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment