Skip to content

bilalvur/luigi_payment

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Payment System of Luigi

Luigi Payment System is a sub-module of Luigi project. It accepts coins and PayPal for payment. This repository includes the payment server, a mock client and Node-RED dashboard for interaction with customer.

Table of Contents

Requirements

The system requires both software and hardware elements. The payment system runs on Raspberry Pi, counts coins via a coin counter, polls PayPal e-mail to check whether payment received and communicates with other Luigi modules via ROS.

Hardware Requirements

  • Raspberry Pi 3B
  • CH-926 Multi Coin Acceptor

Software Requirements

Installation & Hardware Setup

  1. Clone or download luigi_payment repository git clone https://github.com/Roboy/luigi_payment.git
  2. Make sure that everything is connected according to circuit scheme, see below.
  3. Edit luigi_payment/src/server.py accordingly (See Payment Server).
  4. Change httpStatic to local luigi_payment (See Setup httpStatic) to show image in user interface.
  5. Import luigi_payment/node-red-payment-ui/flows.json and deploy it (See Import and Deploy Flow).

For very detailed information about how to setup please visit How to Set-up and Start Payment System page.

Usage

  1. Start ROS roscore
  2. Start Node-RED node-red
  3. Create credentials.txt in luigi_payment/src folder and put your e-mail on the 1st line, your password on the 2nd line.
  4. Start payment service python luigi_payment/src/server.py

After these steps payment service should be up and running. Type rosservice list and search for payment_server.

You can see Node-RED interface from any device that is connected to the same network which Raspberry Pi is connected to. Open a browser and go to RASPBERRY_PI_IP:1880/ui.

Detailed Information

In this section, you can find explanations of the scripts and other files.

Flowchart

Payment Server

luigi_payment/src/server.py handles two payment methods which are coins and PayPal and it supports English and German for PayPal payments. In order to run it, start roscore, node-red and then start server.py via python luigi_payment/src/server.py

  • The scripts expect credentials.txt file on the same folder which is luigi_payment/src.
    • 1st line should be e-mail address.
    • 2nd line should be your e-mail password.
  • You can change the following lines in luigi_payment/src/server.py to fit your needs.
MAX_COIN_WAIT_TIME = 60 # in seconds
MAX_PAYPAL_WAIT_TIME = 120 # in secons
INPUT_PIN = 3 # Raspberry Pi GPIO pin to read coin counter output.
EXTRA_WAITING_TIME = 10 # in seconds
PRICE_CHECK_INTERVAL = 1 # in seconds
PAYPAL_ME_URL = 'https://www.paypal.me/roboyicecream/'
PAYPAL_LANGUAGE = 'DE' # DE or EN

PayPal URL should be paypal.me URL.

Mock Client

luigi_payment/src/client.py is going to mock Luigi's payment service call indefinitely with changing payment options.

Node-RED Dashboard

Payment interface can be shown from any device that is connected to the same network which Raspberry Pi is connected to. You need to start Node-RED via node-red and get device's IP to show it on other devices such as tablet.

Import and Deploy Flow

Import flows.json which is under luigi_payment/node-red-payment-ui and deploy it after browsing to 127.0.0.1:1880.

If there are other flows deployed on your system, consider deleting them.

Setup httpStatic

To show image on tablet please change httpStatic to point luigi_payment/images folder. The file should be located in /home/pi/.node-red/settings.js file. E.g. httpStatic: 'LOCAL_PATH/luigi_payment/images/',

There must be comma at the end.

Show UI

You can access the dashboard from any device on the same network by browing RASPBERRY_PI_IP:1880/ui.

Screenshots

Default View Coin Method PayPal Method

About

SS19 Luigi's Payment System

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%