-
Notifications
You must be signed in to change notification settings - Fork 80
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
Add subscription change proflex settings #833
Conversation
Just confirming this is for SubscriptionChange only right? They aren't able to create a new subscription with these settings? |
Thats correct. This feature allows a merchant to decide how they want to charge or credit a customer when a subscription is changed after the start of a billing cycle. |
81d9660
to
8b2eff6
Compare
var chargeInvoice = invoices.FirstOrDefault(invoice => invoice.Type == "charge"); | ||
var creditInvoice = invoices.FirstOrDefault(invoice => invoice.Type == "credit"); | ||
|
||
Assert.Equal(0, chargeInvoice.SubtotalInCents); |
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.
Added assertions to check proration settings applied to charges and credits here.
db37eef
to
7df73d4
Compare
Library/ProrationSettings.cs
Outdated
|
||
/// <summary> | ||
/// Proration behavior to be applied to charges for the subscription change. | ||
/// Can be set to FullAmount, ProratedAmount, or None. |
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.
Technically, you don't need to document "can be set to...".
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 thought it was helpful when hovering over that property on SubscriptionChange but if its not a common pattern to do this I can remove that.
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.
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 think that's fine for value types, such as NetTerms
, but we and the consumer have access to the literal enum values.
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.
Ah got it. Right.
{ | ||
xmlWriter.WriteStartElement("proration_settings"); | ||
|
||
if (ProrationSettings.Charge != null) |
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.
Ah, thanks for adding null safety here.
plan.Create(); | ||
PlansToDeactivateOnDispose.Add(plan); | ||
|
||
var plan2 = new Plan(GetMockPlanCode(), GetMockPlanName()) |
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.
Not critical, but you could make this test leaner by just changing UnitAmountInCents
on the change.
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 was hoping to see BOTH credits and charges by changing the plan.
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.
Ah, fair.
7df73d4
to
9669d28
Compare
[Full Changelog](1.17.38...1.18.0) **Merged Pull Requests** - Add subscription change proflex settings [#833](#833) ([smagdicatrecurly](https://github.com/smagdicatrecurly))
Adds proration_settings to subscription attributes.