benniekrijger / scala-mollie

Scala client to connect to the Mollie payment provider API

GitHub

Scala Mollie

Build Status Maven Central License

Scala client to connect to the Mollie payment provider API

Dependencies

To include the latest release of the Mollie client into your sbt project, add the following lines to your build.sbt file:

   libraryDependencies += "com.github.benniekrijger" %% "scala-mollie" % "0.15"

This version of scala-mollie depends on Akka 2.4.14 and Scala 2.12.0.

Sample usage

     val mollieConfig = MollieConfig(
       apiHost = "api.mollie.nl",
       apiBasePath = "v1",
       apiKey = Some("liveApiKey"),
       testApiKey = "testApiKey",
       testMode = true
     )
   
     val mollieClient = system.actorOf(
       MollieClientActor.props(mollieConfig),
       MollieClientActor.name
     )
   
     (mollieClient ? GetPayment("some-payment-id")).map {
       case resp: PaymentResponse =>
       case _ => // failure
     }
   
     (mollieClient ? ListPaymentIssuers()).map {
       case resp: PaymentIssuers =>
       case _ => // failure
     }
   
     (mollieClient ? ListPaymentMethods()).map {
       case resp: PaymentMethods =>
       case _ => // failure
     }
     
     (mollieClient ? CreatePaymentIdeal(
        issuer = "ideal_RABONL",
        amount = 10.5,
        description = "Test payment",
        redirectUrl = "http://example.nl/return-url.html",
        webhookUrl = Some("http://example.nl/webhook.html"),
        locale = Some("nl"),
        metadata = Map("orderId" -> "1234")
     )).map {
       case resp: PaymentResponse =>
       case _ => // failure
     }