Files

flutterwave-transfer-micro

A microservice to handle flitterware payment services

Installation

  • git clone this repository
  • cd into the repository
  • Build the docker image by docker build -t flutterwave-transfer-micro .

Run

  • Set environment variables like PORT and POSTGRE_URL. Full list in the wiki.
  • docker run -p <BINDING> -e PORT=<app_port> -e POSTGRE_URL=<postgre_url> -e FLUTTERWAVE_API=<flutterwave_config> -i -t flutterwave-transfer-micro

Example configurations

  • binding: 127.0.0.1:3000:3000/tcp
  • app_port: 3000
  • postgre_url: postgresql://wrenchboard:wrenchboard@10.10.10.23:5432/wrenchboard
  • flutterwave_config: eyJCYXNlQXBpVXJsIjoiaHR0cHM6Ly9hcGkuZmx1dHRlcndhdmUuY29tIiwiUHVibGljS2V5IjoiRkxXUFVCS19URVNULTU0YzkwMTQxYjAyODc4OWQ2NzEwNjdiZDcyZjc4MWE5LVgiLCJTZWNyZXRLZXkiOiJGTFdTRUNLX1RFU1QtYzdiYmM4NmQ3ZTcxMDAyNTRjNWU1YmJmMTYyYmYyYjItWCIsIkVuY3J5cHRpb25LZXkiOiJGTFdTRUNLX1RFU1RlOTQ3NGQ0ZTJjZTYifQ==

Example command

docker run -p 127.0.0.1:3000:3000/tcp \
 -e PORT=3000 \
 -e POSTGRE_URL='postgresql://wrenchboard:wrenchboard@10.10.10.23:5432/wrenchboard' \
 -e FLUTTERWAVE_API='eyJCYXNlQXBpVXJsIjoiaHR0cHM6Ly9hcGkuZmx1dHRlcndhdmUuY29tIiwiUHVibGljS2V5IjoiRkxXUFVCS19URVNULTU0YzkwMTQxYjAyODc4OWQ2NzEwNjdiZDcyZjc4MWE5LVgiLCJTZWNyZXRLZXkiOiJGTFdTRUNLX1RFU1QtYzdiYmM4NmQ3ZTcxMDAyNTRjNWU1YmJmMTYyYmYyYjItWCIsIkVuY3J5cHRpb25LZXkiOiJGTFdTRUNLX1RFU1RlOTQ3NGQ0ZTJjZTYifQ==' \
 -i -t flutterwave-transfer-micro

Flutterwave config

Either use a converniece script base64encoder.js or base64 CLI to encode the config:

echo '{
  "BaseApiUrl":"https://api.flutterwave.com",
  "PublicKey":"FLWPUBK_TEST-54c90141b028789d671067bd72f781a9-X",
  "SecretKey":"FLWSECK_TEST-c7bbc86d7e7100254c5e5bbf162bf2b2-X",
  "EncryptionKey":"FLWSECK_TESTe9474d4e2ce6"
}' | base64

Test

npm test


Test Create Transfer

curl -X POST -H 'Content-Type: application/json' -d '{
  "account_bank": "044",
  "account_number": "0690000031",
  "amount": 1337,
  "narration": "This is a test",
  "currency": "NGN",
  "reference": "202308051237",
  "debit_currency": "NGN",
  "money_transfer_id": 67
}' http://localhost:3000/create

Test Get Transfer

http://localhost:3000/status/415801

Test Verify Transaction

http://localhost:3000/verifyTransaction/4499305