Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a new term for subscriptions during product switch #2097

Merged
merged 32 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
677860d
Add a TermRenewal service
rupertbates Oct 16, 2023
c3aac26
Working TermRenewal service
rupertbates Oct 31, 2023
5ff63ea
Use TermRenewal service during switch
rupertbates Oct 31, 2023
5c8de5e
Naming change
rupertbates Oct 31, 2023
7b0c6f4
Fix test
rupertbates Oct 31, 2023
304c438
Change the point at which we start the new term
rupertbates Nov 1, 2023
75a5e0c
Set collect to true when renewing term
rupertbates Nov 1, 2023
f82c83e
Collect requires runBilling
rupertbates Nov 1, 2023
637af96
Use applyCreditBalance to handle balance from renewal
rupertbates Nov 1, 2023
85e06f4
Update comment
rupertbates Nov 1, 2023
25dc20f
Standardise the method of fetching today's date
rupertbates Nov 6, 2023
5b594a8
Check the result of the amend term length request
rupertbates Nov 6, 2023
0e8ffd1
Get rid of default values for RenewalRequest body
rupertbates Nov 6, 2023
008f52c
TermRenewal.startNewTermFromToday can return Unit
rupertbates Nov 6, 2023
72a0a22
Do term length change in the subscription update
rupertbates Nov 8, 2023
08ae068
Ignore IT test again
rupertbates Nov 9, 2023
8c7917e
>= 0.5
rupertbates Nov 9, 2023
f522603
Tidy some stuff up
rupertbates Nov 9, 2023
d9c9a0d
Remove extra GetSubscription
rupertbates Nov 9, 2023
fa74951
New call structure for RecurringContributionToSupporterPlus
rupertbates Nov 10, 2023
9e66460
Remove unused layers
rupertbates Nov 10, 2023
a8c43ec
Ignore IT test
rupertbates Nov 10, 2023
b5b86fb
Add email and tracking back in
rupertbates Nov 13, 2023
1dd355c
Remove `checkChargeAmountBeforeUpdate` parameter
rupertbates Nov 13, 2023
ae4562a
Reorder functions in RecurringContributionToSupporterPlus
rupertbates Nov 13, 2023
8384541
A couple of new comments
rupertbates Nov 13, 2023
ae09df5
Correct comments
rupertbates Nov 13, 2023
d328111
Update handlers/product-move-api/src/main/scala/com/gu/productmove/sw…
rupertbates Nov 13, 2023
fe34754
Update handlers/product-move-api/src/main/scala/com/gu/productmove/sw…
rupertbates Nov 13, 2023
06a0c62
PR feedback
rupertbates Nov 13, 2023
0703163
Update handlers/product-move-api/src/main/scala/com/gu/productmove/sw…
rupertbates Nov 13, 2023
28dcea5
PR feedback
rupertbates Nov 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def lambdaProject(
Project(projectName, file(s"handlers/$projectName"))
.enablePlugins(RiffRaffArtifact)
.configs(EffectsTest, HealthCheckTest)
.settings(scalaSettings, testSettings)
.settings(scalaSettings, testSettings, scalafmtSettings)
rupertbates marked this conversation as resolved.
Show resolved Hide resolved
.settings(
name := projectName,
description := projectDescription,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ object Handler extends ZIOApiGatewayRequestHandler {
def testProductMove(): Unit = super.runTest(
"POST",
"/product-move/A-S123",
Some(ProductMoveEndpointTypes.ExpectedInput(49.99, false, false, None, None).toJson),
Some(ProductMoveEndpointTypes.ExpectedInput(49.99, false, None, None).toJson),
)

@main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ package com.gu.productmove.endpoint.move

import com.gu.newproduct.api.productcatalog.{Annual, BillingPeriod, Monthly}
import com.gu.supporterdata.model.SupporterRatePlanItem

import com.gu.productmove.SecretsLive
import com.gu.productmove.endpoint.move.ProductMoveEndpointTypes._
import com.gu.productmove.endpoint.move.ProductMoveEndpointTypes.*
import com.gu.productmove.GuStageLive.Stage
import com.gu.productmove.framework.ZIOApiGatewayRequestHandler.TIO
import com.gu.productmove.framework.{LambdaEndpoint, ZIOApiGatewayRequestHandler}
Expand All @@ -13,18 +12,22 @@ import com.gu.productmove.salesforce.Salesforce.SalesforceRecordInput
import com.gu.productmove.zuora.GetSubscription.RatePlanCharge
import com.gu.productmove.zuora.rest.{ZuoraClientLive, ZuoraGet, ZuoraGetLive}
import com.gu.productmove.zuora.{
CreatePaymentLive,
GetAccount,
GetAccountLive,
GetInvoiceItems,
GetInvoiceItemsLive,
GetInvoiceLive,
GetSubscription,
GetSubscriptionLive,
InvoiceItemAdjustment,
InvoiceItemAdjustmentLive,
Subscribe,
SubscribeLive,
SubscriptionUpdate,
SubscriptionUpdateLive,
GetInvoiceItems,
GetInvoiceItemsLive,
InvoiceItemAdjustment,
InvoiceItemAdjustmentLive,
TermRenewal,
TermRenewalLive,
ZuoraCancel,
ZuoraCancelLive,
}
Expand All @@ -41,12 +44,12 @@ import com.gu.productmove.{
SQSLive,
SttpClientLive,
}
import sttp.tapir._
import sttp.tapir.*
import sttp.tapir.EndpointIO.Example
import sttp.tapir.Schema
import sttp.tapir.json.zio.jsonBody
import zio._
import zio.json._
import zio.*
import zio.json.*
import com.gu.newproduct.api.productcatalog.ZuoraIds.ZuoraIds

import java.time.format.DateTimeFormatter
Expand All @@ -61,7 +64,7 @@ object ProductMoveEndpoint {
run(
SubscriptionName("A-S00448793"),
SwitchType.RecurringContributionToSupporterPlus,
ExpectedInput(1, false, false, None, None),
ExpectedInput(1, false, None, None),
),
)

Expand Down Expand Up @@ -186,12 +189,15 @@ object ProductMoveEndpoint {
ZuoraClientLive.layer,
ZuoraGetLive.layer,
SubscriptionUpdateLive.layer,
TermRenewalLive.layer,
SQSLive.layer,
GetAccountLive.layer,
InvoiceItemAdjustmentLive.layer,
GuStageLive.layer,
DynamoLive.layer,
GetInvoiceItemsLive.layer,
GetInvoiceLive.layer,
CreatePaymentLive.layer,
SecretsLive.layer,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ object ProductMoveEndpointTypes {
case class ExpectedInput(
@description("Price of new Supporter Plus subscription") price: BigDecimal,
@description("Whether to preview the move or to carry it out") preview: Boolean,
checkChargeAmountBeforeUpdate: Boolean,
@description(
"The User Id of the CSR performing the Switch. Populated only if the request comes from Salesforce",
) csrUserId: Option[String],
Expand Down
Loading
Loading