You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Urko da1228082a
fix: index container closing div
5 months ago
cmd/http fix: index container closing div 5 months ago
internal feat: reduce limiter to 30 mins 5 months ago
kit feat: configure webhook 5 months ago
.gitignore feat: add build commands to makefile 5 months ago
LICENSE feat: set up project 5 months ago
Makefile fix makefile missing app_name 5 months ago
README.md feat: upgrade index information and readme 5 months ago
go.mod feat: set up project 5 months ago
go.sum feat: set up project 5 months ago

README.md

Bitcoin Payment Checker

Bitcoin Payment Checker is a Go application that allows clients to pay for orders using Bitcoin. The application calculates the Bitcoin equivalent of the order amount, provides a wallet address for payment, and tracks the payment status.

Demo

You can try it here on bitcoin testnet: https://btcpaychecker.urkob.com/

Application Structure

The application is structured into several packages:

  • handler: Contains the HTTP handlers for the application. The OrderHandler is responsible for processing new orders and calculating the Bitcoin price.
  • services: Contains various services used by the application, such as the Order service for managing orders and the PriceConversor service for converting USD to Bitcoin.
  • main: The entry point of the application. It sets up the database connection, initializes the services, and starts the HTTP server.

Key Files

  • handler/order.go: Contains the OrderHandler which processes new orders. It calculates the Bitcoin price of the order, stores the order in the database, and renders an HTML page with the order details.
  • main.go: The entry point of the application. It sets up the database connection, initializes the services, and starts the HTTP server.

Running the Application

To run the application, you need to have Go installed. Then, you can run the application using the go run command:

go run main.go

This will start the application and listen for HTTP requests on the configured port.

Environment Variables

The application uses the following environment variables:

    PAY_CHECKER_ENV: The environment the application is running in. If set to "dev", the application will load configuration from a .env file.
    DB_ADDRESS: The address of the MongoDB database.
    DB_NAME: The name of the MongoDB database.
    ORDERS_COLLECTION: The name of the MongoDB collection for orders.
    CONVERSOR_API: The API used for converting USD to Bitcoin.
    RPC_HOST, RPC_AUTH, RPC_ZMQ, WALLET_ADDRESS: Configuration for the Bitcoin service.
    MAIL_USER, MAIL_PASSWORD, MAIL_HOST, MAIL_PORT, MAIL_FROM, MAIL_TEMPLATES_DIR: Configuration for the mail service.

Webhook configuration

If you want some http endpoint to be called by POST you have to set up WEBHOOK_URL as environment variable with absolute URL of your endpoint. After payment is completed by client, order will be send through http POST.

Dependencies

The application uses several external packages:

gofiber/fiber/v2: For building the HTTP server and handling requests.
go.mongodb.org/mongo-driver/mongo: For connecting to and interacting with MongoDB.
net/smtp: For sending emails.