Skip to content

Instantly share code, notes, and snippets.

View hakimkal's full-sized avatar

Abdulhakim Haliru hakimkal

View GitHub Profile
@hakimkal
hakimkal / plugins.sbt
Created October 31, 2021 21:45
Sbt plugins
addSbtPlugin("io.spray" % "sbt-revolver" % "0.9.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.0.0")
@hakimkal
hakimkal / build.sbt
Created October 31, 2021 21:43
merchant-wallet-manager dependencies file
name := "merchant-wallet-manager"
lazy val akkaVersion = "2.6.17"
lazy val akkaHttpVersion = "10.2.6"
lazy val sharedSettings = Seq(
organization := "com.lepltd",
version := "1.0.0",
scalaVersion := "2.13.6",
trapExit := false,
scalacOptions ++= Seq(
@hakimkal
hakimkal / application.conf
Created October 31, 2021 21:38
core/src/main/resources/application.conf
mwManager {
app {
host = "0.0.0.0"
port = 9000
}
postgres {
user=${?LOCAL_DATABASE_USER}
password=${?LOCAL_DATABASE_PASSWORD}
database="merchant_wallet_manager_db"
port=${?LOCAL_DATABASE_PORT}
version: '3.3'
services:
db:
container_name: mysql8
image: mysql:8.0
command: mysqld --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
restart: always
environment:
MYSQL_DATABASE: 'db'
# So you don't have to use root, but you can if you like
@hakimkal
hakimkal / build.sbt
Created August 30, 2021 21:50
SBT Dependencies
libraryDependencies ++= Seq(
"com.github.daddykotex" %% "courier" % courierVersion,
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-spray-json" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-actor-typed" % akkaVersion,
"com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-persistence-query" % akkaVersion,
"ch.qos.logback" % "logback-classic" % "1.2.5",
"io.spray" %% "spray-json" % "1.3.6",
@hakimkal
hakimkal / EmailService.scala
Last active August 30, 2021 21:36
Akka Typed Actor for sending email using Courier library
object EmailService {
case class EmailModel(toEmail: String, subject: String, body: String)
sealed trait Command
case class SendEmailCommand(email: EmailModel, replyTo: ActorRef[Response]) extends Command {
def sendEmail(email: EmailModel): Future[Unit] = {
object PeriodHelper {
def computeEndDate(periodNum: Long, periodType: RecurringInterval) = {
val days: Long = periodType match {
case RecurringInterval.DAY => 1 * periodNum
case RecurringInterval.WEEK => 7 * periodNum
case RecurringInterval.MONTH => 28 * periodNum
case RecurringInterval.YEAR => 365 * periodNum
case _ => 0 * periodNum
}
@hakimkal
hakimkal / docker-compose.yml
Created August 21, 2020 18:56
Confluent Kafka Docker Compose file for Windows Development Environment
version: '3.1'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.2.2
hostname: zookeeper
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
def payment_transactions(conn, params)do
pay_provider = params["provider"]
#check pay provider
if pay_provider == "paystack" do
pay_status = check_paystack_status(transaction_ref)
defp check_paystack_status(reference_id) do
secret_key =
Application.get_env(:project_name, :paystack_config)[:secret_key]
verify_url =
"https://api.paystack.co/transaction/verify/#{reference_id}"
headers = ['Authorization': "Bearer #{secret_key}"]