Skip to content

Commit 720a47f

Browse files
committed
PR suggestions addressed
1 parent db2500f commit 720a47f

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

phoenix-scala/app/models/payment/applepay/ApplePayment.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ case class ApplePayment(
2525
import Validation._
2626

2727
override def validate: ValidatedNel[Failure, ApplePayment] = {
28-
(validExpr(stripeTokenId.startsWith("tok_"), "stripeTokenId should start with 'tok_'") |@| super.validate).map {
28+
(validExpr(stripeTokenId.startsWith("tok_"), "Stripe token should start with 'tok_'") |@| super.validate).map {
2929
case _ this
3030
}
3131
}

phoenix-scala/phoenix/app/phoenix/failures/CartFailures.scala

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ object CartFailures {
2020
override def description = s"order with referenceNumber=$refNum is an empty cart"
2121
}
2222

23+
case class NoCartFound(customerId: Int) extends Failure {
24+
override def description = s"no cart was found for a customer with id=$customerId"
25+
}
26+
2327
case class NoShipAddress(refNum: String) extends Failure {
2428
override def description = s"order with referenceNumber=$refNum has no shipping address"
2529
}

phoenix-scala/phoenix/app/phoenix/services/Checkout.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ object Checkout {
127127
cart * <~ Carts
128128
.findByAccountId(customer.accountId)
129129
.one
130-
.mustFindOr(GeneralFailure("Cart not found!"))
130+
.mustFindOr(NoCartFound(customer.accountId))
131131
order * <~ Checkout(cart, CartValidator(cart)).checkout
132132
} yield order
133133

phoenix-scala/test/integration/ApplePayIntegrationTest.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ApplePayIntegrationTest
5959
val api = cartsApi(api_newCustomerCart(customer.id).referenceNumber)
6060
api.payments.applePay
6161
.add(payment)(defaultAdminAuth)
62-
.mustFailWith400(GeneralFailure("stripeTokenId should start with 'tok_'"))
62+
.mustFailWith400(GeneralFailure("Stripe token should start with 'tok_'"))
6363
}
6464

6565
"Capture of Apple Pay payments" - {

0 commit comments

Comments
 (0)