# bookingimport

bookingimport is a tool for importing csv payment files.
This application contains a command line tool and a web page for import.

Requirement: JDK 17, Tomcat 9 or 10

## Currency
Currencies are created automatically if they don't exist in CashCtrl.
If the Currencies is not supported by CashCtrl you have to manually adjust the exchange rate in CashCtrl.

Supported Currencies: aud, btc, cad, chf, cny, dkk, eur, gbp, inr, jpy, rub, sek, thb, usd

## Webpage - WAR
For running the Website you need a server like Tomcat to deploy the WAR to.
- Download Tomcat "https://tomcat.apache.org"
- Copy the War to the Tomcat "apache-tomcat-xx.xx.xx\webapps" directory
- Run the Tomcat by clicking on "apache-tomcat-xx.xx.xx\bin\startup.bat"
- Open in browser "http://www.myDomain/bookingimport-web/"

## Examples

### Import C:\paypal\paypal-payments-EN.csv into CashCtrl
java -jar bookingimport.jar -org myorg -key "82HF4ihfhdjf839HfUJHsjDh910" -file "C:\paypal\paypal-payments-EN.csv" -revenue 3400 -expense 4400 -balance 1102

### Import C:\stripe\stripe-payments-EN.csv into CashCtrl with metadata invoiceField "invoiceNr" and customerField "customerNr"
java -jar bookingimport.jar -org "https://myorg.cashctrl.com/" -key "82HF4ihfhdjf839HfUJHsjDh910" -file "C:\stripe\stripe-payments-EN.csv" -revenue 3400 -expense 4400 -balance 1101 -invoiceField "invoiceNr" -customerField "customerNr"

### Import multiple files at once
java -jar bookingimport.jar -org "https://myorg.cashctrl.com/" -key "82HF4ihfhdjf839HfUJHsjDh910" -file "C:\sumup\sumup-payments-EN.csv C:\sumup\sumup-payments-DE.csv" -revenue 3400 -expense 4400 -balance 1103
java -jar bookingimport.jar -org "https://myorg.cashctrl.com/" -key "82HF4ihfhdjf839HfUJHsjDh910" -file "C:\payrexx\payrexx-payments-jun-EN.csv C:\payrexx\payrexx-payments-mai-DE.csv" -revenue 3400 -expense 4400 -balance 1104

## Command line options

-org <organisation name>
-key <organisation key>
-file <stripe csv file path>
-revenue <revenue account number>
-expense <expense account number>
-balance <balance account number>
-invoiceField <invoice field e. g "invoiceN">
-customerField <customer field e. g "customerNr">

### -org (Mandatory)
The organisation name in CashCtrl or CashCtrl URL: "https://myOrg.cashctrl.com"

### -key (Mandatory)
The organisation API key

### -file (Mandatory)
The exact path where the stripe csv is located like this: "C:\stripe\stripe_payments_2022.csv"

### -revenue (Mandatory)
The revenue account number in CashCtrl (Must exist in CashCtrl).

### -expense (Mandatory)
The expense account number in CashCtrl

### -balance (Mandatory)
The balance account number in CashCtrl

### -invoiceField (Optional)
The name of the invoice field in the stripe csv file, you don't need to append " (metadata)" to it.

### -customerField (Optional)
The name of the customer field in the stripe csv file, you don't need to append " (metadata)" to it.