-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
as an aside, we should probably add a proper domain instead of "https://zvobga46la.execute-api.eu-west-1.amazonaws.com" as per the other API gateway lambdas support-service-lambdas/cdk/bin/cdk.ts Line 12 in 9f77d88
|
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/rest/ZuoraGet.scala
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Outdated
Show resolved
Hide resolved
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Outdated
Show resolved
Hide resolved
Agreed, different PR though |
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/CreatePayment.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reordered a lot of functions in this class which is why the diff is so big
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok thanks for the warning, I'll do my best, I will try to comment on new code rather than reordered stuff!
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/GetAccount.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Outdated
Show resolved
Hide resolved
handlers/product-move-api/src/main/scala/com/gu/productmove/zuora/TermRenewal.scala
Show resolved
Hide resolved
handlers/product-move-api/src/test/scala/com/gu/productmove/zuora/CreatePaymentSpec.scala
Show resolved
Hide resolved
ZLayer.succeed(new MockSQS(sqsStubs)), | ||
ZLayer.succeed(new MockDynamo(dynamoStubs)), | ||
ZLayer.succeed(new MockGetAccount(getAccountStubs, getPaymentMethodStubs)), | ||
ZLayer.succeed(new MockInvoiceItemAdjustment(invoiceItemAdjustmentStubs)), | ||
ZLayer.succeed(new MockGetInvoiceItems(getInvoiceItemsStubs)), | ||
ZLayer.succeed(new MockGetInvoice(getInvoiceStubs)), | ||
ZLayer.succeed(new MockCreatePayment(CreatePaymentResponse(Some(true)))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know these tests are ignored (temporarily?) but do we need to check the mutableStore
as part of the test assertions, to make sure it really makes the calls it should?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those tests are not ignored, the mocked ones run, the ones with live classes don't
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok maybe I misread, in which case my question stands even more - do we need to check the mutableStore?
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Show resolved
Hide resolved
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Show resolved
Hide resolved
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Outdated
Show resolved
Hide resolved
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Outdated
Show resolved
Hide resolved
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Show resolved
Hide resolved
…itchtype/RecurringContributionToSupporterPlus.scala Co-authored-by: John Duffell <[email protected]>
…itchtype/RecurringContributionToSupporterPlus.scala Co-authored-by: John Duffell <[email protected]>
...-api/src/main/scala/com/gu/productmove/switchtype/RecurringContributionToSupporterPlus.scala
Outdated
Show resolved
Hide resolved
…itchtype/RecurringContributionToSupporterPlus.scala Co-authored-by: John Duffell <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work persisiting on that one, it's one of those quick jobs that turns into a mountain (of false summits..).
What does this change?
We have noticed that the current product switch from recurring contribution to supporter plus has an issue, which is that because the charge is aligned to the subscription end date, unless the switch happens on a term start date the billing amount and date will be unpredictable.
This PR updates the switch mechanism fairly substantially to avoid this, changes are:
checkChargeAmountBeforeUpdate
parameter which then caused us to run an additional preview call to check whether to collect the amount payable or write it off if it was below $0.50. We now just check the balance of the invoice created by the switch for this amount.Test Subscriptions
Subscription switched on the day it was taken out - no renewal required:
https://apisandbox.zuora.com/platform/subscriptions/8ad093fb8bc82179018bc86b11d25702
Subscription switched part way through the term - renewal required:
https://apisandbox.zuora.com/platform/subscriptions/8ad097048bc82163018bc86dba57092c
How to test