---
# System prepended metadata

title: Payment Manager API

---

# Payment Manager API

## Login
### Login

```bash
GET /login?username=admin123
    &password=*********
```


Returns
```json
{
    "status": 200,
    "message": "Success",
    "data": {
        "id": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
        "first_name": "Admin",
        "last_name": "User",
        "email": "admin@example.com",
        "phone": "123123123",
        "userType": "admin",
        "username": "admin123",
        "password": "**********"
    }
}
```

### Forgot username
```bash
GET /forgot-username?email=admin@example.com
```


Returns
```json
{
    "status": 200,
    "message": "Success"
}
```
*Sends email with username*



### Forgot Passsword
```bash
GET /forgot-password?email=admin@example.com
```


Returns
```json
{
    "status": 200,
    "message": "Success"
}
```
*Sends Email with temporary password that needs to be changed*



<br>

---
## Payments
### Search Payment
Shows a list of payments that meet the criteria given in the endpoint's parameters


```bash
GET /payments?division=1,2,3
    &type=paypal
    &source=1
    &customer[lastName]=Robertson
    &customer[city]=Santa%20Ana
    ...
```


Returns

```json
[
    {
        "id": "123",
        "date": "2021-02-05T10:18:13-05:00",
        "division": "Division 1",
        "source": "Source A",
        "firstName": "Daniel",
        "lastName": "Robertson",
        "address": "2972 Westheimer Rd.",
        "city": "Santa Ana",
        "state": "Illinois",
        "zipcode": 85486,
        "phone": "(603) 555-0123",
        "email": "d.robertson@comcast.net",
        "subscriberId": "SRH76657",
        "paymentType": "credit",
        "amount": 145.00,
        "tax": 5.00,
        "total": 150.00,
        "cardNumber": "************4845",
        "cardExpiration": "2024-01",
        "fsv": 123456,
        "paymentCardType": "Visa",
        "token": 94789,
        "transaction": "Sale",
        "notes": [
            "lorem ipsum dolor sit amet",
            "Duis aute irure dolor in reprehenderit"
        ]
    }
]
```

### Create Payment
Creates a new entry for a payment
```bash
POST /create-payment
```

Parameters 
**(Example Credit Card)**
```json
{
    "division": "Division 1",
    "source": "Source A",
    "type": "Cancel",
    "firstName": "Daniel",
    "lastName": "Robertson",
    "address": "2972 Westheimer Rd.",
    "city": "Santa Ana",
    "state": "Illinois",
    "zipcode": 85486,
    "phone": "(603) 555-0123",
    "email": "d.robertson@comcast.net",
    "subscriberId": "SRH76657",
    "amount": "145.00",
    "tax": "5.00",
    "total": "150.00",
    "paymentType": "credit",
    "cardNumber": 1234123412341234,
    "cardExpiration": "2025-01",
    "fsv": 123456,
    "paymentCardType": "Visa"
    "bankAccount": null,
    "abaRouting": null,
    "bankAccountType": null,
    "accountType": null,
    "transaction": "Sale",
    "notes": [
        "lorem ipsum dolor sit amet",
        "Duis aute irure dolor in reprehenderit"
    ]
}
```
    
**(Example Bank Account)**
```json
{
    "division": "Division 1",
    "source": "Source A",
    "type": "Cancel",
    "state": "Voided",
    "status": "Success",
    "firstName": "Daniel",
    "lastName": "Robertson",
    "address": "2972 Westheimer Rd.",
    "city": "Santa Ana",
    "state": "Illinois",
    "zipcode": 85486,
    "phone": "(603) 555-0123",
    "email": "d.robertson@comcast.net",
    "subscriberId": "SRH76657",
    "amount": 145.00,
    "tax": 5.00,
    "total": 150.00,
    "paymentType": "bankAccount"
    "cardNumber": null,
    "cardExpiration": null,
    "fsv": null,
    "paymentCardType": null
    "bankAccount": 12333112312,
    "abaRouting": 123,
    "bankAccountType": "Checkings",
    "accountType": "Business",
    "transaction": "Sale",
    "notes": [
        "lorem ipsum dolor sit amet",
        "Duis aute irure dolor in reprehenderit"
    ]
}
```

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```

#### Notes
- There are two actions "Sale" and "Credit", whats the differente between those two?

### Save search (Payments)
Saves a performed search and create of list of previous searches
```bash
    POST /save-payments-search
```

Parameters
```json
    {
        "userId": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
        "data": {
            "date": "2021-02-05T10:18:13-05:00",
            "division": [1,2,3],
            "type": ["paypal"],
            "source": [1],
            "lastName": "Robertson"
            "city": "Santa Ana",
            ...
        }
    }
```

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```
<br>

---
## Accounts
### Search Account
Shows a list of accounts that meet the criteria given in the endpoint's parameters


```bash
GET /accounts?division=1,2,3
    &firstName=John
    &firstName=Edwards
    &accountNumber=1234567890
    &token=39144
    &phone=12312312313
    &email=admin@example.com
```


Returns

```json
[
    {
        "id": "123",
        "division": "Division 1",
        "source": "Source A",
        "firstName": "Daniel",
        "lastName": "Robertson",
        "address": "2972 Westheimer Rd.",
        "city": "Santa Ana",
        "state": "Illinois",
        "zipcode": 85486,
        "phone": "(603) 555-0123",
        "email": "d.robertson@comcast.net",
        "subscriberId": "SRH76657",
        "cardNumber": "************4845",
        "cardExpiration": "2024-01",
        "fsv": 123456,
        "paymentCardType": "Visa",
        "token": 94789,
        "expirationDate": "2024-06"
        ...
        "notes": [
            "lorem ipsum dolor sit amet",
            "Duis aute irure dolor in reprehenderit"
        ]
    }
]
```

#### Notes:
- Do users also have Bank account info?

### Create Account
Creates a new entry for an account
```bash
POST /create-account
```

Parameters 
```json
{
    "id": "123",
    "division": "Division 1",
    "source": "Source A",
    "firstName": "Daniel",
    "lastName": "Robertson",
    "address": "2972 Westheimer Rd.",
    "city": "Santa Ana",
    "state": "Illinois",
    "zipcode": 85486,
    "phone": "(603) 555-0123",
    "email": "d.robertson@comcast.net",
    "subscriberId": "SRH76657",
    "cardNumber": "************4845",
    "cardExpiration": "2024-01",
    "fsv": 123456,
    "paymentCardType": "Visa",
    "token": 94789,
    "expirationDate": "2024-06"
    ...
    "notes": [
        "lorem ipsum dolor sit amet",
        "Duis aute irure dolor in reprehenderit"
    ]
}

```

#### Notes:
- Do users also have Bank account info?

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```

### Save search (Accounts)
Saves a performed search and create of list of previous searches
```bash
    POST /save-accounts-search
```

Parameters
```json
    {
        "userId": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
        "data": {
            "date": "2021-02-05T10:18:13-05:00",
            "division": [1,2,3],
            "type": ["paypal"],
            "source": [1],
            "lastName": "Robertson"
            "city": "Santa Ana",
            ...
        }
    }
```

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```
<br>

---
## Users
### List All Users
```bash
GET /users
```

Returns
```json
{
    "status": 200,
    "message": "Success",
    "data": [
        {
            "id": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
            "userName": "d.robertson",
            "firstName": "Daniel",
            "lastName": "Robertson",
            "phone": "(603) 555-0123",
            "email": "d.robertson@comcast.net"
            "timezone": "GMT -5",
            "lastLogon": "2021-02-05T10:18:13-05:00",
            "paswwordChanged": "2021-02-05T10:18:13-05:00",
            "userType": "user",
            "department": "Sales",
            "status": 1,
            "permissions": [
                {
                    "division": 1,
                    "read": true,
                    "sale": false,
                    "void": true,
                    "credit": false,
                    "accounts": false,
                    "batch": false,
                    "creditLimit": 0,
                    
                },
                {
                    "division": 3,
                    "read": true,
                    "sale": true,
                    "void": true,
                    "credit": true,
                    "accounts": true,
                    "batch": true,
                    "creditLimit": 200,
                    
                }
            ],
            "notes": [
                ...
            ]
        },
        {
            ...        
        },
        {
            ...
        }
    ]
}
```

### Search Users
Get user information based on the given criteria
```bash
GET /users?username=admin123
    &userType=admin
    &firstName=Daniel
    &lastName=Robertson
    &phone=6035550123
    &email=d.robertson@comcast.net
```

Returns
```json
{
    "status": 200,
    "message": "Success",
    "data": [
        {    
            "id": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
            "userName": "d.robertson",
            "firstName": "Daniel",
            "lastName": "Robertson",
            "phone": "(603) 555-0123",
            "email": "d.robertson@comcast.net",
            "timezone": "GMT -5",
            "lastLogon": "2021-02-05T10:18:13-05:00",
            "paswwordChanged": "2021-02-05T10:18:13-05:00",
            "userType": "user",
            "department": "Sales",
            "status": 1,
            "permissions": [
                {
                    "division": 1,
                    "read": true,
                    "sale": false,
                    "void": true,
                    "credit": false,
                    "accounts": false,
                    "batch": false,
                    "creditLimit": 0,
                    
                },
                {
                    "division": 3,
                    "read": true,
                    "sale": true,
                    "void": true,
                    "credit": true,
                    "accounts": true,
                    "batch": true,
                    "creditLimit": 200,
                    
                }
            ],
            "notes": [
                ...
            ]
        }
    ]
}
```


### Create User (User)
Creates a new regular user
```bash
POST /create-user
```

Parameters
```json
    {
        "userName": "d.robertson",
        "firstName": "Daniel",
        "lastName": "Robertson",
        "phone": "(603) 555-0123",
        "email": "d.robertson@comcast.net",
        "timezone": "GMT -5",
        "userType": "user",
        "department": "Sales",
        "status": "active"
        "permissions": [
            {
                "division": 1,
                "read": true,
                "sale": false,
                "void": true,
                "credit": false,
                "accounts": false,
                "batch": false,
                "creditLimit": 0,

            },
            {
                "division": 3,
                "read": true,
                "sale": true,
                "void": true,
                "credit": true,
                "accounts": true,
                "batch": true,
                "creditLimit": 200,

            }
        ],
        "notes": [
            ...
        ]
    }
```

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```


### Create User (Admin)
Creates an admin user
```bash
POST /create-admin
```

Parameters
```json
    {    
        "id": "0bc7b36a-9ba9-4ce0-83f0-0a526f354e07",
        "userName": "d.robertson",
        "password": "*****",
        "confirmPassword": "*****",
        "firstName": "Daniel",
        "lastName": "Robertson",
        "phone": "(603) 555-0123",
        "email": "d.robertson@comcast.net",
        "timezone": "GMT -5",
        "department": "Sales",
        "userType": "admin",
        "status": "active"
        "notes": [
            ...
        ]
    }
```

Returns
```json
{
    "status": 200,
    "message": "Success"
}
```

### Update User
```bash
PATCH /user/:id
```

Parameters
```json
{
    "first_name": "Admin",
    "last_name": "User",
    "email": "admin@example.com",
    "phone": "123123123",
    "userType": "admin",
    "username": "admin123",
    "password": "**********",
    "status": "active"
}
```

#### Notes:
- Regular users and admin users have different fields
- Admin users have password while regular users don't, is there a reason for that?
- Do admins need permissions by division as well?

<br>
---
## Reports
### Get Recurrent Reports
Gets all recurring reports

```bash
    GET /recurring-reports
```

Returns
```json
{
    [
        {
            "reportName": "Report Name 1",
            "date": "2021-02-05T10:18:13-05:00",
            "division": [1,2,3],
            "type": ["paypal"],
            "source": [1],
            "lastName": "Robertson"
            "city": "Santa Ana",
            ...
            "recurrenceStartDate": "2021-02-05T10:18:13-05:00",
            "recurrenceRepeat*": "4 weeks",
            "recurrenceStartDate": "2021-02-05T10:18:13-05:00",
            "sendTo": "cedennar@sbcglobal.com",
            "reportType": "Payments"
        },
        {
            ...
        }
    ]
}
```

\* How to format this field

### Create Recurring Reports
Creates a recurring report with the given criteria

```bash
    POST /recurring-reports
```

Returns
```json
{
    [
        {
            "reportName": "Report Name 1",
            "date": "2021-02-05T10:18:13-05:00",
            "division": [1,2,3],
            "type": ["paypal"],
            "source": [1],
            "lastName": "Robertson"
            "city": "Santa Ana",
            ...
            "recurrenceStartDate": "2021-02-05T10:18:13-05:00",
            "recurrenceRepeat*": "4 weeks",
            "recurrenceStartDate": "2021-02-05T10:18:13-05:00",
            "sendTo": "cedennar@sbcglobal.com",
            "reportType": "Payments"
        },
        {
            ...
        }
    ]
}
```

### Get Deposit Reports
Gets all deposit reports

```bash
    GET /deposit-reports
```

Returns
```json
{
    [
        {
            "date": "2021-02-05T10:18:13-05:00",
            "dateRange": "2021-02-05T10:18:13-05:00, 2021-02-06T10:18:13-05:00",
            "cashboxes*": [1, 2, 3],
            "data": [
                {
                    "cashbox": 1,
                    "depositDate": "2021-02-05",
                    "type": "Lorem ipsum",
                    "status": "Active",
                    "totalCount": 1234.50,
                    "totalAmount": 1234.50,
                    "debitCount": 750.23,
                },
                {
                    "cashbox": 2,
                    "depositDate": "2021-02-05",
                    "type": "Lorem ipsum",
                    "status": "Active",
                    "totalCount**": 550.00,
                    "totalAmount**": 550.00,
                    "debitCount**": 250.00,
                }
            ]
        },
        {
            ...
        }
    ]
}
```

### Create Deposit Reports
Creates a new deposit report

```bash
    POST /deposit-reports
```

Returns
```json
{
    [
        {
            "dateRange": "2021-02-05T10:18:13-05:00, 2021-02-06T10:18:13-05:00",
            "cashboxes*": [1, 2, 3],
        },
        {
            ...
        }
    ]
}
```

#### Notes
\* Where can we get the cashboxes data from?
\* Can we create those cashboxes? Where do we create those
\** How are these values being calculated

