This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.janikibichi.routes | |
import net.liftweb.json._ | |
trait Routes extends LazyLogging with CORSHandler { | |
implicit val formats: DefaultFormats = DefaultFormats | |
def routes: server.Route = healthCheckRoutes | |
def healthCheckRoutes: server.Route = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main extends App with LazyLogging with Routes { | |
// SERVER SET UP | |
val httpServerFuture: Future[ServerBinding] = Http().bindAndHandle(routes, http.host, http.port) | |
httpServerFuture.onComplete { | |
case Success(binding: ServerBinding) => | |
logger.info(s"Akka Server is up and bound to ${binding.localAddress}") | |
case Failure(exception) => | |
logger.info( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
akka{ | |
http{ | |
server{ | |
server-header = "UTILITY USSD API" | |
request-timeout = 30s | |
} | |
} | |
} | |
http { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- repo: [email protected]:coyainsurance/pre-commit-scalafmt.git | |
sha: master | |
hooks: | |
- id: scalafmt | |
args: [ -p9090, -t ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repos: | |
- repo: git://github.com/pecigonzalo/pre-commit-shfmt | |
rev: 9ee28e3f14556aa88dd5255f2e091d1d2f607bb7 | |
hooks: | |
- id: shell-fmt | |
- repo: git://github.com/pre-commit/pre-commit-hooks | |
rev: v1.2.3 | |
hooks: | |
- id: check-yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enablePlugins(JavaAppPackaging) | |
name := "utility-ussd" | |
version := "1.0" | |
scalaVersion := "2.12.6" | |
lazy val AkkaVersion = "2.6.3" | |
lazy val AkkaHttpVersion = "10.1.11" | |
libraryDependencies ++= Seq( | |
"com.typesafe.akka" %% "akka-actor" % AkkaVersion, | |
"com.typesafe.akka" %% "akka-stream" % AkkaVersion, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
steps: | |
# Build the container image | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['build', '-t', 'gcr.io/$PROJECT_ID/bboxxussd:$COMMIT_SHA', '.'] | |
# Push the container image to Container Registry | |
- name: 'gcr.io/cloud-builders/docker' | |
args: ['push', 'gcr.io/$PROJECT_ID/bboxxussd:$COMMIT_SHA'] | |
# Deploy container image to Cloud Run | |
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk' | |
entrypoint: gcloud |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once './util.php'; | |
class DBConnector { | |
var $pdo; | |
function __construct(){ | |
$dsn= "mysql:host=". Util::$SERVER_NAME . ";dbname=" . Util::$DB_NAME .""; | |
$options = [ | |
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Utilities { | |
public Utilities(){} | |
public static void launchMpesa(String phoneNumber,Float amount){ | |
//Calculate Discount | |
Double newDiscAmt=(1 - 0.015)*amount; | |
//Send Mpesa checkout with sendMpesaCheckout method defined elsewhere based on daraja API | |
//Metadata CAN BE the MerchantID to be returned to the callback |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.zawadipay.mpesa; | |
import java.util.Date; | |
import java.util.HashMap; | |
public class Mpesa { | |
private HashMap<String,String> requestMetadata = new HashMap<String,String>(){ { put("merchantId", "merchantId"); } }; | |
private String sourceType=""; | |
private String source=""; | |
private String provider =""; |