Skip to content

Commit

Permalink
Remove unused layers
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertbates committed Nov 10, 2023
1 parent fa74951 commit 9e66460
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.gu.newproduct.api.productcatalog.*
import com.gu.productmove.AwsS3
import com.gu.productmove.GuStageLive.Stage
import com.gu.productmove.endpoint.move.ProductMoveEndpointTypes.{ErrorResponse, InternalServerError, PreviewResult}
import com.gu.productmove.zuora.GetSubscription.GetSubscriptionResponse
import com.gu.productmove.zuora.model.{SubscriptionId, SubscriptionName}
import com.gu.productmove.zuora.rest.ZuoraGet
import com.gu.productmove.zuora.rest.ZuoraRestBody.{ZuoraSuccessCheck, ZuoraSuccessLowercase}
Expand All @@ -38,7 +37,7 @@ trait CreatePayment:
paymentMethodId: String,
amount: BigDecimal,
today: LocalDate,
): ZIO[Stage with GetSubscription, ErrorResponse, CreatePaymentResponse]
): IO[ErrorResponse, CreatePaymentResponse]

object CreatePaymentLive:
val layer: URLayer[ZuoraGet, CreatePayment] = ZLayer.fromFunction(CreatePaymentLive(_))
Expand All @@ -58,7 +57,7 @@ private class CreatePaymentLive(zuoraGet: ZuoraGet) extends CreatePayment:
paymentMethodId: String,
amount: BigDecimal,
today: LocalDate,
): ZIO[Stage with GetSubscription, ErrorResponse, CreatePaymentResponse] = for {
): IO[ErrorResponse, CreatePaymentResponse] = for {
_ <- ZIO.log(
s"Attempting to create payment on account $accountId, invoice $invoiceId, paymentMethodId $paymentMethodId for amount $amount",
)
Expand Down Expand Up @@ -86,7 +85,7 @@ object CreatePayment {
paymentMethodId: String,
amount: BigDecimal,
today: LocalDate,
): ZIO[CreatePayment with Stage with GetSubscription, ErrorResponse, CreatePaymentResponse] =
): ZIO[CreatePayment, ErrorResponse, CreatePaymentResponse] =
ZIO.serviceWithZIO[CreatePayment](_.create(accountId, invoiceId, paymentMethodId, amount, today))
}
case class CreatePaymentRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ object CreatePaymentSpec extends ZIOSpecDefault {
ZuoraGetLive.layer,
ZuoraClientLive.layer,
CreatePaymentLive.layer,
GuStageLive.layer,
GetSubscriptionLive.layer,
SttpClientLive.layer,
SecretsLive.layer,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class JsonCodecSpec extends AnyFlatSpec {
it should "JSON Decoding: null fields should convert to type None" in {
val json = Source.fromResource("AccountBasicInfo2.json").mkString
val expectedBasicInfo = BasicInfo(
"id",
"2c92a0ff58bjkleb0158ff0351370sdf",
DefaultPaymentMethod("2c92a0fd590128e4015902ad34001c1f", None),
None,
"0030J00001tCDhGAMKL",
Expand All @@ -80,7 +80,7 @@ class JsonCodecSpec extends AnyFlatSpec {
it should "JSON Decoding: empty strings should convert to type None" in {
val json = Source.fromResource("AccountBasicInfo.json").mkString
val expectedBasicInfo = BasicInfo(
"id",
"2c92a0ff58bjkleb0158ff0351370sdf",
DefaultPaymentMethod("2c92a0fd590128e4015902ad34001c1f", None),
None,
"0030J00001tCDhGAMKL",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MockCreatePayment(
paymentMethodId: String,
amount: BigDecimal,
today: LocalDate,
): ZIO[Stage with GetSubscription, ErrorResponse, CreatePaymentResponse] = {
): IO[ErrorResponse, CreatePaymentResponse] = {
mutableStore = invoiceId :: mutableStore
ZIO.succeed(response)
}
Expand Down

0 comments on commit 9e66460

Please sign in to comment.