Skip to content

Commit

Permalink
Merge pull request #3 from hmrc/MIBM-38
Browse files Browse the repository at this point in the history
Mibm 38
  • Loading branch information
PaulHodgson authored Aug 24, 2020
2 parents e81aef7 + b2dedb4 commit 2e0f3fc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppConfig() extends PaymentServiceConf {
}

trait PaymentServiceConf {
lazy val paymentServiceConf: PaymentServiceConfiguration = ConfigSource.default.at("payment").loadOrThrow[PaymentServiceConfiguration]
lazy val paymentServiceConf: PaymentServiceConfiguration = ConfigSource.default.at("microservice.services.payment").loadOrThrow[PaymentServiceConfiguration]
import paymentServiceConf._
lazy val paymentBaseUri = s"$protocol://$host:$port/"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PaymentController @Inject()(
TraderDetails("Trader Inc, 239 Old Street, Berlin, Germany, EC1V 9EY"),
MerchandiseDetails("Parts and technical crew for the forest moon")
)
makePayment(httpClient, body).map(response => Ok(response.body))
makePayment(httpClient, body).map { response => Redirect(extractUrl(response).nextUrl.value) }
.recoverWith {
case _: Throwable => Future.successful(InternalServerError(errorHandler.internalServerErrorTemplate))
}
Expand Down
6 changes: 3 additions & 3 deletions conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ microservice {
host = localhost
port = 9250
}

payment =
{ type = payment-service-configuration, protocol = "http", port = 9057, host = "localhost" , url = "pay-api/mib-frontend/mib/journey/start" }
}
}

Expand Down Expand Up @@ -91,8 +94,5 @@ google-analytics {

footerLinkItems = ["cookies", "privacy", "termsConditions", "govukHelp"]

payment =
{ type = payment-service-configuration, protocol = "http", port = 9057, host = "localhost" , url = "pay-api/mib-frontend/mib/journey/start" }



2 changes: 1 addition & 1 deletion conf/prod.routes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Add all the application routes to the app.routes file
-> /merchandise-in-baggage-frontend app.Routes
-> /merchandise-in-baggage app.Routes
-> / health.Routes

GET /admin/metrics com.kenshoo.play.metrics.MetricsController.metrics
14 changes: 7 additions & 7 deletions project/AppDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ object AppDependencies {
)

val test = Seq(
"uk.gov.hmrc" %% "bootstrap-test-play-27" % "2.24.0" % Test,
"org.scalatest" %% "scalatest" % "3.1.2" % Test,
"org.jsoup" % "jsoup" % "1.10.2" % Test,
"com.typesafe.play" %% "play-test" % current % Test,
"com.vladsch.flexmark" % "flexmark-all" % "0.35.10" % "test, it",
"org.scalatestplus.play" %% "scalatestplus-play" % "4.0.3" % "test, it",
"com.github.tomakehurst" % "wiremock-standalone" % "2.27.1" % Test
"uk.gov.hmrc" %% "bootstrap-test-play-27" % "2.24.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.2" % Test,
"org.jsoup" % "jsoup" % "1.10.2" % Test,
"com.typesafe.play" %% "play-test" % current % Test,
"com.vladsch.flexmark" % "flexmark-all" % "0.35.10" % "test, it",
"org.scalatestplus.play" %% "scalatestplus-play" % "4.0.3" % "test, it",
"com.github.tomakehurst" % "wiremock-standalone" % "2.27.1" % Test
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ class PaymentControllerSpec extends BaseSpecWithApplication {
}

val getRequest = buildGet(routes.PaymentController.onSubmit().url)
val eventualResult = controller.onSubmit()(getRequest)

contentAsString(controller.onSubmit()(getRequest)) mustBe stubbedApiResponse
status(eventualResult) mustBe 303
redirectLocation(eventualResult) mustBe Some("http://host")
}

"on submit will return error page if call to pay-api fails" in {
Expand Down

0 comments on commit 2e0f3fc

Please sign in to comment.